Skip to content

Commit 0ad13e8

Browse files
feat: update Redshift schema and table queries
- Modify schema query to use pg_catalog.pg_namespace for a complete schema list
1 parent f45c66d commit 0ad13e8

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src-tauri/src/drivers/redshift.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -122,14 +122,15 @@ pub async fn redshift_load_schemas(
122122
let clients = app_state.client.lock().await;
123123
let client = clients.as_ref().unwrap().get(project_id).unwrap();
124124

125-
// Redshift uses similar schema query but with some differences
125+
// Use pg_namespace for complete schema list
126126
let query = tokio_time::timeout(
127127
tokio_time::Duration::from_secs(10),
128128
client.query(
129-
r#"
130-
SELECT schema_name
131-
FROM information_schema.schemata
132-
WHERE schema_name NOT IN ('pg_catalog', 'information_schema', 'pg_internal')
129+
r#"--sql
130+
SELECT nspname AS schema_name
131+
FROM pg_catalog.pg_namespace
132+
WHERE nspname NOT LIKE 'pg_%'
133+
AND nspname != 'information_schema'
133134
ORDER BY schema_name;
134135
"#,
135136
&[],
@@ -176,10 +177,9 @@ pub async fn redshift_load_tables(
176177
r#"--sql
177178
SELECT
178179
table_name,
179-
'-' AS size
180+
table_type AS size
180181
FROM information_schema.tables
181182
WHERE table_schema = $1
182-
AND table_type = 'BASE TABLE'
183183
ORDER BY table_name;
184184
"#,
185185
&[&schema],

0 commit comments

Comments
 (0)