Skip to content

Commit 56cacc8

Browse files
authored
fix(redshift): list schemas via pg_namespace + has_schema_privilege (#971) (#982)
1 parent 0ad604d commit 56cacc8

2 files changed

Lines changed: 6 additions & 4 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
6565
- Oracle TIMESTAMP, TIMESTAMP WITH TIME ZONE, TIMESTAMP WITH LOCAL TIME ZONE, INTERVAL DAY TO SECOND, INTERVAL YEAR TO MONTH, DATE, RAW, and BLOB columns now render through typed decoders instead of garbled text. Tables containing INTERVAL YEAR TO MONTH or BFILE columns no longer crash the app on row fetch. Unknown column types display `<unsupported: type>` instead of crashing (#965)
6666
- Oracle connections to 23ai cloud and containerized deployments no longer fail with `uncleanShutdown` mid-handshake. OOB urgent-byte send now requires the server to advertise `TNS_ACCEPT_FLAG_CHECK_OOB`, matching python-oracledb behavior (#483)
6767
- Connecting to a downloadable database type (SQL Server, Oracle, MongoDB, DuckDB, BigQuery, libSQL, Cassandra, etcd, Cloudflare D1, DynamoDB) after the plugin is disabled or uninstalled now reopens the install prompt instead of failing with "plugin may be disabled or missing from the PlugIns directory." `PluginMetadataRegistry` now treats the registry default snapshot as the source of truth for the `isDownloadable` flag, so plugin self-registration cannot flip it to false and unregistration restores the default rather than deleting the type metadata (#975)
68+
- Redshift schema switcher no longer shows an empty list for non-admin users. The driver listed schemas via `information_schema.schemata`, which on Redshift only returns schemas the current user *owns* (Redshift diverges from PostgreSQL here, where USAGE is enough). `fetchSchemas` now reads from `pg_namespace` filtered by `has_schema_privilege(current_user, nspname, 'USAGE')`, so any schema the user can actually use appears in the dropdown (#971)
6869

6970
## [0.37.0] - 2026-05-01
7071

Plugins/PostgreSQLDriverPlugin/RedshiftPluginDriver.swift

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -534,10 +534,11 @@ final class RedshiftPluginDriver: PluginDatabaseDriver, @unchecked Sendable {
534534

535535
func fetchSchemas() async throws -> [String] {
536536
let result = try await execute(query: """
537-
SELECT schema_name FROM information_schema.schemata
538-
WHERE schema_name NOT LIKE 'pg_%'
539-
AND schema_name <> 'information_schema'
540-
ORDER BY schema_name
537+
SELECT nspname FROM pg_namespace
538+
WHERE nspname NOT LIKE 'pg_%'
539+
AND nspname <> 'information_schema'
540+
AND has_schema_privilege(current_user, nspname, 'USAGE')
541+
ORDER BY nspname
541542
""")
542543
return result.rows.compactMap { row in row.first.flatMap { $0 } }
543544
}

0 commit comments

Comments
 (0)