postgres.git / summary / log / commit / refs
commit 5bd26e6527800749641dcb6a4409c0eb0ec1ba8d
Author: Nathan Bossart <nathan@postgresql.org>
Date: Mon Oct 07 21:49:20 2024 +0000
First released in: 18.0, 12.21, 13.17, 14.14, 15.9, 16.5, 17.1
vacuumdb: Schema-qualify operator in catalog query's WHERE clause.
Commit 1ab67c9dfa, which modified this catalog query so that it
doesn't return temporary relations, forgot to schema-qualify the
operator. A comment earlier in the function implores us to fully
qualify everything in the query:
* Since we execute the constructed query with the default search_path
* (which could be unsafe), everything in this query MUST be fully
* qualified.
This commit fixes that. While at it, add a newline for consistency
with surrounding code.
Reviewed-by: Noah Misch
Discussion: https://postgr.es/m/ZwQJYcuPPUsF0reU%40nathan
Backpatch-through: 12
src/bin/scripts/vacuumdb.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/bin/scripts/vacuumdb.c b/src/bin/scripts/vacuumdb.c
index 9623f928faa..260540f1894 100644
--- a/src/bin/scripts/vacuumdb.c
+++ b/src/bin/scripts/vacuumdb.c
@@ -684,7 +684,8 @@ vacuum_one_database(ConnParams *cparams,
* Exclude temporary tables, beginning the WHERE clause.
*/
appendPQExpBufferStr(&catalog_query,
- " WHERE c.relpersistence != " CppAsString2(RELPERSISTENCE_TEMP));
+ " WHERE c.relpersistence OPERATOR(pg_catalog.!=) "
+ CppAsString2(RELPERSISTENCE_TEMP) "\n");
/*
* Used to match the tables or schemas listed by the user, for the WHERE
[parent: a356d23fd3ad]