Skip site navigation (1) Skip section navigation (2)

loading and unloading rows

From: Naomi Walker <nwalker(at)eldocomp(dot)com>
To: pgsql-admin(at)postgresql(dot)org
Subject: loading and unloading rows
Date: 2002-11-01 00:36:07
Message-ID: 4.2.2.20021031172442.01d1fdf0@imap.eldocomp.com (view raw or flat)
Thread:
Lists: pgsql-admin
This might sound silly, but I am trying something basic, and having 
trouble.  What I want to do is unload selected rows from a table, and load 
them somewhere else.

pg_dump works great if you want the whole table.  I suppose I could from 
one table, dump into a temp, and then pg_dump it, but that seems silly.

I noticed in the pg_dump unloaded looking rows, with a:
          COPY "table" FROM stdin;
before the rows.

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.
then did a psql dbname <file-with-rows.sql

The first column loaded, but the rest of the columns did not.  I noticed 
there were | delimiters in my unloaded one, and none in a pg_dump file.

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?

Suggestions?

Thanks,
Naomi
---------------------------------------------------------------------------- 
----------------------------------
Naomi Walker
Eldorado Computing, Inc
Chief Information Officer
nwalker(at)eldocomp(dot)com
602-604-3100 x242
                                    


In response to

Responses

pgsql-admin by date

Next:From: Eric L. BlevinsDate: 2002-11-01 01:01:49
Subject: Re: Signal 11
Previous:From: scott.marloweDate: 2002-10-31 22:46:59
Subject: Re: [GENERAL] my.cnf to postgresql.conf Conversion

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group