Altering array(composite-types) without breaking code when inserting them - Mailing list psycopg

From Dorian Hoxha
Subject Altering array(composite-types) without breaking code when inserting them
Date
Msg-id CANsFX07yvsP3NqeED8w21ytu7nuTC7HRXgd7BU6J=3kjUrQ-5g@mail.gmail.com
Whole thread Raw
List psycopg

I have:

create type thetype(width integer, height integer);
create table mytable(thetype thetype[]);

How can I make an insert statement, so if I add fields to the composite type in the future, the code/query doesn't break?

Maybe by specifying the fields of the composite type in the query?

This can be done for normal inserts (non arrays):

CREATE TABLE mytable (t thetype);

INSERT INTO mytable(t.width, t.height) VALUES (11,22);

(so when I add columns to the composite later, my old sql-insert doesn't break (not specified columns are inserted as NULL)).

PS: I always query this data together. The other way is to use json but like this i have more flexibility (update an element of an composite type in an array, more data-types) and less storage (no keys saved for each row like in json/mongodb/hstore).

psycopg by date:

Previous
From: Nicolas Boullis
Date:
Subject: Re: Problem with ZPsycopgDA’s pool
Next
From: Nicolas Boullis
Date:
Subject: Re: Problem with ZPsycopgDA’s pool