Prepared statement error: Could not convert DuckDB type: UNKNOWN to Postgres type #480
Open
Description
What happens?
Prepared statement is still broken even after the fix in #147
Minor tweaks to an existing test results in failure
To Reproduce
Add a new test case test_prepared_new()
to test/pycheck/prepared_test.py
def test_prepared_new(cur: Cursor):
cur.sql("CREATE TEMP TABLE test_table (id int) USING duckdb")
cur.sql("INSERT INTO test_table VALUES (1), (2), (3)")
q2 = "SELECT count(*) FROM test_table where id = %s + 1"
cur.sql("SET plan_cache_mode = 'force_custom_plan'")
assert cur.sql(q2, (1,)) == 1
This is just a simplified version of test_prepared()
with the following modifications:
- Use DuckDB temp table to force DuckDB execution
- Change from
WHERE %s
toWHERE %s + 1
Running the test with pytest test/pycheck/prepared_test.py::test_prepared_new
results in the following error:
2024-12-06 09:16:14.947 UTC [47236] WARNING: (PGDuckDB/GetPostgresDuckDBType) Could not convert DuckDB type: UNKNOWN to Postgres type
2024-12-06 09:16:14.947 UTC [47236] ERROR: (PGDuckDB/CreatePlan) Cache lookup failed for type 0
2024-12-06 09:16:14.947 UTC [47236] STATEMENT: SELECT count(*) FROM test_table where id = $1 + 1
OS:
Linux
pg_duckdb Version (if built from source use commit hash):
Postgres Version (if built from source use commit hash):
17.0
Hardware:
No response
Full Name:
Cheng Chen
Affiliation:
Mooncake Labs
What is the latest build you tested with? If possible, we recommend testing with the latest nightly build.
I have tested with a source build
Did you include all relevant data sets for reproducing the issue?
Not applicable - the reproduction does not require a data set
Did you include all code required to reproduce the issue?
- Yes, I have
Did you include all relevant configuration (e.g., CPU architecture, Linux distribution) to reproduce the issue?
- Yes, I have