From: | "Daniel Verite" <daniel(at)manitou-mail(dot)org> |
---|---|
To: | "Jehan-Guillaume de Rorthais" <jgdr(at)dalibo(dot)com> |
Cc: | Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com>, Pgsql-Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: psql: Add command to use extended query protocol |
Date: | 2022-11-02 15:04:02 |
Message-ID: | 1db4332c-f9ac-4a4a-8ea8-e1257901d7db@manitou-mail.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Jehan-Guillaume de Rorthais wrote:
> 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
As I understand the feature, variables would be passed like this:
\set var1 'foo bar'
\set var2 'baz''qux'
select $1, $2 \gp :var1 :var2
?column? | ?column?
----------+----------
foo bar | baz'qux
It appears to work fine with the current patch.
This is consistent with the fact that PQexecParams passes $N
parameters ouf of the SQL query (versus injecting them in the text of
the query) which is also why no quoting is needed.
Best regards,
--
Daniel Vérité
https://postgresql.verite.pro/
Twitter: @DanielVerite
From | Date | Subject | |
---|---|---|---|
Next Message | Ankit Kumar Pandey | 2022-11-02 15:26:53 | Re: Check return value of pclose() correctly |
Previous Message | Zhihong Yu | 2022-11-02 15:00:58 | Re: restoring user id and SecContext before logging error in ri_PlanCheck |