pgsql: Improve error messages in parse_jsonb_index_flags().

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Improve error messages in parse_jsonb_index_flags().
Date: 2026-11-18 03:12:21
Message-ID: E1xTW5s-00000000Azh-1y8s@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Improve error messages in parse_jsonb_index_flags().

Some of the error messages in this function weren't very well
thought out. They mistook reachable cases for unreachable ones,
and complained in words that were actually exactly backward from
the condition they'd detected, and weren't helpful anyway.

Since this is just substituting better error text and a better
SQLSTATE for what was there before, I don't feel a strong need
to back-patch.

Bug: #19910
Reported-by: Zheng Hacker <hackerzheng666(at)gmail(dot)com>
Author: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Discussion: https://postgr.es/m/19910-24199f8af1474753@postgresql.org

Branch
------
master

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

Modified Files
--------------
src/backend/utils/adt/jsonfuncs.c | 13 +++++++++----
src/test/regress/expected/json.out | 3 ++-
src/test/regress/expected/jsonb.out | 3 ++-
3 files changed, 13 insertions(+), 6 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Previous Message Tom Lane 2026-11-18 02:55:50 pgsql: Don't crash on null pstate in coerce_record_to_complex().