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
name, vartype, min_val, max_val, enumvals
FROM
pg_catalog.pg_settings
pg_catalog.pg_show_all_settings()
WHERE
context in ('user', 'superuser');

View File

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

View File

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

View File

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

View File

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

View File

@ -1,6 +1,6 @@
SELECT
name, vartype, min_val, max_val, enumvals
FROM
pg_catalog.pg_settings
pg_catalog.pg_show_all_settings()
WHERE
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,
rel.reloptions AS reloptions, tst.reloptions AS toast_reloptions, rel.reloftype, typ.typname,
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,
(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,

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,
rel.reloptions AS reloptions, tst.reloptions AS toast_reloptions, rel.reloftype, typ.typname,
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,
(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,

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
WHERE i.inhrelid = rel.oid) AS inherited_tables_cnt,
(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 '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,

View File

@ -1,2 +1,2 @@
{# ============= 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
WHERE dtb.oid = {{ did }}::oid)
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,
c.relacl,
nsp.nspname as schema,

View File

@ -11,7 +11,7 @@ SELECT
JOIN pg_catalog.pg_tablespace sp ON dtb.dattablespace=sp.oid
WHERE dtb.oid = {{ did }}::oid)
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,
c.relacl,
nsp.nspname as schema,

View File

@ -1,2 +1,2 @@
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,
enumvals
FROM
pg_settings
pg_show_all_settings()
WHERE
context in ('user', 'superuser')
) a""")

View File

@ -1,4 +1,4 @@
{### SQL to fetch tablespace object options ###}
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');

View File

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

View File

@ -515,7 +515,8 @@ class Connection(BaseConnection):
cur,
"SET DateStyle=ISO; "
"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'; "
"SET client_encoding='{0}';".format(postgres_encoding)
)