From: | Alvaro Herrera <alvherre(at)commandprompt(dot)com> |
---|---|
To: | Noah Misch <noah(at)leadboat(dot)com> |
Cc: | Robert Haas <robertmhaas(at)gmail(dot)com>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: psql COPY vs. ON_ERROR_ROLLBACK, multi-command strings |
Date: | 2012-03-12 15:11:38 |
Message-ID: | 1331564960-sup-8481@alvh.no-ip.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Excerpts from Noah Misch's message of jue mar 08 12:11:37 -0300 2012:
>
> On Wed, Mar 07, 2012 at 04:57:12PM -0500, Robert Haas wrote:
> > As a side note, the documentation for PQexec() is misleading about
> > what will happen if COPY is present in a multi-command string. It
> > says: "Note however that the returned PGresult structure describes
> > only the result of the last command executed from the string. Should
> > one of the commands fail, processing of the string stops with it and
> > the returned PGresult describes the error condition. It does not
> > explain that it also stops if it hits a COPY. I had to read the
> > source code for libpq to understand why this psql logic was coded the
> > way it is.
>
> Agreed; I went through a similar process. Awhile after reading the code, I
> found the behavior documented in section "Functions Associated with the COPY
> Command":
>
> If a COPY command is issued via PQexec in a string that could contain
> additional commands, the application must continue fetching results via
> PQgetResult after completing the COPY sequence. Only when PQgetResult
> returns NULL is it certain that the PQexec command string is done and it is
> safe to issue more commands.
>
> I'm not quite sure what revision would help most here -- a cross reference,
> moving that content, duplicating that content. Offhand, I'm inclined to move
> it to the PQexec() documentation with some kind of reference back from its
> original location. Thoughts?
I would vote for moving it and adding a reference in the COPY functions
section. That way, the PQexec doc is complete by itself without having
to duplicate anything.
--
Álvaro Herrera <alvherre(at)commandprompt(dot)com>
The PostgreSQL Company - Command Prompt, Inc.
PostgreSQL Replication, Consulting, Custom Development, 24x7 support
From | Date | Subject | |
---|---|---|---|
Next Message | Kohei KaiGai | 2012-03-12 15:13:52 | Re: [v9.2] Add GUC sepgsql.client_label |
Previous Message | Robert Haas | 2012-03-12 15:01:02 | Re: [v9.2] Add GUC sepgsql.client_label |