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, Pennsylvania 19073 ---------------------------(end of broadcast)--------------------------- TIP 8: explain analyze is your friend