Re: RETURNING syntax for COPY - Mailing list pgsql-hackers

From Heikki Linnakangas
Subject Re: RETURNING syntax for COPY
Date
Msg-id 518A843A.3020408@vmware.com
Whole thread Raw
In response to Re: RETURNING syntax for COPY  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: RETURNING syntax for COPY  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
On 08.05.2013 19:44, Tom Lane wrote:
> Karol Trzcionka<karlikt@gmail.com>  writes:
>> as a continuation of my proposal expanding RETURNING syntax by
>> AFTER/BEFORE, there can be enough time to implement RETURNING for COPY.
>
> No there isn't; what you suggest would require FE/BE protocol
> extensions, making it several orders of magnitude more work than the
> other thing.

I'd imagine that the flow would go something like this:

BE    FE

CopyInResponseCopyDataCopyData...CopyDone
RowDescription
DataRow
DataRow
CommandComplete

A well-written client should be able to handle that. But if one expects 
the backend to always send a CommandComplete after CopyDone, it will get 
confused. Implementing that doesn't seem too difficult to me.

I agree that this is much more work than the UPDATE RETURNING 
BEFORE/AFTER, though. Not sure if that's a good or a bad thing.

- Heikki



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: RETURNING syntax for COPY
Next
From: Tom Lane
Date:
Subject: Re: RETURNING syntax for COPY