duckdb / pg_duckdb

DuckDB-powered Postgres for high performance apps & analytics.
MIT License
1.61k stars 55 forks source link

support "PREPARE" statement and "EXECUTE " statement #234

Open Leo-XM-Zeng opened 1 month ago

Leo-XM-Zeng commented 1 month ago

Current Behavior

postgres=# create extension pg_duckdb;
WARNING:  To actually execute queries using DuckDB you need to run "SET duckdb.execution TO true;"
CREATE EXTENSION
postgres=# SET duckdb.execution TO true;
SET
postgres=# SELECT COUNT(*) FROM t;
 count 
-------
  1000
(1 row)

postgres=# PREPARE test_stmt AS SELECT COUNT(*) FROM t;
PREPARE
postgres=# EXECUTE test_stmt;
 count 
-------
     0
(1 row)
JelteF commented 1 month ago

Thanks for the bug report. That's indeed something we should fix. However, the usage of prepared statements at the SQL level (i.e. PREPARE/EXECUTE queries) is a lot lower than at the protocol level (Parse/Bind/Execute messages). So I don't consider this a blocker for 0.1.0.