Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show accessible tables only in New Query view for PostgreSQL #3599

Merged
merged 3 commits into from
Mar 27, 2019
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion redash/query_runner/pg.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,12 @@ def _get_tables(self, schema):
FROM pg_class c
JOIN pg_namespace s
ON c.relnamespace = s.oid
AND s.nspname NOT IN ('pg_catalog', 'information_schema')
AND s.nspname IN (
SELECT table_schema
FROM information_schema.table_privileges
WHERE grantee = (SELECT current_user)
AND table_schema NOT IN ('pg_catalog', 'information_schema')
GROUP BY table_schema)
JOIN pg_attribute a
ON a.attrelid = c.oid
AND a.attnum > 0
Expand Down