Improve error messages of input functions for pg_dependencies and pg_ndistinct
authorMichael Paquier <michael@paquier.xyz>
Mon, 8 Dec 2025 01:23:48 +0000 (10:23 +0900)
committerMichael Paquier <michael@paquier.xyz>
Mon, 8 Dec 2025 01:23:48 +0000 (10:23 +0900)
commitf68597ee777d0a177e84cf86b8386ea51c66b52e
treea52d1d250872272e6f99650d62312332ad6d4c45
parent4eda42e8bdf5bd3bf69576d54a45c10e7cbc3b35
Improve error messages of input functions for pg_dependencies and pg_ndistinct

The error details updated in this commit can be reached in the
regression tests.  They did not follow the project style, and they
should be written them as full sentences.

Some of the errors are switched to use an elog(), for cases that involve
paths that cannot be reached based on the previous state of the parser
processing the input data (array start, object end, etc.).  The error
messages for these cases use now a more consistent style across the
board, with the state of the parser reported for debugging.

Reported-by: Tom Lane <tgl@sss.pgh.pa.us>
Author: Michael Paquier <michael@paquier.xyz>
Co-authored-by: Corey Huinker <corey.huinker@gmail.com>
Discussion: https://postgr.es/m/1353179.1764901790@sss.pgh.pa.us
src/backend/utils/adt/pg_dependencies.c
src/backend/utils/adt/pg_ndistinct.c
src/test/regress/expected/pg_dependencies.out
src/test/regress/expected/pg_ndistinct.out