vacuumdb: Fully qualify the catalog query's operators.

vacuumdb runs its catalog query with the session's default
search_path so that --table arguments resolve as they would in
psql, but commit edba754f05 added two constructs whose = is not
schema-qualified: the relkind IN list in the LATERAL and the IS
DISTINCT FROM tests on attstattarget and stxstattarget.  This
allows a database owner to shadow the operator with their own and
execute arbitrary code as the user running vacuumdb.  To fix,
rewrite the former as OPERATOR(pg_catalog.=) ANY (array[...]) like
the relkind filter in the WHERE clause, and the latter as an IS
NULL test with OPERATOR(pg_catalog.<>).

Reported-by: Noah Misch <[email protected]>
Reported-by: Anthropic OSS program
Author: Nathan Bossart <[email protected]>
Co-authored-by: Anthropic OSS program
Reviewed-by: Bertrand Drouvot <[email protected]>
Security: CVE-2026-116313
Backpatch-through: 18

Branch
------
REL_19_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/623cda5ef837c8fd3b6da14bd7c8e20fdd15d4f0
Author: Nathan Bossart <[email protected]>

Modified Files
--------------
src/bin/scripts/vacuuming.c | 20 +++++++++++++-------
1 file changed, 13 insertions(+), 7 deletions(-)

Reply via email to