Fixed an issue where users could not use pgAdmin if they did not have access to the management database. #7571

This commit is contained in:
Pravesh Sharma 2024-08-30 12:13:47 +05:30 committed by GitHub
parent 1a1734cf5c
commit 445e89576b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
17 changed files with 18 additions and 17 deletions

View File

@ -1,6 +1,6 @@
SELECT SELECT
name, vartype, min_val, max_val, enumvals name, vartype, min_val, max_val, enumvals
FROM FROM
pg_catalog.pg_settings pg_catalog.pg_show_all_settings()
WHERE WHERE
context in ('user', 'superuser'); context in ('user', 'superuser');

View File

@ -1,6 +1,6 @@
SELECT SELECT
name, vartype, min_val, max_val, enumvals name, vartype, min_val, max_val, enumvals
FROM FROM
pg_catalog.pg_settings pg_catalog.pg_show_all_settings()
WHERE WHERE
context in ('user', 'superuser'); context in ('user', 'superuser');

View File

@ -1,6 +1,6 @@
SELECT SELECT
name, vartype, min_val, max_val, enumvals name, vartype, min_val, max_val, enumvals
FROM FROM
pg_catalog.pg_settings pg_catalog.pg_show_all_settings()
WHERE WHERE
context in ('user', 'superuser'); context in ('user', 'superuser');

View File

@ -1,6 +1,6 @@
SELECT SELECT
name, vartype, min_val, max_val, enumvals name, vartype, min_val, max_val, enumvals
FROM FROM
pg_catalog.pg_settings pg_catalog.pg_show_all_settings()
WHERE WHERE
context in ('user', 'superuser'); context in ('user', 'superuser');

View File

@ -1,6 +1,6 @@
SELECT SELECT
name, vartype, min_val, max_val, enumvals name, vartype, min_val, max_val, enumvals
FROM FROM
pg_catalog.pg_settings pg_catalog.pg_show_all_settings()
WHERE WHERE
context in ('user', 'superuser'); context in ('user', 'superuser');

View File

@ -1,6 +1,6 @@
SELECT SELECT
name, vartype, min_val, max_val, enumvals name, vartype, min_val, max_val, enumvals
FROM FROM
pg_catalog.pg_settings pg_catalog.pg_show_all_settings()
WHERE WHERE
context in ('user', 'superuser'); context in ('user', 'superuser');

View File

@ -49,7 +49,7 @@ SELECT rel.oid, rel.relname AS name, rel.reltablespace AS spcoid,rel.relacl AS r
substring(pg_catalog.array_to_string(tst.reloptions, ',') FROM 'autovacuum_freeze_table_age=([0-9]*)') AS toast_autovacuum_freeze_table_age, substring(pg_catalog.array_to_string(tst.reloptions, ',') FROM 'autovacuum_freeze_table_age=([0-9]*)') AS toast_autovacuum_freeze_table_age,
rel.reloptions AS reloptions, tst.reloptions AS toast_reloptions, rel.reloftype, typ.typname, rel.reloptions AS reloptions, tst.reloptions AS toast_reloptions, rel.reloftype, typ.typname,
typ.typrelid AS typoid, am.amname, typ.typrelid AS typoid, am.amname,
(SELECT st.setting from pg_catalog.pg_settings st WHERE st.name = 'default_table_access_method') as default_amname, (SELECT st.setting from pg_catalog.pg_show_all_settings() st WHERE st.name = 'default_table_access_method') as default_amname,
(CASE WHEN rel.reltoastrelid = 0 THEN false ELSE true END) AS hastoasttable, (CASE WHEN rel.reltoastrelid = 0 THEN false ELSE true END) AS hastoasttable,
(SELECT pg_catalog.array_agg(provider || '=' || label) FROM pg_catalog.pg_seclabels sl1 WHERE sl1.objoid=rel.oid AND sl1.objsubid=0) AS seclabels, (SELECT pg_catalog.array_agg(provider || '=' || label) FROM pg_catalog.pg_seclabels sl1 WHERE sl1.objoid=rel.oid AND sl1.objsubid=0) AS seclabels,
(CASE WHEN rel.oid <= {{ datlastsysoid}}::oid THEN true ElSE false END) AS is_sys_table, (CASE WHEN rel.oid <= {{ datlastsysoid}}::oid THEN true ElSE false END) AS is_sys_table,

