Search Postgresql Archives

Re: Altering array(composite-types) without breaking code when inserting them and similar questions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Dorian Hoxha wrote
> Hi list,
> 
> I have a
> create type thetype(width integer, height integer);
> create table mytable(thetype thetype[]);
> 
> How can i make an insert statement so if i later add fields to the
> composite type, 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);
> 
> 
> Also how to update an whole element of an array of composites ?
> Also, how to update an attribute in a specific element in an array of
> composites?
> 
> (so when i add columns later to the composite, my old code doesn't break)
> 
> How much overhead have the composite types beside the values and nulls?
> 
> Thanks

You should probably just use a table...

I'm doubtful you can alter the type without breaking code.

You can replace a entire single array element as described in the
documentation.  You cannot update single attributes.

As to the overhead question what are you comparing against and what do you
want to measure?

David J.





--
View this message in context: http://postgresql.1045698.n5.nabble.com/Altering-array-composite-types-without-breaking-code-when-inserting-them-and-similar-questions-tp5800847p5800848.html
Sent from the PostgreSQL - general mailing list archive at Nabble.com.


-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux