Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id 1029F1337B50 for ; Tue, 5 Oct 2010 15:19:44 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.251]) (amavisd-maia, port 10024) with ESMTP id 32501-03 for ; Tue, 5 Oct 2010 18:19:36 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from mail.int.journyx.com (mail.journyx.com [66.219.41.227]) by mail.postgresql.org (Postfix) with ESMTP id 9FE801337B34 for ; Tue, 5 Oct 2010 15:19:35 -0300 (ADT) Received: from localhost (localhost.localdomain [127.0.0.1]) by mail.int.journyx.com (Postfix) with ESMTP id 7B96B7E5B34; Tue, 5 Oct 2010 13:19:34 -0500 (CDT) X-Virus-Scanned: amavisd-new at zimbra.int.journyx.com Received: from mail.int.journyx.com ([127.0.0.1]) by localhost (mail.int.journyx.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id bwbp28KugVTZ; Tue, 5 Oct 2010 13:19:28 -0500 (CDT) Received: from mail.int.journyx.com (zimbra.int.journyx.com [192.168.100.5]) by mail.int.journyx.com (Postfix) with ESMTP id 96E97C42E5; Tue, 5 Oct 2010 13:19:28 -0500 (CDT) Date: Tue, 5 Oct 2010 13:19:28 -0500 (CDT) From: Scott Whitney Reply-To: Scott Whitney To: dbhandary@iii.com Cc: pgsql-admin@postgresql.org Message-ID: <15942922.53164.1286302768223.JavaMail.root@zimbra.int.journyx.com> In-Reply-To: <2974621.53161.1286302677914.JavaMail.root@zimbra.int.journyx.com> Subject: Re: restore MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_53163_8689524.1286302768220" X-Originating-IP: [192.168.100.188] X-Mailer: Zimbra 6.0.6_GA_2331.RHEL4 (ZimbraWebClient - FF3.0 (Win)/6.0.6_GA_2331.RHEL4) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.909 tagged_above=-10 required=5 tests=BAYES_00=-1.9, HTML_MESSAGE=0.001, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201010/45 X-Sequence-Number: 35786 ------=_Part_53163_8689524.1286302768220 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit There are a couple of ways. Assuming that it's the same database, and it's up and running, you could do this: Assuming: table foo (col1 text, col2 int); table bar (col2 text, col3 int); insert into bar (select * from foo); would stick everything from foo.col1 and foo.col2 into bar.col2 and bar.col3 respectively. Using pg_dump, you could dump just the table: pg_dump -t foo mydatabase and edit the CREATE TABLE statement. Hi All, Is there an easy way to restore to a new table where the column name have been changed but data remains the same? For example I am trying to restore from existing system, table1(col1) to table1(col2) and it is erroring out on the new column name even though it is a data only restore. I was just wondering if there is a quick way to bypass this. Let me know. Thanks. Dinesh -- Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-admin ------=_Part_53163_8689524.1286302768220 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable <= div style=3D'font-family: Times New Roman; font-size: 12pt; color: #000000'= >There are a couple of ways. Assuming that it's the same database, and it's= up and running, you could do this:

Assuming:
table foo (col1 tex= t, col2 int);
table bar (col2 text, col3 int);

insert into bar (s= elect * from foo);

would stick everything from foo.col1 and foo.col2= into bar.col2 and bar.col3 respectively.

Using pg_dump, you could d= ump just the table:
pg_dump -t foo mydatabase

and edit the CREATE= TABLE statement.




  H= i All,

Is there an easy way to restore to a new table where the colu= mn name
have been changed but data remains the same?
For example I a= m trying to restore from existing system,  table1(col1)
to table1(= col2) and it is erroring out on the new column name even
though it is a= data only restore. I was just wondering if there is a
quick way to byp= ass this. Let me know.

Thanks.

Dinesh

--
Sent via = pgsql-admin mailing list (pgsql-admin@postgresql.org)
To make changes to= your subscription:
http://www.postgresql.org/mailpref/pgsql-admin

------=_Part_53163_8689524.1286302768220--