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

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: (view raw, whole thread or download thread mbox)
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                        |
  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

pgsql-hackers by date

Next:From: Jim C. NasbyDate: 2005-02-26 02:35:02
Subject: Re: idea for concurrent seqscans
Previous:From: Bruce MomjianDate: 2005-02-26 01:52:40
Subject: Re: idea for concurrent seqscans

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