Re: Modifying COPY TO - Mailing list pgsql-hackers

From Bruce Momjian
Subject Re: Modifying COPY TO
Date
Msg-id 200502260155.j1Q1txZ22244@candle.pha.pa.us
Whole thread Raw
In response to Re: Modifying COPY TO  ("Jim C. Nasby" <decibel@decibel.org>)
List pgsql-hackers
Jim C. Nasby wrote:
> Instead of just being able to specify an index to use, how hard would it
> be to allow COPY TO to work from a generic query instead of just a
> table? That way you wouldn't need to do a diff, you could just export
> only new records. ISTM there's far more use for copying from a query
> result that just copying by index order.

The reason we don't support queries with COPY is because COPY reads from
the raw heap rather than going through the executor.  We could
special-case it so queries go through the executor but would take a
little work.

The only trick I can think of for now is to use SELECT ... INTO
TEMPORARY tab ... oRDER BY and then use COPY to dump the table.  It will
then dump in the order of the ORDER BY.


--  Bruce Momjian                        |  http://candle.pha.pa.us pgman@candle.pha.pa.us               |  (610)
359-1001+  If your life is a hard drive,     |  13 Roberts Road +  Christ can be your backup.        |  Newtown Square,
Pennsylvania19073
 


pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: idea for concurrent seqscans
Next
From: "Jim C. Nasby"
Date:
Subject: Re: idea for concurrent seqscans