diff options
author | Michael Paquier <michael@paquier.xyz> | 2024-08-22 16:25:57 +0900 |
---|---|---|
committer | Michael Paquier <michael@paquier.xyz> | 2024-08-22 16:25:57 +0900 |
commit | d55322b0da60a8798ffdb8b78ef90db0fb5be18e (patch) | |
tree | d6d5ff5ec0fe3f7d8c49d38357529f113ef617d3 /src/bin/psql/help.c | |
parent | a36aa223ec447276bf7050ab9ec6d974cafdf6c4 (diff) | |
download | postgresql-d55322b0da60a8798ffdb8b78ef90db0fb5be18e.tar.gz postgresql-d55322b0da60a8798ffdb8b78ef90db0fb5be18e.zip |
psql: Add more meta-commands able to use the extended protocol
Currently, only unnamed prepared statement are supported by psql with
the meta-command \bind. With only this command, it is not possible to
test named statement creation, execution or close through the extended
protocol.
This commit introduces three additional commands:
* \parse creates a prepared statement using the extended protocol,
acting as a wrapper of libpq's PQsendPrepare().
* \bind_named binds and executes an existing prepared statement using
the extended protocol, for PQsendQueryPrepared().
* \close closes an existing prepared statement using the extended
protocol, for PQsendClosePrepared().
This is going to be useful to add regression tests for the extended
query protocol, and I have some plans for that on separate threads.
Note that \bind relies on PQsendQueryParams().
The code of psql is refactored so as bind_flag is replaced by an enum in
_psqlSettings that tracks the type of libpq routine to execute, based on
the meta-command involved, with the default being PQsendQuery(). This
refactoring piece has been written by me, while Anthonin has implemented
the rest.
Author: Anthonin Bonnefoy, Michael Paquier
Reviewed-by: Aleksander Alekseev, Jelte Fennema-Nio
Discussion: https://postgr.es/m/CAO6_XqpSq0Q0kQcVLCbtagY94V2GxNP3zCnR6WnOM8WqXPK4nw@mail.gmail.com
Diffstat (limited to 'src/bin/psql/help.c')
-rw-r--r-- | src/bin/psql/help.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/bin/psql/help.c b/src/bin/psql/help.c index 6f58a110748..19d20c58781 100644 --- a/src/bin/psql/help.c +++ b/src/bin/psql/help.c @@ -165,6 +165,9 @@ slashUsage(unsigned short int pager) HELP0("General\n"); HELP0(" \\bind [PARAM]... set query parameters\n"); + HELP0(" \\bind_named STMT_NAME [PARAM]...\n" + " set query parameters for an existing prepared statement\n"); + HELP0(" \\close STMT_NAME close an existing prepared statement\n"); HELP0(" \\copyright show PostgreSQL usage and distribution terms\n"); HELP0(" \\crosstabview [COLUMNS] execute query and display result in crosstab\n"); HELP0(" \\errverbose show most recent error message at maximum verbosity\n"); @@ -312,6 +315,7 @@ slashUsage(unsigned short int pager) " connect to new database (currently no connection)\n"); HELP0(" \\conninfo display information about current connection\n"); HELP0(" \\encoding [ENCODING] show or set client encoding\n"); + HELP0(" \\parse STMT_NAME create a prepared statement\n"); HELP0(" \\password [USERNAME] securely change the password for a user\n"); HELP0("\n"); |