Re: Modifying COPY TO - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Modifying COPY TO
Date
Msg-id 17046.1109372210@sss.pgh.pa.us
Whole thread Raw
In response to Modifying COPY TO  ("Dave Held" <dave.held@arrayservicesgrp.com>)
List pgsql-hackers
"Dave Held" <dave.held@arrayservicesgrp.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


pgsql-hackers by date:

Previous
From: "Dave Held"
Date:
Subject: Modifying COPY TO
Next
From: Stephen Frost
Date:
Subject: Re: Modifying COPY TO