1
0
mirror of https://github.com/postgres/postgres.git synced 2025-08-11 04:22:52 +03:00

Schema-qualify unnest() in ALTER DATABASE ... RESET

Commit 9df8727c50 failed to schema-quality the unnest() call in the
query used to list the variables in ALTER DATABASE ... RESET. If there's
another unnest() function in the search_path, this could cause either
failures, or even security issues (when the tab-completion gets used by
privileged accounts).

Report and fix by Dagfinn Ilmari Mannsåker. Backpatch to 18, same as
9df8727c50.

Author: Dagfinn Ilmari Mannsåker <ilmari@ilmari.org>
Reviewed-by: jian he <jian.universality@gmail.com>
Discussion: https://postgr.es/m/87qzyghw2x.fsf%40wibble.ilmari.org
Discussion: https://postgr.es/m/87tt4lumqz.fsf%40wibble.ilmari.org
Backpatch-through: 18
This commit is contained in:
Tomas Vondra
2025-07-31 15:15:44 +02:00
parent c0ae03384f
commit 72c437f6e4

View File

@@ -1002,7 +1002,7 @@ static const SchemaQuery Query_for_trigger_of_table = {
#define Query_for_list_of_database_vars \ #define Query_for_list_of_database_vars \
"SELECT conf FROM ("\ "SELECT conf FROM ("\
" SELECT setdatabase, pg_catalog.split_part(unnest(setconfig),'=',1) conf"\ " SELECT setdatabase, pg_catalog.split_part(pg_catalog.unnest(setconfig),'=',1) conf"\
" FROM pg_db_role_setting "\ " FROM pg_db_role_setting "\
" ) s, pg_database d "\ " ) s, pg_database d "\
" WHERE s.setdatabase = d.oid "\ " WHERE s.setdatabase = d.oid "\