mirror of
https://github.com/getredash/redash.git
synced 2025-12-19 17:37:19 -05:00
pg: fix has_privileges function to quote schema and table names (#7574)
This commit is contained in:
@@ -223,7 +223,7 @@ class PostgreSQL(BaseSQLQueryRunner):
|
||||
AND a.attnum > 0
|
||||
AND NOT a.attisdropped
|
||||
WHERE c.relkind = 'm'
|
||||
AND has_table_privilege(s.nspname || '.' || c.relname, 'select')
|
||||
AND has_table_privilege(quote_ident(s.nspname) || '.' || quote_ident(c.relname), 'select')
|
||||
AND has_schema_privilege(s.nspname, 'usage')
|
||||
|
||||
UNION
|
||||
@@ -234,7 +234,7 @@ class PostgreSQL(BaseSQLQueryRunner):
|
||||
data_type
|
||||
FROM information_schema.columns
|
||||
WHERE table_schema NOT IN ('pg_catalog', 'information_schema')
|
||||
AND has_table_privilege(table_schema || '.' || table_name, 'select')
|
||||
AND has_table_privilege(quote_ident(table_schema) || '.' || quote_ident(table_name), 'select')
|
||||
AND has_schema_privilege(table_schema, 'usage')
|
||||
"""
|
||||
|
||||
|
||||
Reference in New Issue
Block a user