From 7b1ea5a59981faca3572c33ace784dc9f37c2080 Mon Sep 17 00:00:00 2001 From: "Y." Date: Mon, 17 Feb 2025 02:34:31 -0500 Subject: [PATCH] Rename PostgresScanTableFunction (#607) 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 --- src/scan/postgres_scan.cpp | 3 ++- test/regression/expected/duckdb_recycle.out | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/scan/postgres_scan.cpp b/src/scan/postgres_scan.cpp index 95e9195..dfadbeb 100644 --- a/src/scan/postgres_scan.cpp +++ b/src/scan/postgres_scan.cpp @@ -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; diff --git a/test/regression/expected/duckdb_recycle.out b/test/regression/expected/duckdb_recycle.out index 2c7dd1f..9b48173 100644 --- a/test/regression/expected/duckdb_recycle.out +++ b/test/regression/expected/duckdb_recycle.out @@ -13,7 +13,7 @@ EXPLAIN SELECT count(*) FROM ta; │ count_star() │ └─────────────┬─────────────┘ ┌─────────────┴─────────────┐ - │ POSTGRES_SCAN │ + │ PGDUCKDB_POSTGRES_SCAN │ │ ──────────────────── │ │ Table: ta │ │ │ @@ -37,7 +37,7 @@ EXPLAIN SELECT count(*) FROM ta; │ count_star() │ └─────────────┬─────────────┘ ┌─────────────┴─────────────┐ - │ POSTGRES_SCAN │ + │ PGDUCKDB_POSTGRES_SCAN │ │ ──────────────────── │ │ Table: ta │ │ │