You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@datafusion.apache.org by "sabir-akhadov-localstack (via GitHub)" <gi...@apache.org> on 2026/06/23 15:30:03 UTC
[PR] Handle nested parentheses in INSERT subquery detection [datafusion-sqlparser-rs]
sabir-akhadov-localstack opened a new pull request, #2387:
URL: https://github.com/apache/datafusion-sqlparser-rs/pull/2387
When parsing `INSERT INTO t <source>`, the parser must decide whether the tokens following the table name begin an explicit column list `(a, b, ...)` or the source query `(SELECT ...)`. It made this decision in `peek_subquery_start` by matching exactly `( SELECT`, so a source query wrapped in more than one layer of parentheses was mistaken for a column list and failed to parse. For example `INSERT INTO t ((SELECT 1))` errored out, even though the equivalent nested-parenthesized subquery parses fine in other positions.
This changes `peek_subquery_start` to skip any number of leading `(` and treat the tokens as a subquery start as long as at least one paren precedes the `SELECT`. That makes INSERT consistent with the way nested parentheses around subqueries are already handled elsewhere via recursive descent.
A regression test is added in `tests/sqlparser_common.rs` covering `INSERT INTO t ((SELECT 1))` and `INSERT INTO t (((SELECT 1)))`; both round-trip and the column list is empty.
--
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: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] Handle nested parentheses in INSERT subquery detection [datafusion-sqlparser-rs]
Posted by "iffyio (via GitHub)" <gi...@apache.org>.
iffyio merged PR #2387:
URL: https://github.com/apache/datafusion-sqlparser-rs/pull/2387
--
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: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org