duckdb-node icon indicating copy to clipboard operation
duckdb-node copied to clipboard

Prepared statements fail with arrowIPCAll

Open domoritz opened this issue 1 year ago • 2 comments

const duckdb = require("duckdb");
const db = new duckdb.Database(":memory:");

const con = db.connect();

const stmt = con.prepare("SELECT ?::INTEGER AS fortytwo");

stmt.arrowIPCAll(42, function (err, res) {
  if (err) {
    console.warn(err);
  } else {
    console.log(res);
  }
});

crashes with

Assertion failed: (chunk.ColumnCount() == 2), function Callback, file statement.cpp, line 387.

DuckDB 1.0.0.

domoritz avatar Aug 21 '24 14:08 domoritz

Happens in https://github.com/duckdb/duckdb-node/blob/874c0dddc152017174bf56fe69e5a4232ebcd0f5/src/statement.cpp#L387

domoritz avatar Sep 25 '24 17:09 domoritz

possible fix would be to move the to_arrow_ipc query wrapping from Connection.prototype.arrowIPCAll to Statement.prototype.arrowIPCAll

csjh avatar Oct 02 '24 17:10 csjh