View File

@ -49,7 +49,7 @@ SELECT rel.oid, rel.relname AS name, rel.reltablespace AS spcoid,rel.relacl AS r
substring(pg_catalog.array_to_string(tst.reloptions, ',') FROM 'autovacuum_freeze_table_age=([0-9]*)') AS toast_autovacuum_freeze_table_age, substring(pg_catalog.array_to_string(tst.reloptions, ',') FROM 'autovacuum_freeze_table_age=([0-9]*)') AS toast_autovacuum_freeze_table_age,
rel.reloptions AS reloptions, tst.reloptions AS toast_reloptions, rel.reloftype, typ.typname, rel.reloptions AS reloptions, tst.reloptions AS toast_reloptions, rel.reloftype, typ.typname,
typ.typrelid AS typoid, am.amname, typ.typrelid AS typoid, am.amname,
(SELECT st.setting from pg_catalog.pg_settings st WHERE st.name = 'default_table_access_method') as default_amname, (SELECT st.setting from pg_catalog.pg_show_all_settings() st WHERE st.name = 'default_table_access_method') as default_amname,
(CASE WHEN rel.reltoastrelid = 0 THEN false ELSE true END) AS hastoasttable, (CASE WHEN rel.reltoastrelid = 0 THEN false ELSE true END) AS hastoasttable,
(SELECT pg_catalog.array_agg(provider || '=' || label) FROM pg_catalog.pg_seclabels sl1 WHERE sl1.objoid=rel.oid AND sl1.objsubid=0) AS seclabels, (SELECT pg_catalog.array_agg(provider || '=' || label) FROM pg_catalog.pg_seclabels sl1 WHERE sl1.objoid=rel.oid AND sl1.objsubid=0) AS seclabels,
(CASE WHEN rel.oid <= {{ datlastsysoid}}::oid THEN true ElSE false END) AS is_sys_table, (CASE WHEN rel.oid <= {{ datlastsysoid}}::oid THEN true ElSE false END) AS is_sys_table,

View File

@ -32,7 +32,7 @@ SELECT rel.oid, rel.relname AS name, rel.reltablespace AS spcoid,rel.relacl AS r
JOIN pg_catalog.pg_namespace n ON n.oid=c.relnamespace JOIN pg_catalog.pg_namespace n ON n.oid=c.relnamespace
WHERE i.inhrelid = rel.oid) AS inherited_tables_cnt, WHERE i.inhrelid = rel.oid) AS inherited_tables_cnt,
(CASE WHEN rel.relpersistence = 'u' THEN true ELSE false END) AS relpersistence, (CASE WHEN rel.relpersistence = 'u' THEN true ELSE false END) AS relpersistence,
(SELECT st.setting from pg_catalog.pg_settings st WHERE st.name = 'default_table_access_method') as default_amname, (SELECT st.setting from pg_catalog.pg_show_all_settings() st WHERE st.name = 'default_table_access_method') as default_amname,
substring(pg_catalog.array_to_string(rel.reloptions, ',') FROM 'fillfactor=([0-9]*)') AS fillfactor, substring(pg_catalog.array_to_string(rel.reloptions, ',') FROM 'fillfactor=([0-9]*)') AS fillfactor,
substring(pg_catalog.array_to_string(rel.reloptions, ',') FROM 'parallel_workers=([0-9]*)') AS parallel_workers, substring(pg_catalog.array_to_string(rel.reloptions, ',') FROM 'parallel_workers=([0-9]*)') AS parallel_workers,
substring(pg_catalog.array_to_string(rel.reloptions, ',') FROM 'toast_tuple_target=([0-9]*)') AS toast_tuple_target, substring(pg_catalog.array_to_string(rel.reloptions, ',') FROM 'toast_tuple_target=([0-9]*)') AS toast_tuple_target,

View File

