Skip to content

Commit

Permalink
Remove duplicate column information for late-binding views (#3537)
Browse files Browse the repository at this point in the history
Since the svv_columns system view supports them now https://docs.aws.amazon.com/redshift/latest/dg/r_SVV_COLUMNS.html
  • Loading branch information
paulgraff authored and arikfr committed Mar 6, 2019
1 parent 21082fb commit 75bc469
Showing 1 changed file with 0 additions and 9 deletions.
9 changes: 0 additions & 9 deletions redash/query_runner/pg.py
Original file line number Diff line number Diff line change
Expand Up @@ -261,8 +261,6 @@ def configuration_schema(cls):
def _get_tables(self, schema):
# Use svv_columns to include internal & external (Spectrum) tables and views data for Redshift
# https://docs.aws.amazon.com/redshift/latest/dg/r_SVV_COLUMNS.html
# Use PG_GET_LATE_BINDING_VIEW_COLS to include schema for late binding views data for Redshift
# https://docs.aws.amazon.com/redshift/latest/dg/PG_GET_LATE_BINDING_VIEW_COLS.html
# Use HAS_SCHEMA_PRIVILEGE(), SVV_EXTERNAL_SCHEMAS and HAS_TABLE_PRIVILEGE() to filter
# out tables the current user cannot access.
# https://docs.aws.amazon.com/redshift/latest/dg/r_HAS_SCHEMA_PRIVILEGE.html
Expand All @@ -276,13 +274,6 @@ def _get_tables(self, schema):
ordinal_position AS pos
FROM svv_columns
WHERE table_schema NOT IN ('pg_internal','pg_catalog','information_schema')
UNION ALL
SELECT DISTINCT view_name::varchar AS table_name,
view_schema::varchar AS table_schema,
col_name::varchar AS column_name,
col_num AS pos
FROM pg_get_late_binding_view_cols()
cols(view_schema name, view_name name, col_name name, col_type varchar, col_num int)
)
SELECT table_name, table_schema, column_name
FROM tables
Expand Down

0 comments on commit 75bc469

Please sign in to comment.