Dandandan opened a new issue, #22224: URL: https://github.com/apache/datafusion/issues/22224
### 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 ```sql CREATE TABLE t AS SELECT 1 AS x; EXPLAIN INSERT INTO t VALUES ($0); ``` ### Actual behavior ```text 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. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
