Re: loading and unloading rows

From: Bhuvan A <bhuvansql(at)myrealbox(dot)com>
To: pgsql-admin(at)postgresql(dot)org
Subject: Re: loading and unloading rows
Date: 2002-11-01 09:22:44
Message-ID: Pine.LNX.4.44.0211011439400.7526-100000@Bhuvan.bksys.co.in
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message mallah 2002-11-01 10:12:10 Re: offsite warm backup suggestions?
Previous Message mallah 2002-11-01 08:35:49 Routine vacuuming [analyze] strategy..