Re: [PATCHES] COPY view

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Zoltan Boszormenyi <zboszor(at)dunaweb(dot)hu>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: [PATCHES] COPY view
Date: 2006-08-23 18:09:16
Message-ID: 23235.1156356556@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

Zoltan Boszormenyi <zboszor(at)dunaweb(dot)hu> writes:
> How about the callback solution for the SELECT case
> that was copied from the original? Should I consider
> open-coding in copy.c what ExecutorRun() does
> to avoid the callback?

Adding a DestReceiver type is a good solution ... although that static
variable is not. Instead define a DestReceiver extension struct that
can carry the CopyState pointer for you. You could also consider
putting the copy-from-view-specific state fields into DestReceiver
instead of CopyState, though this is a bit asymmetric with the relation
case so maybe it's not really cleaner.

BTW, lose the tuple_to_values function --- it's an extremely bad
reimplementation of heap_deform_tuple. copy_dest_printtup also seems
coded without regard for the TupleTableSlot access API (read printtup()
to see what to do instead). And what's the point of factoring out the
heap_getnext loop as CopyRelationTo? It's not like that lets you share
any more code. The inside of the loop, ie what you've called
CopyValuesTo, is the sharable part.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruno Wolff III 2006-08-23 18:17:24 Re: pgsql-patches reply-to (was Re: [PATCHES] selecting large result sets in psql using cursors)
Previous Message Tom Lane 2006-08-23 17:48:15 Re: [PATCHES] COPY view

Browse pgsql-patches by date

  From Date Subject
Next Message Bruno Wolff III 2006-08-23 18:17:24 Re: pgsql-patches reply-to (was Re: [PATCHES] selecting large result sets in psql using cursors)
Previous Message Tom Lane 2006-08-23 17:48:15 Re: [PATCHES] COPY view