Re: loading and unloading rows - Mailing list pgsql-admin

From Bhuvan A
Subject Re: loading and unloading rows
Date
Msg-id Pine.LNX.4.44.0211011439400.7526-100000@Bhuvan.bksys.co.in
Whole thread Raw
In response to loading and unloading rows  (Naomi Walker <nwalker@eldocomp.com>)
List pgsql-admin
> So, I ran psql, did a \o to capture the output,
> did a select * from table where x=y
> whacked the first row in the output file, and added the COPY statement.
test_db=> \pset tuples_only -- does whacking for you

> This seems way too klunky, so I must be going about it all wrong.  In
> Informix-land I would just do a unload then a load.  What is the postgresql
> equivalent?

It is possible. Delimiters can be used while restoring the data file.
Null string specification can also be specified. See,
test_db=> \h COPY
for more details.

In addition you should also do some find and replace in the data file
before restoring it to another database. They are,
s/\s*|\s*//g
s/^\s*//g

Now, i bet you can able to restore.

regards,
bhuvaneswaran



pgsql-admin by date:

Previous
From:
Date:
Subject: Routine vacuuming [analyze] strategy..
Next
From:
Date:
Subject: Re: offsite warm backup suggestions?