pgsql: Convert tsqueryin and tsvectorin to report errors softly.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Convert tsqueryin and tsvectorin to report errors softly.
Date: 2022-12-27 17:00:49
Message-ID: E1pADJo-000gnc-Oy@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Convert tsqueryin and tsvectorin to report errors softly.

This is slightly tedious because the adjustments cascade through
a couple of levels of subroutines, but it's not very hard.
I chose to avoid changing function signatures more than absolutely
necessary, by passing the escontext pointer in existing structs
where possible.

tsquery's nuisance NOTICEs about empty queries are suppressed in
soft-error mode, since they're not errors and we surely don't want
them to be shown to the user anyway. Maybe that whole behavior
should be reconsidered.

Discussion: https://postgr.es/m/3824377.1672076822@sss.pgh.pa.us

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/78212f21011449f0374831323655baa7c00f3680

Modified Files
--------------
src/backend/tsearch/to_tsany.c | 12 ++--
src/backend/utils/adt/tsquery.c | 100 ++++++++++++++++++++++++--------
src/backend/utils/adt/tsquery_cleanup.c | 7 ++-
src/backend/utils/adt/tsvector.c | 15 +++--
src/backend/utils/adt/tsvector_parser.c | 49 +++++++++++-----
src/include/tsearch/ts_utils.h | 10 +++-
src/test/regress/expected/tstypes.out | 44 ++++++++++++++
src/test/regress/sql/tstypes.sql | 11 ++++
8 files changed, 196 insertions(+), 52 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2022-12-27 17:33:10 pgsql: Simplify the implementations of the to_reg* functions.
Previous Message Tom Lane 2022-12-27 16:40:18 pgsql: Detect bad input for types xid, xid8, and cid.