Re: psql: Add command to use extended query protocol

From: Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com>
To: Simon Riggs <simon(dot)riggs(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-01 20:47:51
Message-ID: 302d5637-ded0-79ab-03c2-49d77c57514a@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 01.11.22 10:10, Simon Riggs wrote:
> On Fri, 28 Oct 2022 at 07:53, Peter Eisentraut
> <peter(dot)eisentraut(at)enterprisedb(dot)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'

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2022-11-01 21:00:27 Re: perl 5.36, C99, -Wdeclaration-after-statement -Wshadow=compatible-local
Previous Message Thomas Munro 2022-11-01 20:44:30 Re: Direct I/O