Improve SQLSTATE reporting for several error conditions

currtid2() could report internal_error for unsupported views, such as
those grouping by ctid. These are valid views that the function cannot
handle, so use the more appropriate feature_not_supported, matching
the other unsupported-view checks.

Assign appropriate SQLSTATEs to several other errors involving
non-UTF8 server encodings, control file CRC mismatches, invalid GiST
tuples, and attempts to refresh the default collation's version.
Also replace syntax_error with feature_not_supported for the encoding
checks in Unicode normalization and case folding, since these reject
an unsupported database encoding rather than invalid SQL syntax.

Do not backpatch, to avoid changing SQLSTATEs in released branches.

Bug: #19631
Reported-by: Zheng Wang <[email protected]>
Reported-by: Yanjie Zhao
Reported-by: Yiyang Liu
Author: Ayush Tiwari <[email protected]>
Reviewed-by: Pierre Forstmann <[email protected]>
Reviewed-by: Fujii Masao <[email protected]>
Discussion: https://postgr.es/m/[email protected]

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/9ebc9a458c38465cd9609814cfc9ca3a2f46fef5

Modified Files
--------------
src/backend/access/gist/gist.c          |  3 ++-
src/backend/backup/basebackup.c         |  3 ++-
src/backend/commands/collationcmds.c    |  3 ++-
src/backend/utils/adt/formatting.c      |  2 +-
src/backend/utils/adt/tid.c             |  4 +++-
src/backend/utils/adt/varlena.c         |  5 +++--
src/backend/utils/misc/pg_controldata.c | 12 ++++++++----
7 files changed, 21 insertions(+), 11 deletions(-)

Reply via email to