Describe the bug
Planning an INSERT ... VALUES statement with placeholder $0 panics. Other statement forms reject $0, but this DML path parses the placeholder index as usize and subtracts one without checking for zero.
To Reproduce
CREATE TABLE t AS SELECT 1 AS x;
EXPLAIN INSERT INTO t VALUES ($0);
Actual behavior
thread 'main' panicked at datafusion/sql/src/statement.rs:2339:29:
attempt to subtract with overflow
Expected behavior
Return a planning error such as Invalid placeholder, zero is not a valid index: $0.
Notes
SELECT $0 and PREPARE p AS SELECT $0 already return a clean planning error; the INSERT ... VALUES inference path should do the same.
Describe the bug
Planning an
INSERT ... VALUESstatement with placeholder$0panics. Other statement forms reject$0, but this DML path parses the placeholder index asusizeand subtracts one without checking for zero.To Reproduce
Actual behavior
Expected behavior
Return a planning error such as
Invalid placeholder, zero is not a valid index: $0.Notes
SELECT $0andPREPARE p AS SELECT $0already return a clean planning error; theINSERT ... VALUESinference path should do the same.