Skip site navigation (1) Skip section navigation (2)

Re: moving content of a table to another table

From: "Phillip Smith" <phillips(at)weatherbeeta(dot)com(dot)au>
To: <pgsql-novice(at)postgresql(dot)org>
Subject: Re: moving content of a table to another table
Date: 2006-08-31 23:35:22
Message-ID: 003201c6cd56$213f35b0$9b0014ac@ITPhil (view raw or flat)
Thread:
Lists: pgsql-novice
The way I usually do it is:

COPY old_table TO '/tmp/old_table.sql' ;

<create new table>

COPY new_table FROM '/tmp/old_table.sql' ;

 

Not sure how this would handle your serial columns.

 

Cheers,

-p

 

-----Original Message-----
From: pgsql-novice-owner(at)postgresql(dot)org
[mailto:pgsql-novice-owner(at)postgresql(dot)org] On Behalf Of roy simkes
Sent: Thursday, 31 August 2006 23:05
To: pgsql-novice(at)postgresql(dot)org
Subject: [NOVICE] moving content of a table to another table

 

 
 
Hi, 
 
I'm curious if there is a way to move content of a table to another table? I
do not like to create lot's of insert commands and then delete them. I'm
sure there is an easy way to do this. But I would also like to know if there
can be any problem with a coloumn type of serial. While moving the tables
pgsql will change the serial to the next value of the sequence or will it
leave as it is, and when I reach hat number I will have a problem about
duplicate entry
 
Thanks.

  _____  

Use Messenger to talk to your IM friends, even those on Yahoo! Talk now!
<http://ideas.live.com/programpage.aspx?versionId=7adb59de-a857-45ba-81cc-68
5ee3e858fe> 



*******************Confidentiality and Privilege Notice*******************

The material contained in this message is privileged and confidential to
the addressee.  If you are not the addressee indicated in this message or
responsible for delivery of the message to such person, you may not copy
or deliver this message to anyone, and you should destroy it and kindly
notify the sender by reply email.

Information in this message that does not relate to the official business
of Weatherbeeta must be treated as neither given nor endorsed by Weatherbeeta.
Weatherbeeta, its employees, contractors or associates shall not be liable
for direct, indirect or consequential loss arising from transmission of this
message or any attachments

In response to

pgsql-novice by date

Next:From: Ron PetchDate: 2006-09-01 03:51:47
Subject: Pgtcl
Previous:From: Richard Broersma JrDate: 2006-08-31 20:14:53
Subject: Re: int4 to varchar length (pgadmin3) issue

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group