Re: BUG #17235: PQsendQuery (with two sql) after PQenterPipelineMode cause ERROR - Mailing list pgsql-bugs

From Daniel Verite
Subject Re: BUG #17235: PQsendQuery (with two sql) after PQenterPipelineMode cause ERROR
Date
Msg-id 685289dd-9ee8-45c4-8b67-268c60645dfe@manitou-mail.org
Whole thread Raw
In response to BUG #17235: PQsendQuery (with two sql) after PQenterPipelineMode cause ERROR  (PG Bug reporting form <noreply@postgresql.org>)
Responses Re: BUG #17235: PQsendQuery (with two sql) after PQenterPipelineMode cause ERROR  ("David G. Johnston" <david.g.johnston@gmail.com>)
List pgsql-bugs
    PG Bug reporting form wrote:

> I use libpq in C.
> I call PQsendQuery(conn, "select * from cats; select * from cats") after
> PQenterPipelineMode.
> This cause ERROR
> cannot insert multiple commands into a prepared statement.
> postgresql client 14
> postgresql server 13.4


In pipeline mode, queries are handled with the extended query protocol
which does not support multiple commands per query.

This is mentioned in this note in the documentation
(see
https://www.postgresql.org/docs/current/protocol-flow.html#PROTOCOL-FLOW-EXT-QUERY):

  "The query string contained in a Parse message cannot include more than
  one SQL statement; else a syntax error is reported. This restriction
  does not exist in the simple-query protocol, but it does exist in the
  extended protocol, because allowing prepared statements or portals to
  contain multiple commands would complicate the protocol unduly."


Best regards,
--
Daniel Vérité
PostgreSQL-powered mailer: https://www.manitou-mail.org
Twitter: @DanielVerite



pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: Inconsistent behavior of pg_dump/pg_restore on DEFAULT PRIVILEGES
Next
From: "David G. Johnston"
Date:
Subject: Re: BUG #17235: PQsendQuery (with two sql) after PQenterPipelineMode cause ERROR