alitrack / duckdb_fdw

DuckDB Foreign Data Wrapper for PostgreSQL
MIT License
267 stars 18 forks source link

ERROR on PolarDB 11.9 #34

Open digoal opened 5 months ago

digoal commented 5 months ago
./duckdb /home/postgres/db    

COPY (select generate_series as id, md5(random()::text) as info,   
now()::timestamp+(generate_series||' second')::interval as crt_time   
from generate_series(1,100)) TO '/home/postgres/t1.parquet' (FORMAT 'PARQUET');    

COPY (select generate_series as cid, md5(random()::text) as info,   
now()::timestamp+(generate_series||' second')::interval as crt_time   
from generate_series(1,100)) TO '/home/postgres/t2.parquet' (FORMAT 'PARQUET');    

COPY (select (floor(random()*100)+1)::int as gid, (floor(random()*100)+1)::int as cid,   
(random()*10)::int as c1, (random()*100)::int as c2, (random()*1000)::int as c3,   
(random()*10000)::int as c4, (random()*100000)::int as c5 from generate_series(1,1000000))   
TO '/home/postgres/t3.parquet' (FORMAT 'PARQUET');    

create view t1 as select * from read_parquet('/home/postgres/t1.parquet');    
create view t2 as select * from read_parquet('/home/postgres/t2.parquet');    
create view t3 as select * from read_parquet('/home/postgres/t3.parquet');    

checkpoint;    
postgres=# \set VERBOSITY verbose
postgres=# set client_min_messages =DEBUG3;

postgres=# create extension duckdb_fdw;   
CREATE EXTENSION
postgres=# CREATE SERVER DuckDB_server FOREIGN DATA WRAPPER duckdb_fdw OPTIONS   
postgres-#   (database '/home/postgres/db');    
CREATE SERVER
postgres=# IMPORT FOREIGN SCHEMA public FROM SERVER DuckDB_server INTO public;  
DEBUG:  00000: duckdb_fdw : duckdb_fdw_handler
LOCATION:  duckdb_fdw_handler, duckdb_fdw.c:428
DEBUG:  00000: duckdb_fdw : sqliteImportForeignSchema
LOCATION:  sqliteImportForeignSchema, duckdb_fdw.c:2964
DEBUG:  00000: duckdb_fdw xact_callback 2
LOCATION:  sqlitefdw_xact_callback, connection.c:394
ERROR:  HV00L: SQL error during prepare: bad parameter or other API misuse SELECT current_catalog() as remote_catalog
LOCATION:  sqlite_prepare_wrapper, duckdb_fdw.c:503

postgres=# 
postgres=# create foreign table t1 (id int8, info text, crt_time timestamp) server duckdb_server OPTIONS (table 't1');
CREATE FOREIGN TABLE
postgres=# select * from t1;
DEBUG:  00000: PX Failed: param polar_enable_px is off
LOCATION:  should_px_planner, planner.c:7859
DEBUG:  00000: duckdb_fdw : sqliteGetForeignRelSize
LOCATION:  sqliteGetForeignRelSize, duckdb_fdw.c:524
DEBUG:  00000: duckdb_fdw : sqliteGetForeignPaths
LOCATION:  sqliteGetForeignPaths, duckdb_fdw.c:871
DEBUG:  00000: duckdb_fdw : sqliteGetForeignUpperPaths
LOCATION:  sqliteGetForeignUpperPaths, duckdb_fdw.c:3923
DEBUG:  00000: duckdb_fdw : sqliteGetForeignPlan
LOCATION:  sqliteGetForeignPlan, duckdb_fdw.c:1111
DEBUG:  00000: duckdb_fdw : sqliteBeginForeignScan
LOCATION:  sqliteBeginForeignScan, duckdb_fdw.c:1413
DEBUG:  00000: starting remote transaction on connection 0x55ee4b994518
LOCATION:  sqlite_begin_remote_xact, connection.c:326
DEBUG:  00000: duckdb_fdw do_sql_command BEGIN 0x55ee4b994518
LOCATION:  sqlite_do_sql_command, connection.c:285
DEBUG:  00000: duckdb_fdw xact_callback 2
LOCATION:  sqlitefdw_xact_callback, connection.c:394
ERROR:  HV000: SQLite failed to execute sql: BEGIN
LOCATION:  sqlite_do_sql_command, connection.c:306

detail info: https://github.com/digoal/blog/blob/master/202401/20240126_03.md

digoal commented 5 months ago
postgres=# SELECT duckdb_execute('duckdb_server', 'install parquet');
DEBUG:  00000: PX Failed: param polar_enable_px is off
LOCATION:  should_px_planner, planner.c:7859
DEBUG:  00000: duckdb_fdw : duckdb_execute  install parquet
LOCATION:  duckdb_execute, duckdb_fdw.c:5511
DEBUG:  00000: starting remote transaction on connection 0x55ee4b994518
LOCATION:  sqlite_begin_remote_xact, connection.c:326
DEBUG:  00000: duckdb_fdw do_sql_command BEGIN 0x55ee4b994518
LOCATION:  sqlite_do_sql_command, connection.c:285
DEBUG:  00000: duckdb_fdw xact_callback 2
LOCATION:  sqlitefdw_xact_callback, connection.c:394
ERROR:  HV000: SQLite failed to execute sql: BEGIN
LOCATION:  sqlite_do_sql_command, connection.c:306
alitrack commented 5 months ago
image

fix PG 11 support , but still not test on PolarDB 11.9