Re: Modifying COPY TO

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: "Jim C(dot) Nasby" <decibel(at)decibel(dot)org>
Cc: Dave Held <dave(dot)held(at)arrayservicesgrp(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Modifying COPY TO
Date: 2005-02-26 01:55:59
Message-ID: 200502260155.j1Q1txZ22244@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Jim C. Nasby 2005-02-26 02:35:02 Re: idea for concurrent seqscans
Previous Message Bruce Momjian 2005-02-26 01:52:40 Re: idea for concurrent seqscans