Skip to content

Commit 79c9e04

Browse files
committed
fix: clarify error message when table not found
1 parent 2063c92 commit 79c9e04

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/ops/sources/postgres.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ async fn fetch_table_schema(
6565
c.column_name,
6666
c.data_type,
6767
c.is_nullable,
68-
CASE WHEN pk.column_name IS NOT NULL THEN true ELSE false END as is_primary_key
68+
(pk.column_name IS NOT NULL) as is_primary_key
6969
FROM
7070
information_schema.columns c
7171
LEFT JOIN (
@@ -113,6 +113,9 @@ async fn fetch_table_schema(
113113
}
114114

115115
if primary_key_columns.is_empty() {
116+
if value_columns.is_empty() {
117+
api_bail!("Table `{table_name}` not found");
118+
}
116119
api_bail!("Table `{table_name}` has no primary key defined");
117120
}
118121

0 commit comments

Comments
 (0)