libpq COPY handling

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: libpq COPY handling
Date: 2013-04-22 19:04:22
Message-ID: CA+TgmobC6HmKVSxocQd-PtCQNe=7skH=gMhJxn893CCoV6OhCA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Noah Misch pointed out something interesting to me:

/*
* PQputCopyEnd - send EOF indication to the backend during COPY IN
*
* After calling this, use PQgetResult() to check command completion status.
*
* Returns 1 if successful, 0 if data could not be sent (only possible
* in nonblock mode), or -1 if an error occurs.
*/

The comment alleges that 0 is a possible return value, but the only
return statements in the code for that function return literal values
of either 1 or -1. I'm not sure whether that's a bug in the code or
the documentation.

Also, I noticed that there are a few places in fe-protocol3.c that
seem not to know about COPY-BOTH mode. I'm not sure that any of these
are actually bugs right now given the current very limited use of
COPY-BOTH mode, but I'm wondering whether it wouldn't be better to
minimize the chance of future surprises. Patch attached.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

Attachment Content-Type Size
libpq-copy-both.patch application/octet-stream 1.4 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Ants Aasma 2013-04-22 19:08:56 Re: Enabling Checksums
Previous Message Simon Riggs 2013-04-22 18:45:13 Re: Fast promotion, loose ends