@ -1,2 +1,2 @@
{# ============= Fetch list of default values for autovacuum parameters =============== #} {# ============= Fetch list of default values for autovacuum parameters =============== #}
SELECT name, setting::numeric AS setting FROM pg_catalog.pg_settings WHERE name IN({{ columns }}) ORDER BY name SELECT name, setting::numeric AS setting FROM pg_catalog.pg_show_all_settings() WHERE name IN({{ columns }}) ORDER BY name

View File

@ -11,7 +11,7 @@ SELECT
JOIN pg_catalog.pg_tablespace sp ON dtb.dattablespace=sp.oid JOIN pg_catalog.pg_tablespace sp ON dtb.dattablespace=sp.oid
WHERE dtb.oid = {{ did }}::oid) WHERE dtb.oid = {{ did }}::oid)
END as spcname, END as spcname,
(SELECT st.setting from pg_catalog.pg_settings st (SELECT st.setting from pg_catalog.pg_show_all_settings() st
WHERE st.name = 'default_table_access_method') as default_amname, WHERE st.name = 'default_table_access_method') as default_amname,
c.relacl, c.relacl,
nsp.nspname as schema, nsp.nspname as schema,

View File

@ -11,7 +11,7 @@ SELECT
JOIN pg_catalog.pg_tablespace sp ON dtb.dattablespace=sp.oid JOIN pg_catalog.pg_tablespace sp ON dtb.dattablespace=sp.oid
WHERE dtb.oid = {{ did }}::oid) WHERE dtb.oid = {{ did }}::oid)
END as spcname, END as spcname,
(SELECT st.setting from pg_catalog.pg_settings st (SELECT st.setting from pg_catalog.pg_show_all_settings() st
WHERE st.name = 'default_table_access_method') as default_amname, WHERE st.name = 'default_table_access_method') as default_amname,
c.relacl, c.relacl,
nsp.nspname as schema, nsp.nspname as schema,

View File

@ -1,2 +1,2 @@
SELECT name, vartype, min_val, max_val, enumvals SELECT name, vartype, min_val, max_val, enumvals
FROM pg_catalog.pg_settings WHERE context in ('user', 'superuser') FROM pg_catalog.pg_show_all_settings() WHERE context in ('user', 'superuser')

View File

@ -1261,7 +1261,7 @@ SELECT
name, vartype, min_val::numeric AS min_val, max_val::numeric AS max_val, name, vartype, min_val::numeric AS min_val, max_val::numeric AS max_val,
enumvals enumvals
FROM FROM
pg_settings pg_show_all_settings()
WHERE WHERE
context in ('user', 'superuser') context in ('user', 'superuser')
) a""") ) a""")

View File

@ -1,4 +1,4 @@
{### SQL to fetch tablespace object options ###} {### SQL to fetch tablespace object options ###}
SELECT name, vartype, min_val, max_val, enumvals SELECT name, vartype, min_val, max_val, enumvals
FROM pg_catalog.pg_settings FROM pg_catalog.pg_show_all_settings()
WHERE name IN ('seq_page_cost', 'random_page_cost', 'effective_io_concurrency'); WHERE name IN ('seq_page_cost', 'random_page_cost', 'effective_io_concurrency');

View File

@ -6,6 +6,6 @@ SELECT
unit, unit,
short_desc short_desc
FROM FROM
pg_catalog.pg_settings pg_catalog.pg_show_all_settings()
ORDER BY ORDER BY
category category

View File

@ -515,7 +515,8 @@ class Connection(BaseConnection):
cur, cur,
"SET DateStyle=ISO; " "SET DateStyle=ISO; "
"SET client_min_messages=notice; " "SET client_min_messages=notice; "
"SELECT set_config('bytea_output','hex',false) FROM pg_settings" "SELECT set_config('bytea_output','hex',false)"
" FROM pg_show_all_settings()"
" WHERE name = 'bytea_output'; " " WHERE name = 'bytea_output'; "
"SET client_encoding='{0}';".format(postgres_encoding) "SET client_encoding='{0}';".format(postgres_encoding)
) )