postgresql/src/backend
Tom Lane 262cc4df28 Improve reporting of invalid weight symbols in setweight() et al.
This commit addresses two related issues:

tsvector_filter() assumed it could print an incorrect weight value
with %c.  This could result in an invalidly-encoded error message
if the database encoding is multibyte and the char value has its
high bit set.  Weight values that are ASCII control characters
could render illegibly too.  Fix by printing such values in octal
(\ooo), similarly to how charout() would render them.

tsvector_setweight() and tsvector_setweight_by_filter() reported
the same unrecognized-weight error condition with elog(), as though
it were an internal error.  That'd not translate, would produce an
unwanted XX000 SQLSTATE code, and also reported the bad value as a
decimal integer which seems unhelpful.  Fix by refactoring so that
all three functions share one copy of the code that interprets a
weight argument.

The invalid-encoding aspect seems to me (tgl) to justify
back-patching.

Author: Ewan Young <kdbase.hack@gmail.com>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/CAON2xHNaeLAUzRCXL5AmXLcXaSE_gWAVjWQRmLzc_oZ=1_Vf4Q@mail.gmail.com
Backpatch-through: 14
2026-06-04 12:24:51 -04:00
..
access Fix self-deadlock when replaying WAL generated by older minor version 2026-05-27 11:50:56 +03:00
bootstrap Rethink definition of pg_attribute.attcompression. 2021-05-27 13:24:27 -04:00
catalog Use term "referenced" rather than "dependent" in dependency locking 2026-05-28 21:29:28 +03:00
commands Check CREATE privilege on multirange type schema in CREATE TYPE. 2026-05-11 05:13:51 -07:00
executor Fix incorrect logic for hashed IN / NOT IN with non-strict operators 2026-04-24 14:05:23 +12:00
foreign Restrict accesses to non-system views and foreign tables during pg_dump. 2024-08-05 06:05:23 -07:00
jit Fix another case of indirectly casting away const. 2026-06-04 11:37:43 -04:00
lib Accommodate very large dshash tables. 2024-12-17 15:24:45 -06:00
libpq Apply timingsafe_bcmp() in authentication paths 2026-05-11 05:13:51 -07:00
main Fix elog(FATAL) before PostmasterMain() or just after fork(). 2024-12-10 13:52:02 -08:00
nodes Build whole-row Vars the same way during parsing and planning. 2025-03-12 11:47:19 -04:00
optimizer Consider collation when proving subquery uniqueness 2026-05-05 10:34:07 +09:00
parser Fix attnum remapping in generateClonedExtStatsStmt() 2026-04-30 11:13:50 -04:00
partitioning Fix creation of partition descriptor during concurrent detach+drop 2024-08-12 18:17:56 -04:00
po Translation updates 2026-05-11 13:23:46 +02:00
port Don't treat EINVAL from semget() as a hard failure. 2025-08-13 11:59:47 -04:00
postmaster Fix unbounded recursive handling of SSL/GSS in ProcessStartupPacket() 2026-05-11 05:13:51 -07:00
regex Harden our regex engine against integer overflow in size calculations. 2026-05-11 05:13:51 -07:00
replication Fix race in ReplicationSlotRelease() for ephemeral slots 2026-06-03 18:47:52 +09:00
rewrite Fix incorrect NEW references to generated columns in rule rewriting 2026-04-21 14:35:43 +09:00
snowball Avoid null pointer dereference crash after OOM in Snowball stemmers. 2025-02-18 21:24:12 -05:00
statistics Fix size check in statext_dependencies_deserialize() 2026-05-25 14:39:07 +09:00
storage Fix procLatch ownership race in ProcKill() 2026-05-27 17:20:00 +09:00
tcop Make stack depth check work with asan's use-after-return 2026-05-28 11:34:14 -04:00
tsearch Fix overflows with ts_headline() 2026-05-11 05:13:51 -07:00
utils Improve reporting of invalid weight symbols in setweight() et al. 2026-06-04 12:24:51 -04:00
.gitignore Add .gitignore entries for AIX-specific intermediate build artifacts. 2015-07-08 20:44:22 -04:00
common.mk Remove PARTIAL_LINKING build mode. 2018-03-30 17:33:04 -07:00
Makefile Use sort_template.h for qsort_tuple() and qsort_ssup(). 2021-03-03 17:02:32 +13:00
nls.mk Translation updates 2021-09-20 16:23:13 +02:00