Re: Copy table structure

From: paul(at)entropia(dot)co(dot)uk
To: pgsql-novice(at)postgresql(dot)org
Subject: Re: Copy table structure
Date: 2003-10-08 06:48:47
Message-ID: 3F83C15F.3147.3D13930@localhost
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

On 4 Oct 2003 at 12:22, Anshuman Kanwar wrote:

here's one way:

mfx=# begin; create table NEWTABLE as select * from OLDTABLE; delete from
NEWTABLE; end;

Hope this helps

Paul Butler

> Hi all,
>
> How do I copy only the table structure from one tabe to another.
>
> Table A has some data but I just want to copy the number of columns and the
> column names from this table and create a table B. What is the best way of
> doing this ?
>
> Thanks in advance,
> -ansh
>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: Have you searched our list archives?
>
> http://archives.postgresql.org

In response to

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Peter Childs 2003-10-08 07:31:17 Re: Copy table structure
Previous Message Tom Lane 2003-10-08 03:26:09 Re: perlsub