Re: [PATCH] Add additional extended protocol commands to psql: \parse and \bind
Anthonin Bonnefoy <anthonin.bonnefoy@datadoghq.com>
From: Anthonin Bonnefoy <anthonin.bonnefoy@datadoghq.com>
To: Michael Paquier <michael@paquier.xyz>
Cc: Peter Eisentraut <peter@eisentraut.org>,
Tomas Vondra <tomas.vondra@enterprisedb.com>, vignesh C <vignesh21@gmail.com>, Jelte Fennema-Nio <postgres@jeltef.nl>, PostgreSQL Hackers <pgsql-hackers@postgresql.org>
Date: 2024-07-25T06:45:28Z
Lists: pgsql-hackers
On Wed, Jul 24, 2024 at 05:33:07PM +0200, Peter Eisentraut wrote: > This commit message confused me, because I don't think this is what the > \bindx command actually does. AFAICT, it only binds, it does not execute. > At least that is what the documentation in the content of the patch appears > to indicate. Unless I misunderstand the remark, \bindx will call PQsendQueryPrepared which will bind then execute the query, similar to what \bind is doing (except \bind also parses the query). > I'm not sure \bindx is such a great name. The "x" stands for "I ran out of > ideas". ;-) That's definitely what happened :). \bind would have been a better fit but it was already used. On Thu, Jul 25, 2024 at 4:19 AM Michael Paquier <michael@paquier.xyz> wrote: > Not sure that I like much the additional option embedded in the > existing command; I'd rather keep a separate command for each libpq > call, that seems cleaner. So I would be OK with your suggested > \bind_named. Fine by me to be outvoted, of course. +1 keeping this as a separate command and using \bind_named. \bind has a different behaviour as it also parses the query so keeping them as separate commands would probably avoid some confusion.
Commits
-
psql: Rename meta-command \close to \close_prepared
- fc39b286ad72 18.0 landed
-
psql: Add tests for repeated calls of \bind[_named]
- 91287b5f5da3 18.0 landed
-
psql: Fix memory leak with repeated calls of \bind
- c2fb2f9e200f 16.5 landed
- b0ae6db2088b 17.0 landed
-
psql: Clean up more aggressively state of \bind[_named], \parse and \close
- 87eeadaea143 18.0 landed
-
psql: Add more meta-commands able to use the extended protocol
- d55322b0da60 18.0 landed
-
psql: Add ignore_slash_options in bind's inactive branch
- 04c0897d3bca 17.0 landed