Skip to content

Commit 46790bf

Browse files
authored
Don't sync motherduck views without supported columns (#990)
There was a bug where if a motherduck view only contained tables that were not supported by pg_duckdb, then we would generate an invalid postgres query to create the view. This simply skips creating such views.
1 parent 6f0270e commit 46790bf

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/pgduckdb_background_worker.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -625,6 +625,12 @@ CreatePgViewString(duckdb::CreateViewInfo &info, bool is_default_db) {
625625
oss << " AS " << duckdb::KeywordHelper::WriteQuoted(*it_names, '"');
626626
}
627627

628+
if (first) {
629+
elog(WARNING, "Skipping view %s.%s.%s because none of its columns had supported types", info.catalog.c_str(),
630+
info.schema.c_str(), info.view_name.c_str());
631+
return "";
632+
}
633+
628634
oss << " FROM duckdb.view(";
629635
oss << duckdb::KeywordHelper::WriteQuoted(info.catalog) << ", ";
630636
oss << duckdb::KeywordHelper::WriteQuoted(info.schema) << ", ";

0 commit comments

Comments
 (0)