Skip to content

Commit

Permalink
Rename PostgresScanTableFunction (#607)
Browse files Browse the repository at this point in the history
Because this can conflict with DuckDB's `postgres` extension which check
scanner by name eg.
https://github.com/duckdb/duckdb-postgres/blob/8461ed8b6f726564934e9c831cdc88d431e3148f/src/storage/postgres_insert.cpp#L193-L195

When `postgres` extension was loaded, the optimizer would try to then
[cast](https://github.com/duckdb/duckdb-postgres/blob/8461ed8b6f726564934e9c831cdc88d431e3148f/src/storage/postgres_optimizer.cpp#L23)
our `BindData` as its own, creating obvious problems :-)

Fixes #567 #547
  • Loading branch information
Y-- authored Feb 17, 2025
1 parent 321a0bf commit 7b1ea5a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/scan/postgres_scan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,8 @@ PostgresScanFunctionData::~PostgresScanFunctionData() {
//

PostgresScanTableFunction::PostgresScanTableFunction()
: TableFunction("postgres_scan", {}, PostgresScanFunction, nullptr, PostgresScanInitGlobal, PostgresScanInitLocal) {
: TableFunction("pgduckdb_postgres_scan", {}, PostgresScanFunction, nullptr, PostgresScanInitGlobal,
PostgresScanInitLocal) {
named_parameters["cardinality"] = duckdb::LogicalType::UBIGINT;
named_parameters["relid"] = duckdb::LogicalType::UINTEGER;
named_parameters["snapshot"] = duckdb::LogicalType::POINTER;
Expand Down
4 changes: 2 additions & 2 deletions test/regression/expected/duckdb_recycle.out
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ EXPLAIN SELECT count(*) FROM ta;
│ count_star() │
└─────────────┬─────────────┘
┌─────────────┴─────────────┐
POSTGRES_SCAN
PGDUCKDB_POSTGRES_SCAN
│ ──────────────────── │
│ Table: ta │
│ │
Expand All @@ -37,7 +37,7 @@ EXPLAIN SELECT count(*) FROM ta;
│ count_star() │
└─────────────┬─────────────┘
┌─────────────┴─────────────┐
POSTGRES_SCAN
PGDUCKDB_POSTGRES_SCAN
│ ──────────────────── │
│ Table: ta │
│ │
Expand Down

0 comments on commit 7b1ea5a

Please sign in to comment.