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
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
MUST BE VALID
Solve the problem:
37 - 18 = ?
Subscribe to this entry?

 
 [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

Add a Patch

Pull Requests

Add a Pull Request

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Apr 24 02:01:30 2024 UTC