psql: Add command to use extended query protocol

Enterprise / PostgreSQL - Peter Eisentraut [eisentraut.org] - 15 November 2022 13:27 UTC

This adds a new psql command \bind that sets query parameters and causes the next query to be sent using the extended query protocol. Example:

SELECT $1, $2 \bind 'foo' 'bar' \g

This may be useful for psql scripting, but one of the main purposes is also to be able to test various aspects of the extended query protocol from psql and to write tests more easily.

5b66de3433 psql: Add command to use extended query protocol
doc/src/sgml/ref/psql-ref.sgml | 36 ++++++++++++++++++++++++++++++++++++
src/bin/psql/command.c | 37 +++++++++++++++++++++++++++++++++++++
src/bin/psql/common.c | 15 ++++++++++++++-
src/bin/psql/help.c | 1 +
src/bin/psql/settings.h | 3 +++
src/bin/psql/tab-complete.c | 1 +
src/test/regress/expected/psql.out | 31 +++++++++++++++++++++++++++++++
src/test/regress/sql/psql.sql | 14 ++++++++++++++
8 files changed, 137 insertions(+), 1 deletion(-)

Upstream: git.postgresql.org


  • Share