Re: restore

From: Craig James <craig_james(at)emolecules(dot)com>
To: pgsql-admin(at)postgresql(dot)org
Subject: Re: restore
Date: 2010-10-05 20:50:35
Message-ID: 4CAB8F9B.70401@emolecules.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

On 10/5/10 11:08 AM, Dinesh Bhandary wrote:
> 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.

If your data file is plain text with a COPY or INSERT commands, do this using psql:

begin;
alter table1 rename col2 to col1;
\i datafile.sql
alter table1 rename col1 to col2;
commit;

Craig

In response to

  • restore at 2010-10-05 18:08:11 from Dinesh Bhandary

Browse pgsql-admin by date

  From Date Subject
Next Message Kevin Grittner 2010-10-05 21:30:24 Re: query execution time
Previous Message Julius T 2010-10-05 19:56:49 query execution time