Skip to content

Commit

Permalink
create UnsupportedPostgresType
Browse files Browse the repository at this point in the history
  • Loading branch information
Tishj committed May 29, 2024
1 parent 0c2d8ed commit a9a4fb5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/quack_duckdb_connection.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include "duckdb.hpp"
#include "duckdb/parser/parsed_data/create_table_function_info.hpp"
#include "duckdb/main/extension_util.hpp"

#include "quack/quack_duckdb_connection.hpp"
#include "quack/quack_heap_scan.hpp"
Expand All @@ -26,6 +27,7 @@ quack_create_duckdb_connection(List *tables, List *neededColumns, const char *qu
duckdb::make_uniq_base<duckdb::ReplacementScanData, quack::PostgresHeapReplacementScanData>(
tables, neededColumns, query));


auto connection = duckdb::make_uniq<duckdb::Connection>(*db);

// Add the postgres_scan inserted by the replacement scan
Expand All @@ -35,6 +37,8 @@ quack_create_duckdb_connection(List *tables, List *neededColumns, const char *qu

auto &catalog = duckdb::Catalog::GetSystemCatalog(context);
context.transaction.BeginTransaction();
auto &instance = *db->instance;
duckdb::ExtensionUtil::RegisterType(instance, "UnsupportedPostgresType", duckdb::LogicalTypeId::VARCHAR);
catalog.CreateTableFunction(context, &heap_scan_info);
context.transaction.Commit();

Expand Down
2 changes: 1 addition & 1 deletion src/quack_types.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@ ConvertPostgresToDuckColumnType(Oid type, int32_t typmod) {
case INT8ARRAYOID:
return duckdb::LogicalType::LIST(duckdb::LogicalTypeId::BIGINT);
default:
elog(ERROR, "(DuckDB/ConvertPostgresToDuckColumnType) Unsupported quack type: %d", type);
return duckdb::LogicalType::USER("UnsupportedPostgresType");
}
}

Expand Down

0 comments on commit a9a4fb5

Please sign in to comment.