Add test scaffolding for soft error reporting from input functions.
authorTom Lane <tgl@sss.pgh.pa.us>
Fri, 9 Dec 2022 15:08:44 +0000 (10:08 -0500)
committerTom Lane <tgl@sss.pgh.pa.us>
Fri, 9 Dec 2022 15:08:44 +0000 (10:08 -0500)
commit1939d26282b27b4b264c6930830a7991ed83917a
tree9e2ff9c38937b85ed5307e8d4cf9b7dd86f97591
parentd9f7f5d32f201bec61fef8104aafcb77cecb4dcb
Add test scaffolding for soft error reporting from input functions.

pg_input_is_valid() returns boolean, while pg_input_error_message()
returns the primary error message if the input is bad, or NULL
if the input is OK.  The main reason for having two functions is
so that we can test both the details-wanted and the no-details-wanted
code paths.

Although these are primarily designed with testing in mind,
it could well be that they'll be useful to end users as well.

This patch is mostly by me, but it owes very substantial debt to
earlier work by Nikita Glukhov, Andrew Dunstan, and Amul Sul.
Thanks to Andres Freund for review.

Discussion: https://postgr.es/m/3bbbb0df-7382-bf87-9737-340ba096e034@postgrespro.ru
doc/src/sgml/func.sgml
src/backend/utils/adt/misc.c
src/include/catalog/catversion.h
src/include/catalog/pg_proc.dat
src/test/regress/expected/create_type.out
src/test/regress/regress.c
src/test/regress/sql/create_type.sql