public inbox for [email protected]  
help / color / mirror / Atom feed
pgsql: Improve reporting of invalid weight symbols in setweight() et al
6+ messages / 1 participants
[nested] [flat]

* pgsql: Improve reporting of invalid weight symbols in setweight() et al
@ 2026-06-04 16:25 Tom Lane <[email protected]>
  0 siblings, 0 replies; 6+ messages in thread

From: Tom Lane @ 2026-06-04 16:25 UTC (permalink / raw)
  To: [email protected]

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 <[email protected]>
Reviewed-by: Tom Lane <[email protected]>
Discussion: https://postgr.es/m/CAON2xHNaeLAUzRCXL5AmXLcXaSE_gWAVjWQRmLzc_oZ=1_Vf4Q@mail.gmail.com
Backpatch-through: 14

Branch
------
REL_15_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/b3a86eb6d42753cbf65e690050bdc442ae136729

Modified Files
--------------
src/backend/utils/adt/tsvector_op.c | 87 +++++++++++++------------------------
1 file changed, 30 insertions(+), 57 deletions(-)



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* pgsql: Improve reporting of invalid weight symbols in setweight() et al
@ 2026-06-04 16:25 Tom Lane <[email protected]>
  0 siblings, 0 replies; 6+ messages in thread

From: Tom Lane @ 2026-06-04 16:25 UTC (permalink / raw)
  To: [email protected]

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 <[email protected]>
Reviewed-by: Tom Lane <[email protected]>
Discussion: https://postgr.es/m/CAON2xHNaeLAUzRCXL5AmXLcXaSE_gWAVjWQRmLzc_oZ=1_Vf4Q@mail.gmail.com
Backpatch-through: 14

Branch
------
REL_14_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/262cc4df28976622aed47239c66f0bf56b1ce7bf

Modified Files
--------------
src/backend/utils/adt/tsvector_op.c | 87 +++++++++++++------------------------
1 file changed, 30 insertions(+), 57 deletions(-)



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* pgsql: Improve reporting of invalid weight symbols in setweight() et al
@ 2026-06-04 16:25 Tom Lane <[email protected]>
  0 siblings, 0 replies; 6+ messages in thread

From: Tom Lane @ 2026-06-04 16:25 UTC (permalink / raw)
  To: [email protected]

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 <[email protected]>
Reviewed-by: Tom Lane <[email protected]>
Discussion: https://postgr.es/m/CAON2xHNaeLAUzRCXL5AmXLcXaSE_gWAVjWQRmLzc_oZ=1_Vf4Q@mail.gmail.com
Backpatch-through: 14

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/ce6bf3cd17d1f96c9c40d2915ef25580fbbc8be7

Modified Files
--------------
src/backend/utils/adt/tsvector_op.c | 87 +++++++++++++------------------------
1 file changed, 30 insertions(+), 57 deletions(-)



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* pgsql: Improve reporting of invalid weight symbols in setweight() et al
@ 2026-06-04 16:25 Tom Lane <[email protected]>
  0 siblings, 0 replies; 6+ messages in thread

From: Tom Lane @ 2026-06-04 16:25 UTC (permalink / raw)
  To: [email protected]

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 <[email protected]>
Reviewed-by: Tom Lane <[email protected]>
Discussion: https://postgr.es/m/CAON2xHNaeLAUzRCXL5AmXLcXaSE_gWAVjWQRmLzc_oZ=1_Vf4Q@mail.gmail.com
Backpatch-through: 14

Branch
------
REL_18_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/c5194139cb4c9cf8284a6e433418c0323a7e7650

Modified Files
--------------
src/backend/utils/adt/tsvector_op.c | 87 +++++++++++++------------------------
1 file changed, 30 insertions(+), 57 deletions(-)



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* pgsql: Improve reporting of invalid weight symbols in setweight() et al
@ 2026-06-04 16:25 Tom Lane <[email protected]>
  0 siblings, 0 replies; 6+ messages in thread

From: Tom Lane @ 2026-06-04 16:25 UTC (permalink / raw)
  To: [email protected]

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 <[email protected]>
Reviewed-by: Tom Lane <[email protected]>
Discussion: https://postgr.es/m/CAON2xHNaeLAUzRCXL5AmXLcXaSE_gWAVjWQRmLzc_oZ=1_Vf4Q@mail.gmail.com
Backpatch-through: 14

Branch
------
REL_17_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/0626fbfebae51a048b5415710200554eac65ff5e

Modified Files
--------------
src/backend/utils/adt/tsvector_op.c | 87 +++++++++++++------------------------
1 file changed, 30 insertions(+), 57 deletions(-)



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* pgsql: Improve reporting of invalid weight symbols in setweight() et al
@ 2026-06-04 16:25 Tom Lane <[email protected]>
  0 siblings, 0 replies; 6+ messages in thread

From: Tom Lane @ 2026-06-04 16:25 UTC (permalink / raw)
  To: [email protected]

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 <[email protected]>
Reviewed-by: Tom Lane <[email protected]>
Discussion: https://postgr.es/m/CAON2xHNaeLAUzRCXL5AmXLcXaSE_gWAVjWQRmLzc_oZ=1_Vf4Q@mail.gmail.com
Backpatch-through: 14

Branch
------
REL_16_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/ed5ca5828de1020bbcac392d36e5510842b12480

Modified Files
--------------
src/backend/utils/adt/tsvector_op.c | 87 +++++++++++++------------------------
1 file changed, 30 insertions(+), 57 deletions(-)



^ permalink  raw  reply  [nested|flat] 6+ messages in thread


end of thread, other threads:[~2026-06-04 16:25 UTC | newest]

Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2026-06-04 16:25 pgsql: Improve reporting of invalid weight symbols in setweight() et al Tom Lane <[email protected]>
2026-06-04 16:25 pgsql: Improve reporting of invalid weight symbols in setweight() et al Tom Lane <[email protected]>
2026-06-04 16:25 pgsql: Improve reporting of invalid weight symbols in setweight() et al Tom Lane <[email protected]>
2026-06-04 16:25 pgsql: Improve reporting of invalid weight symbols in setweight() et al Tom Lane <[email protected]>
2026-06-04 16:25 pgsql: Improve reporting of invalid weight symbols in setweight() et al Tom Lane <[email protected]>
2026-06-04 16:25 pgsql: Improve reporting of invalid weight symbols in setweight() et al Tom Lane <[email protected]>

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox