vacuumdb: Schema-qualify operator in catalog query's WHERE clause.
authorNathan Bossart <[email protected]>
Mon, 7 Oct 2024 21:49:20 +0000 (16:49 -0500)
committerNathan Bossart <[email protected]>
Mon, 7 Oct 2024 21:49:20 +0000 (16:49 -0500)
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
Back-through: 12

src/bin/scripts/vacuumdb.c

index 3e726b45595e46a7441dc93073b5ac602045c024..57db0ecc5c02908d930c84a365817f19506917c2 100644 (file)
@@ -533,7 +533,8 @@ vacuum_one_database(const 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");
 
 
    /*