BenSatori opened a new pull request, #3098:
URL: https://github.com/apache/datafusion-sqlparser-rs/pull/3098

   ```sql
   SELECT id FROM customers ORDER BY id FETCH FIRST (10+15) PERCENT ROW ONLY
   ```
   currently fails with:
   ```
   Expected: a value, found: (
   ```
   
   `Fetch::quantity` is already an `Option<Expr>`, but `parse_fetch` only 
accepted a literal value. This PR parses the count with `parse_expr`, matching 
`parse_limit` and `parse_offset`. Oracle accepts parenthesized arithmetic, 
scalar subqueries and function calls here, and PostgreSQL also documents an 
expression for the FETCH count. Unparenthesized expressions such as `FETCH 
FIRST n ROWS` or `FETCH FIRST 1 + 1 ROWS` are now accepted for all dialects, 
consistent with LIMIT and OFFSET.
   
   References: [Oracle 
row_limiting_clause](https://docs.oracle.com/en/database/oracle/oracle-database/19/sqlrf/SELECT.html),
 [PostgreSQL 
SELECT](https://www.postgresql.org/docs/current/sql-select.html#SQL-LIMIT)
   
   Fuzzed with `fuzz_parse_sql` and `fuzz_parse_roundtrip` for 60 seconds each, 
no panics. Seed: `fuzz/fuzz_seeds/oracle_fetch_expression_quantity.sql`.
   
   This PR was written with AI assistance (Claude Code). I reviewed every line 
and can explain each change.
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   


-- 
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]

Reply via email to