php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #59262 Add support for Arrays/Composite types
Submitted: 2010-06-16 07:26 UTC Modified: -
Votes:4
Avg. Score:3.5 ± 0.9
Reproduced:2 of 2 (100.0%)
Same Version:1 (50.0%)
Same OS:1 (50.0%)
From: dmitry dot chirkin at gmail dot com Assigned:
Status: Open Package: PDO_PGSQL (PECL)
PHP Version: Irrelevant OS:
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: dmitry dot chirkin at gmail dot com
New email:
PHP Version: OS:

 

 [2010-06-16 07:26 UTC] dmitry dot chirkin at gmail dot com
Description:
------------
Hi!
Is it posible to add support for Composite types and Array-
datatypes in Postgres?

Now they returned as "strings" and it is hard to parse it.







Reproduce code:
---------------
Here the example: 

CREATE TYPE gender AS ENUM
   ('male',
    'female',
    'undefined');


CREATE TYPE facebook AS
   (id bigint,
    "login" character varying(255),
    "key" text);

CREATE TABLE "user"
(
  id serial NOT NULL,
  "login" character varying(127) NOT NULL,
  "password" character(32) NOT NULL,
  email character varying(255) NOT NULL,
  gender gender NOT NULL DEFAULT 'undefined'::gender,
  facebook facebook,
  CONSTRAINT user_pkey PRIMARY KEY (id)
  )
WITH (
  OIDS=FALSE
);


>> select id, password, email, facebook, gender from "user";
 id |             password             |     email      |       facebook        | gender 
----+----------------------------------+----------------+-----------------------+--------
  1 | 123                              | test@test.com | (1,josser,"long key") | male




Expected result:
----------------
I think it will be very helpful if the facebook type will be 
represented as OBJ or as ARRAY (FETCH_OBJ/FETCH_ASSOC?).

Thanks!
Sorry about my bad english. 

Actual result:
--------------
Currently they are represented as strings which is hard to 
parse.

Patches

Pull Requests

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Dec 04 18:01:31 2024 UTC