Re: When extended query protocol ends?

From: Jelte Fennema-Nio <postgres(at)jeltef(dot)nl>
To: Vladimir Sitnikov <sitnikov(dot)vladimir(at)gmail(dot)com>
Cc: Tatsuo Ishii <ishii(at)sraoss(dot)co(dot)jp>, m(dot)zhilin(at)postgrespro(dot)ru, davecramer(at)postgres(dot)rocks, tgl(at)sss(dot)pgh(dot)pa(dot)us, pgsql-hackers(at)postgresql(dot)org
Subject: Re: When extended query protocol ends?
Date: 2024-02-28 19:18:02
Message-ID: CAGECzQQ1hs2DU9pmQq18Y=qK4nZqhXDVg-sGEa5K01Lj4XMmxw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, 28 Feb 2024 at 17:51, Vladimir Sitnikov
<sitnikov(dot)vladimir(at)gmail(dot)com> wrote:
>
> Jelte> If the Execute causes an error, is
> Jelte> the Query still executed or not? And what about if the Query fails, is
> Jelte> the Execute before committed or rolled back?
>
> Frankly, if there's a requirement from the backend, I would like it to produce a corresponding error message.
>
> What do you think of making the backend respond with an error message if the requests come out of sequence?
> For instance, if execute comes without parse, backend responds with "ERROR: prepared statement "..." does not exist"

I totally agree that it makes sense to throw an error in this case.
Libpq actually throws an error client side when a caller attempts to
do this, but this is something that should be checked server side,
given that the protocol docs specify this:
docs> At completion of each series of extended-query messages, the
frontend should issue a Sync message.

> If "extended query" is supposed to be like a subprotocol which allows no extra messages,
> then it would help if the documentation enumerated the subprotocols and their messages.
>
> For instance, for copy, the documentation is clear; it goes with a subprotocol, so only specific messages are allowed.

Yeah, I think the existence of this thread is proof that the docs are
currently not very clear on this. Feel free to suggest some changes.

> In other words, SimpleQuery supports pipelining just as fine

That's fair.

> and there's nothing special in "extended query" in that regard.

I think the main difference is that pipelining of extended query
messages requires more care at the client than pipelining of simple
Query messages, because not every extended query message always gets a
response in case of an error.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tomas Vondra 2024-02-28 19:23:28 Re: BitmapHeapScan streaming read user and prelim refactoring
Previous Message Nathan Bossart 2024-02-28 19:08:03 Re: An improved README experience for PostgreSQL