This project is archived and is in readonly mode.

#66 ✓ resolved
Sergey Shepelev

Array of composite/hstore type

Reported by Sergey Shepelev | August 15th, 2011 @ 03:05 PM

db=> create type comp_type_test as (id uuid, f1 char(2), f2 smallint, f3 char(3), f4 char(3));

>>> psycopg2.extras.register_composite('comp_type_test', connection, globally=True)

>>> db.execute("select ('000003b3-50a9-eeaa-4aab-2a95e6ca6592', 'J2', 600, 'MOW', 'BER')::comp_type_test").fetchone()
(comp_type_test(id=UUID('000003b3-50a9-eeaa-4aab-2a95e6ca6592'), f1=u'J2', f2=600, f3=u'MOW', f4=u'BER'),)

This is good.

>>> db.execute("select array[('000003b3-50a9-eeaa-4aab-2a95e6ca6592', 'J2', 600, 'MOW', 'BER')]::comp_type_test[]").fetchone()
('{"(000003b3-50a9-eeaa-4aab-2a95e6ca6592,J2,600,MOW,BER)"}',)

This is not good.

Is it possible to make psycopg2 understand arrays of composite values (or at least arrays of hstore)?

Comments and changes to this ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

WARNING: the informations in this tracker are archived. Please submit new tickets or comments to the new tracker.


Psycopg is the most used PostgreSQL adapter for the Python programming language. At the core it fully implements the Python DB API 2.0 specifications. Several extensions allow access to many of the features offered by PostgreSQL.

Shared Ticket Bins

Tags

Pages