Re: Modifying COPY TO

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Dave Held" <dave(dot)held(at)arrayservicesgrp(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Modifying COPY TO
Date: 2005-02-25 22:56:50
Message-ID: 17046.1109372210@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

"Dave Held" <dave(dot)held(at)arrayservicesgrp(dot)com> writes:
> I am interested in hacking COPY TO such that one can specify that
> rows are copied in a certain index order. I got as far as=20
> src/backend/commands/copy.c:CopyTo(), and it looks like I would need
> to modify the call to heap_beginscan() so that it uses a key.

Actually you'd need to change it to be an index_beginscan call.

Offhand I don't think you need a scan key; the point of a scan key is to
filter the returned rows, and it doesn't sound like that's what you
want. So it should work to do

scandesc = index_beginscan(rel, idx, mySnapshot, 0, NULL);

(plus appropriate changes to the usage of the scandesc)
which leaves only the problem of opening the proper index.

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Stephen Frost 2005-02-25 23:03:39 Re: Modifying COPY TO
Previous Message Dave Held 2005-02-25 22:19:09 Modifying COPY TO