Search Postgresql Archives

Re: CREATE TABLE & composite type

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

 



Adrian Klaver-4 wrote
> 
> CREATE TABLE inventory_item_table AS ( SELECT some_func( ) limit 0);

Thanks Adrian
My concern is that this will have to execute all code in the function only
to return a empty dataset - his may be ineffective.
A possible workaround will be to have a dedicated param which will determine
whether or not to exit at the start of the function.

I also just realised that a possible workaround will be to create tables
instead of composite types ("Whenever you create a table, a composite type
is also automatically created"). 

I.e. instead of doing:
CREATE TYPE inventory_item AS ( name text, supplier_id integer, price
numeric );

create an actual table (which will never be used):
CREATE TABLE inventory_item AS ( name text, supplier_id integer, price
numeric );

However, having unused tables in the schema kind of goes against the
grain...

Regards




--
View this message in context: http://www.postgresql-archive.org/CREATE-TABLE-composite-type-tp5969032p5969045.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