Convert tsqueryin and tsvectorin to report errors softly.
Tom Lane <tgl@sss.pgh.pa.us>
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
Files
| Path | Change | +/− |
|---|---|---|
| src/backend/tsearch/to_tsany.c | modified | +8 −4 |
| src/backend/utils/adt/tsquery.c | modified | +76 −24 |
| src/backend/utils/adt/tsquery_cleanup.c | modified | +4 −3 |
| src/backend/utils/adt/tsvector.c | modified | +11 −4 |
| src/backend/utils/adt/tsvector_parser.c | modified | +35 −14 |
| src/include/tsearch/ts_utils.h | modified | +7 −3 |
| src/test/regress/expected/tstypes.out | modified | +44 −0 |
| src/test/regress/sql/tstypes.sql | modified | +11 −0 |
Discussion
- Error-safe user functions 175 messages · 2022-10-03 → 2023-01-03