Re: making a copy of a table within the same database

From: Pavel Stehule <stehule(at)kix(dot)fsv(dot)cvut(dot)cz>
To: Sally Sally <dedeb17(at)hotmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: making a copy of a table within the same database
Date: 2004-03-03 15:11:10
Message-ID: Pine.LNX.4.44.0403031605230.30569-100000@kix.fsv.cvut.cz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hello

select into is usefull cmd for you

http://developer.postgresql.org/docs/postgres/sql-selectinto.html

select * into newtable from oldtable;

regards
Pavel Stehule

On Wed, 3 Mar 2004, Sally Sally wrote:

> I wanted to dump the contents of one table to another (with a different
> name) within the same database. I am looking at pg_restore and it doesn't
> seem to have the option of specifying the name of the table we want to dump
> to, only the name we want to dump from. Does this mean I have to create the
> table and do an sql statement to copy the table? Is this the best way?
> Sally
>
> _________________________________________________________________
> Fast. Reliable. Get MSN 9 Dial-up - 3 months for the price of 1!
> (Limited-time Offer) http://click.atdmt.com/AVE/go/onm00200361ave/direct/01/
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Nick Barr 2004-03-03 15:13:30 Re: How index are running and how to optimise ?
Previous Message Tom Lane 2004-03-03 15:08:56 Re: SPI memory managment issue