Re: psql: Add command to use extended query protocol
Peter Eisentraut <peter.eisentraut@enterprisedb.com>
From: Peter Eisentraut <peter.eisentraut@enterprisedb.com>
To: Simon Riggs <simon.riggs@enterprisedb.com>
Cc: pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2022-11-01T20:47:51Z
Lists: pgsql-hackers
Commits
Same data as JSON:
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
psql: Add command to use extended query protocol
- 5b66de3433e2 16.0 landed
On 01.11.22 10:10, Simon Riggs wrote:
> On Fri, 28 Oct 2022 at 07:53, Peter Eisentraut
> <peter.eisentraut@enterprisedb.com> wrote:
>>
>> This adds a new psql command \gp that works like \g (or semicolon) but
>> uses the extended query protocol. Parameters can also be passed, like
>>
>> SELECT $1, $2 \gp 'foo' 'bar'
>
> +1 for the concept. The patch looks simple and complete.
>
> I find it strange to use it the way you have shown above, i.e. \gp on
> same line after a query.
That's how all the "\g" commands work.
> ...since if we used this in a script, it would be used like this, I think...
>
> SELECT $1, $2
> \gp 'foo' 'bar'
> \gp 'bar' 'baz'
> ...
Interesting, but I think for that we should use named prepared
statements, so that would be a separate "\gsomething" command in psql, like
SELECT $1, $2 \gprep p1
\grun p1 'foo' 'bar'
\grun p1 'bar' 'baz'