Skip to content

The easy-to-use open source Business Intelligence and Embedded Analytics tool that lets everyone work with data :bar_chart:

Avoid DDL races in redshift sync (relation does not exist error) (#65546)

Dan Stoneaec03f0e379e
diff --git a/modules/drivers/redshift/src/metabase/driver/redshift.clj b/modules/drivers/redshift/src/metabase/driver/redshift.clj
index 9815c50c744..0c13f1f5b5e 100644
--- a/modules/drivers/redshift/src/metabase/driver/redshift.clj
+++ b/modules/drivers/redshift/src/metabase/driver/redshift.clj
@@ -94,9 +94,9 @@
" where c.relnamespace = n.oid"
" and n.nspname !~ '^information_schema|catalog_history|pg_|metabase_cache_'"
" and c.relkind in ('r', 'p', 'v', 'f', 'm')"
- " and pg_catalog.has_schema_privilege(n.nspname, 'USAGE')"
- " and (pg_catalog.has_table_privilege('\"'||n.nspname||'\".\"'||c.relname||'\"','SELECT')"
- " or pg_catalog.has_any_column_privilege('\"'||n.nspname||'\".\"'||c.relname||'\"','SELECT'))"
+ " and pg_catalog.has_schema_privilege(n.oid, 'USAGE')"
+ " and (pg_catalog.has_table_privilege(c.oid,'SELECT')"
+ " or pg_catalog.has_any_column_privilege(c.oid,'SELECT'))"
"union all"
"select"
" tablename as name,"