Re: [GENERAL] creating a table from another table - Mailing list pgsql-general

From Bruce Momjian
Subject Re: [GENERAL] creating a table from another table
Date
Msg-id 199903081755.MAA06123@candle.pha.pa.us
Whole thread Raw
In response to creating a table from another table  ("David O'Farrell" <dave.ofarrell@aersoft.ie>)
Responses Re: [GENERAL] creating a table from another table
List pgsql-general
>
> -- is there any smart way to duplicate a table definition (NOT the
> data in the table).I want to create table(s) from a predefined template
> and drop them when they are empty .
>

SELECT * INTO newone FROM table WHERE 1=0;

--
  Bruce Momjian                        |  http://www.op.net/~candle
  maillist@candle.pha.pa.us            |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026

pgsql-general by date:

Previous
From: "David O'Farrell"
Date:
Subject: creating a table from another table
Next
From: Simon Drabble
Date:
Subject: Foreign Keys