Re: psql: Add command to use extended query protocol

From: Corey Huinker <corey(dot)huinker(at)gmail(dot)com>
To: Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: psql: Add command to use extended query protocol
Date: 2022-11-08 23:12:14
Message-ID: CADkLM=eKhxvFG-cYF+VQczgOT0wQUZFaa32SZFCtDVgy7xBXZA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

>
>
> Btw., this also allows doing things like
>
> SELECT $1, $2
> \bind '1' '2' \g
> \bind '3' '4' \g
>

That's one of the things I was hoping for. Very cool.

>
> This isn't a prepared statement being reused, but it relies on the fact
> that psql \g with an empty query buffer resends the previous query.
> Still kind of neat.

Yeah, if they wanted a prepared statement there's nothing stopping them.

Review:

Patch applies, tests pass.

Code is quite straightforward.

As for the docs, they're very clear and probably sufficient as-is, but I
wonder if we should we explicitly state that the bind-state and bind
parameters do not "stay around" after the query is executed? Suggestions in
bold:

This command causes the extended query protocol (see <xref
linkend="protocol-query-concepts"/>) to be used, unlike normal
<application>psql</application> operation, which uses the simple
query protocol. *Extended query protocol will be used* *even if
no parameters are specified, s*o this command can be useful to test the
extended
query protocol from psql. *This command affects only the next
query executed, all subsequent queries will use the regular query protocol
by default.*

Tests seem comprehensive. I went looking for the TAP test that this would
have replaced, but found none, and it seems the only test where we exercise
PQsendQueryParams is libpq_pipeline.c, so these tests are a welcome
addition.

Aside from the possible doc change, it looks ready to go.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Justin Pryzby 2022-11-08 23:12:26 Re: Commit fest 2022-11
Previous Message Jacob Champion 2022-11-08 23:08:53 Re: libpq support for NegotiateProtocolVersion