Re: COPY commands could use an enhancement.

Bruce Momjian <pgman@candle.pha.pa.us>

From: Bruce Momjian <pgman@candle.pha.pa.us>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Alfred Perlstein <bright@wintelcom.net>, pgsql-hackers@postgresql.org
Date: 2001-04-30T17:25:32Z
Lists: pgsql-hackers
> Alfred Perlstein <bright@wintelcom.net> writes:
> > It would be very helpful if the COPY command could be expanded
> > in order to provide positional parameters.
> 
> I think it's a bad idea to try to expand COPY into a full-tilt data
> import/conversion utility, which is the direction that this sort of
> suggestion is headed in.  COPY is designed as a simple, fast, reliable,
> low-overhead data transfer mechanism for backup and restore.  The more
> warts we add to it, the less well it will serve that purpose.

What is really cool is Informix's UNLOAD/LOAD commands.  It combines
COPY with SELECT/INSERT:

	UNLOAD TO '/tmp/x'
	SELECT * FROM tab

and LOAD is similar:

	LOAD FROM '/tmp/x'
	INSERT INTO TAB

This leverages SELECT and INSERT's column and WHERE capabilities to do
almost anything you want with flat files.  I think it is superior to our
COPY.

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026