Fix psql's \sf and \ef for new-style SQL functions.
authorTom Lane <tgl@sss.pgh.pa.us>
Fri, 2 Dec 2022 19:24:44 +0000 (14:24 -0500)
committerTom Lane <tgl@sss.pgh.pa.us>
Fri, 2 Dec 2022 19:24:44 +0000 (14:24 -0500)
commitcabfb8241dea84206b90578a769e9cbd813ba477
treeadd43d5ea440445db86ee124b356e4308b43783a
parentb23cd185fd5410e5204683933f848d4583e34b35
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
src/backend/utils/adt/ruleutils.c
src/bin/psql/command.c
src/test/regress/expected/psql.out
src/test/regress/sql/psql.sql