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:2
Avg. Score:3.0 ± 0.0
Reproduced:0 of 0 (0.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
Have you experienced this issue?
Rate the importance of this bug to you:

 [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-2020 The PHP Group
All rights reserved.
Last updated: Tue Aug 04 17:01:25 2020 UTC