As the table definitions get updated frequently, I'd like to put in my script to create the table as a copy of the existing 'real' table. I'm assuming "create table as" would be what I need to use, but what would I use as the select sql - i.e. how do I use select to pull the definition of a table.

The create statement allows you to copy a table structure, including or excluding constraints. For inclusion and exclusion effects, please read the manual info related with the 'like' clause of the 'create table' statement.

Ex.:
create temporary table mytesttable (like mymaintable excluding constraints excluding defaults);


Regards,

Hélder M. Vieira

---------------------------(end of broadcast)---------------------------
TIP 7: You can help support the PostgreSQL project by donating at

               http://www.postgresql.org/about/donate

Reply via email to