Re: psql: Add command to use extended query protocol

From: Jehan-Guillaume de Rorthais <jgdr(at)dalibo(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-02 12:43:27
Message-ID: 20221102134327.2887f82b@karst
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On Fri, 28 Oct 2022 08:52:51 +0200
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'

As I wrote in my TCE review, would it be possible to use psql vars to set some
named parameters for the prepared query? This would looks like:

\set p1 foo
\set p2 bar
SELECT :'p1', :'p2' \gp

This seems useful when running psql script passing it some variables using
-v arg. It helps with var position, changing some between exec, repeating them
in the query, etc.

Thoughts?

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Pavel Stehule 2022-11-02 12:55:22 Re: psql: Add command to use extended query protocol
Previous Message Justin Pryzby 2022-11-02 11:58:01 Re: Make ON_ERROR_STOP stop on shell script failure