Обсуждение: Is thre a way?
Hi o/
I have a table with 2000 names and emails.. and I did UPDATE list SET email = '' without the WHERE and now all rows is null in column email..
I have a backup made with pg_dump.. is there a way to restore only the email data?
Thanks!!
I have a table with 2000 names and emails.. and I did UPDATE list SET email = '' without the WHERE and now all rows is null in column email..
I have a backup made with pg_dump.. is there a way to restore only the email data?
Thanks!!
Look at the cheat-sheet:
From: pgsql-general-owner@postgresql.org [mailto:pgsql-general-owner@postgresql.org] On Behalf Of Anderson dos Santos Donda
Sent: Wednesday, May 06, 2009 1:28 PM
To: pgsql-general@postgresql.org
Subject: [GENERAL] Is thre a way?
Hi o/
I have a table with 2000 names and emails.. and I did UPDATE list SET email = '' without the WHERE and now all rows is null in column email..
I have a backup made with pg_dump.. is there a way to restore only the email data?
Thanks!!
On 06/05/2009 21:28, Anderson dos Santos Donda wrote: > I have a table with 2000 names and emails.. and I did UPDATE list SET > email = '' without the WHERE and now all rows is null in column > email.. <pedant mode> They're not null, they're just filled with empty strings.... :-) </pedant mode> > I have a backup made with pg_dump.. is there a way to restore only > the email data? If the backup is in PLAIN (text) format, you can copy-and-paste the relevant bits into a new script, and run that through psql. If it's in one of the binary formats, I think pg_restore lets you choose which objects you want to restore. Either way, you ought to be OK. You may find it easiest to drop the table first, restore it from the backup, and then restore any foreign key dependencies. Ray. ------------------------------------------------------------------ Raymond O'Donnell, Director of Music, Galway Cathedral, Ireland rod@iol.ie Galway Cathedral Recitals: http://www.galwaycathedral.org/recitals ------------------------------------------------------------------
On 2009-05-06, Anderson dos Santos Donda <andersondonda@gmail.com> wrote: > --0021cc022382dbd1bb0469443c6e > Content-Type: text/plain; charset=ISO-8859-1 > Content-Transfer-Encoding: 7bit > > Hi o/ > > I have a table with 2000 names and emails.. and I did UPDATE list SET email >= '' without the WHERE and now all rows is null in column email.. > > > I have a backup made with pg_dump.. is there a way to restore only the email > data? what format of pg_dump? If a binary dump use pg_restore to restore the table you want to a scratch database then use dblink or copy to get that into a temp table in the database you want. If a text dump use sed (or an interactive editor) to extract the table data you want, load it into a temp table finally do an UPDATE ... FROM .... to fix the losses. I had to do this a few months ago.
My backup is PLAIN(text) format... i'll try to do with sed...
Thanks for all o/
Thanks for all o/
On Thu, May 7, 2009 at 9:14 AM, Jasen Betts <jasen@xnet.co.nz> wrote:
On 2009-05-06, Anderson dos Santos Donda <andersondonda@gmail.com> wrote:
> --0021cc022382dbd1bb0469443c6e
> Content-Type: text/plain; charset=ISO-8859-1
> Content-Transfer-Encoding: 7bitwhat format of pg_dump?>
> Hi o/
>
> I have a table with 2000 names and emails.. and I did UPDATE list SET email
>= '' without the WHERE and now all rows is null in column email..
>
>
> I have a backup made with pg_dump.. is there a way to restore only the email
> data?
If a binary dump use pg_restore to restore the table you want to a
scratch database then use dblink or copy to get that into a temp table
in the database you want.
If a text dump use sed (or an interactive editor) to extract the table
data you want, load it into a temp table
finally do an
UPDATE ... FROM ....
to fix the losses.
I had to do this a few months ago.
--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general