Re: [GENERAL] creating a table from another table

From: Bruce Momjian <maillist(at)candle(dot)pha(dot)pa(dot)us>
To: dave(at)aersoft(dot)ie
Cc: pgsql-general(at)postgreSQL(dot)org
Subject: Re: [GENERAL] creating a table from another table
Date: 1999-03-08 17:55:09
Message-ID: 199903081755.MAA06123@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Simon Drabble 1999-03-08 17:56:38 Foreign Keys
Previous Message David O'Farrell 1999-03-08 17:50:08 creating a table from another table