fix(datatables): hide schemas the connection's role cannot reach

This commit is contained in:
Diego Imbert
2026-08-31 04:33:22 +02:00
parent 163ff3aad6
commit 7effde8bbe
2 changed files with 13 additions and 1 deletions
@@ -2433,6 +2433,9 @@ async fn get_datatable_schema(
FROM pg_namespace
WHERE nspname NOT IN ('information_schema', 'pg_toast', 'pg_catalog')
AND nspname NOT LIKE 'pg_%'
-- Only what this connection's role can reach: a schema it cannot
-- enter would list no tables and read as an empty one.
AND has_schema_privilege(oid, 'USAGE, CREATE')
ORDER BY nspname
"#,
&[],
@@ -2524,6 +2527,9 @@ async fn get_datatable_tables(
FROM pg_namespace
WHERE nspname NOT IN ('information_schema', 'pg_toast', 'pg_catalog')
AND nspname NOT LIKE 'pg_%'
-- Only what this connection's role can reach: a schema it cannot
-- enter would list no tables and read as an empty one.
AND has_schema_privilege(oid, 'USAGE, CREATE')
ORDER BY nspname
"#,
&[],