pgsql: Fix psql's \sf and \ef for new-style SQL functions.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Fix psql's \sf and \ef for new-style SQL functions.
Date: 2022-12-02 19:24:55
Message-ID: E1p1BeZ-001jhq-2G@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Fix psql's \sf and \ef for new-style SQL functions.

Some options of these commands need to be able to identify the start
of the function body within the output of pg_get_functiondef().
It used to be that that always began with "AS", but since the
introduction of new-style SQL functions, it might also start with
"BEGIN" or "RETURN". Fix that on the psql side, and add some
regression tests.

Noted by me awhile ago, but I didn't do anything about it.
Thanks to David Johnston for a nag.

Discussion: https://postgr.es/m/AM9PR01MB8268D5CDABDF044EE9F42173FE8C9@AM9PR01MB8268.eurprd01.prod.exchangelabs.com

Branch
------
REL_15_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/97299cf99df086af847a641161e8b925fdf840b9

Modified Files
--------------
src/backend/utils/adt/ruleutils.c | 4 +--
src/bin/psql/command.c | 46 ++++++++++++++--------------
src/test/regress/expected/psql.out | 62 ++++++++++++++++++++++++++++++++++++++
src/test/regress/sql/psql.sql | 8 +++++
4 files changed, 94 insertions(+), 26 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2022-12-02 19:24:56 pgsql: Fix psql's \sf and \ef for new-style SQL functions.
Previous Message Tom Lane 2022-12-02 17:14:38 pgsql: Remove logic for converting a table to a view.