STET

agent_patch

runs/2026-02-28__18-27-22__gpt-5-3-codex/flux-pr-1765/flux-pr-1765.1-of-1.2026-02-28__18-27-22__gpt-5-3-codex/agent-logs/agent.patch

32858 bytes

Back to adjudication
diff --git a/tmp/agent-patch-flux-pr-1765.1-of-1.2026-02-28__18-27-22__gpt-5-3-codex/app/src/ast/mod.rs b/app/src/ast/mod.rs
index 8ab3fc0..499cacf 100644
--- a/tmp/agent-patch-flux-pr-1765.1-of-1.2026-02-28__18-27-22__gpt-5-3-codex/app/src/ast/mod.rs
+++ b/app/src/ast/mod.rs
@@ -66,7 +66,7 @@ pub use self::query::{
     FormatClause, GroupByExpr, GroupByWithModifier, IdentWithAlias, IlikeSelectItem,
     InputFormatClause, Interpolate, InterpolateExpr, Join, JoinConstraint, JoinOperator,
     JsonTableColumn, JsonTableColumnErrorHandling, JsonTableNamedColumn, JsonTableNestedColumn,
-    LateralView, LockClause, LockType, MatchRecognizePattern, MatchRecognizeSymbol, Measure,
+    LateralView, LimitClause, LockClause, LockType, MatchRecognizePattern, MatchRecognizeSymbol, Measure,
     NamedWindowDefinition, NamedWindowExpr, NonBlock, Offset, OffsetRows, OpenJsonTableColumn,
     OrderBy, OrderByExpr, OrderByKind, OrderByOptions, PivotValueSource, ProjectionSelect, Query,
     RenameSelectItem, RepetitionQuantifier, ReplaceSelectElement, ReplaceSelectItem, RowsPerMatch,
diff --git a/tmp/agent-patch-flux-pr-1765.1-of-1.2026-02-28__18-27-22__gpt-5-3-codex/app/src/ast/query.rs b/app/src/ast/query.rs
index 12f7293..9a3c49f 100644
--- a/tmp/agent-patch-flux-pr-1765.1-of-1.2026-02-28__18-27-22__gpt-5-3-codex/app/src/ast/query.rs
+++ b/app/src/ast/query.rs
@@ -43,14 +43,11 @@ pub struct Query {
     pub body: Box<SetExpr>,
     /// ORDER BY
     pub order_by: Option<OrderBy>,
-    /// `LIMIT { <N> | ALL }`
-    pub limit: Option<Expr>,
+    /// `LIMIT`/`OFFSET` clause.
+    pub limit_clause: Option<LimitClause>,
 
     /// `LIMIT { <N> } BY { <expr>,<expr>,... } }`
     pub limit_by: Vec<Expr>,
-
-    /// `OFFSET <N> [ { ROW | ROWS } ]`
-    pub offset: Option<Offset>,
     /// `FETCH { FIRST | NEXT } <N> [ PERCENT ] { ROW | ROWS } | { ONLY | WITH TIES }`
     pub fetch: Option<Fetch>,
     /// `FOR { UPDATE | SHARE } [ OF table_name ] [ SKIP LOCKED | NOWAIT ]`
@@ -79,11 +76,8 @@ impl fmt::Display for Query {
         if let Some(ref order_by) = self.order_by {
             write!(f, " {order_by}")?;
         }
-        if let Some(ref limit) = self.limit {
-            write!(f, " LIMIT {limit}")?;
-        }
-        if let Some(ref offset) = self.offset {
-            write!(f, " {offset}")?;
+        if let Some(ref limit_clause) = self.limit_clause {
+            write!(f, " {limit_clause}")?;
         }
         if !self.limit_by.is_empty() {
             write!(f, " BY {}", display_separated(&self.limit_by, ", "))?;
@@ -107,6 +101,54 @@ impl fmt::Display for Query {
     }
 }
 
+/// Represents query-level `LIMIT`/`OFFSET` syntax variants.
+#[derive(Debug, Clone, PartialEq, PartialOrd, Eq, Ord, Hash)]
+#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
+#[cfg_attr(feature = "visitor", derive(Visit, VisitMut))]
+pub enum LimitClause {
+    /// Standard SQL clause:
+    /// - `LIMIT <N> [OFFSET <N>]`
+    /// - `LIMIT ALL [OFFSET <N>]`
+    /// - `OFFSET <N>`
+    LimitOffset {
+        /// Optional `LIMIT` quantity. `None` means `LIMIT ALL` when `offset` is also `None`,
+        /// or no `LIMIT` when `offset` is `Some`.
+        limit: Option<Expr>,
+        /// Optional `OFFSET`.
+        offset: Option<Offset>,
+    },
+    /// MySQL style `LIMIT <offset>, <limit>`
+    OffsetCommaLimit { offset: Expr, limit: Expr },
+}
+
+impl fmt::Display for LimitClause {
+    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        match self {
+            LimitClause::LimitOffset { limit, offset } => {
+                let mut wrote_limit = false;
+                if let Some(limit) = limit {
+                    write!(f, "LIMIT {limit}")?;
+                    wrote_limit = true;
+                } else if offset.is_none() {
+                    write!(f, "LIMIT ALL")?;
+                    wrote_limit = true;
+                }
+
+                if let Some(offset) = offset {
+                    if wrote_limit {
+                        write!(f, " ")?;
+                    }
+                    write!(f, "{offset}")?;
+                }
+                Ok(())
+            }
+            LimitClause::OffsetCommaLimit { offset, limit } => {
+                write!(f, "LIMIT {offset}, {limit}")
+            }
+        }
+    }
+}
+
 /// Query syntax for ClickHouse ADD PROJECTION statement.
 /// Its syntax is similar to SELECT statement, but it is used to add a new projection to a table.
 /// Syntax is `SELECT <COLUMN LIST EXPR> [GROUP BY] [ORDER BY]`
diff --git a/tmp/agent-patch-flux-pr-1765.1-of-1.2026-02-28__18-27-22__gpt-5-3-codex/app/src/ast/spans.rs b/app/src/ast/spans.rs
index fb0fc3f..3f35464 100644
--- a/tmp/agent-patch-flux-pr-1765.1-of-1.2026-02-28__18-27-22__gpt-5-3-codex/app/src/ast/spans.rs
+++ b/app/src/ast/spans.rs
@@ -94,9 +94,8 @@ impl Spanned for Query {
             with,
             body,
             order_by,
-            limit,
+            limit_clause,
             limit_by,
-            offset,
             fetch,
             locks: _,         // todo
             for_clause: _,    // todo, mssql specific
@@ -109,14 +108,29 @@ impl Spanned for Query {
                 .map(|i| i.span())
                 .chain(core::iter::once(body.span()))
                 .chain(order_by.as_ref().map(|i| i.span()))
-                .chain(limit.as_ref().map(|i| i.span()))
+                .chain(limit_clause.as_ref().map(|i| i.span()))
                 .chain(limit_by.iter().map(|i| i.span()))
-                .chain(offset.as_ref().map(|i| i.span()))
                 .chain(fetch.as_ref().map(|i| i.span())),
         )
     }
 }
 
+impl Spanned for LimitClause {
+    fn span(&self) -> Span {
+        match self {
+            LimitClause::LimitOffset { limit, offset } => union_spans(
+                limit
+                    .iter()
+                    .map(|i| i.span())
+                    .chain(offset.as_ref().map(|i| i.span())),
+            ),
+            LimitClause::OffsetCommaLimit { offset, limit } => {
+                union_spans([offset.span(), limit.span()])
+            }
+        }
+    }
+}
+
 impl Spanned for Offset {
     fn span(&self) -> Span {
         let Offset {
diff --git a/tmp/agent-patch-flux-pr-1765.1-of-1.2026-02-28__18-27-22__gpt-5-3-codex/app/src/ast/visitor.rs b/app/src/ast/visitor.rs
index a5d355f..5581c8b 100644
--- a/tmp/agent-patch-flux-pr-1765.1-of-1.2026-02-28__18-27-22__gpt-5-3-codex/app/src/ast/visitor.rs
+++ b/app/src/ast/visitor.rs
@@ -523,7 +523,7 @@ where
 /// // Remove all select limits in sub-queries
 /// visit_expressions_mut(&mut statements, |expr| {
 ///   if let Expr::Subquery(q) = expr {
-///      q.limit = None
+///      q.limit_clause = None
 ///   }
 ///   ControlFlow::<()>::Continue(())
 /// });
@@ -647,7 +647,7 @@ where
 /// // Remove all select limits in outer statements (not in sub-queries)
 /// visit_statements_mut(&mut statements, |stmt| {
 ///   if let Statement::Query(q) = stmt {
-///      q.limit = None
+///      q.limit_clause = None
 ///   }
 ///   ControlFlow::<()>::Continue(())
 /// });
diff --git a/tmp/agent-patch-flux-pr-1765.1-of-1.2026-02-28__18-27-22__gpt-5-3-codex/app/src/parser/mod.rs b/app/src/parser/mod.rs
index 32a7bcc..870fd2d 100644
--- a/tmp/agent-patch-flux-pr-1765.1-of-1.2026-02-28__18-27-22__gpt-5-3-codex/app/src/parser/mod.rs
+++ b/app/src/parser/mod.rs
@@ -10231,10 +10231,9 @@ impl<'a> Parser<'a> {
             Ok(Query {
                 with,
                 body: self.parse_insert_setexpr_boxed()?,
-                limit: None,
+                limit_clause: None,
                 limit_by: vec![],
                 order_by: None,
-                offset: None,
                 fetch: None,
                 locks: vec![],
                 for_clause: None,
@@ -10246,10 +10245,9 @@ impl<'a> Parser<'a> {
             Ok(Query {
                 with,
                 body: self.parse_update_setexpr_boxed()?,
-                limit: None,
+                limit_clause: None,
                 limit_by: vec![],
                 order_by: None,
-                offset: None,
                 fetch: None,
                 locks: vec![],
                 for_clause: None,
@@ -10261,10 +10259,9 @@ impl<'a> Parser<'a> {
             Ok(Query {
                 with,
                 body: self.parse_delete_setexpr_boxed()?,
-                limit: None,
+                limit_clause: None,
                 limit_by: vec![],
                 order_by: None,
-                offset: None,
                 fetch: None,
                 locks: vec![],
                 for_clause: None,
@@ -10279,28 +10276,40 @@ impl<'a> Parser<'a> {
 
             let mut limit = None;
             let mut offset = None;
+            let mut limit_clause = None;
 
             for _x in 0..2 {
-                if limit.is_none() && self.parse_keyword(Keyword::LIMIT) {
-                    limit = self.parse_limit()?
+                if limit.is_none() && limit_clause.is_none() && self.parse_keyword(Keyword::LIMIT) {
+                    let parsed_limit = self.parse_limit()?;
+                    if self.dialect.supports_limit_comma() && self.consume_token(&Token::Comma) {
+                        // MySQL style LIMIT x,y.
+                        let offset_expr = parsed_limit.ok_or_else(|| {
+                            ParserError::ParserError(
+                                "Expected: expression, found: ALL".to_string(),
+                            )
+                        })?;
+                        let row_count = self.parse_expr()?;
+                        limit_clause = Some(LimitClause::OffsetCommaLimit {
+                            offset: offset_expr,
+                            limit: row_count,
+                        });
+                    } else {
+                        limit = Some(parsed_limit);
+                    }
                 }
 
-                if offset.is_none() && self.parse_keyword(Keyword::OFFSET) {
+                if limit_clause.is_none() && offset.is_none() && self.parse_keyword(Keyword::OFFSET) {
                     offset = Some(self.parse_offset()?)
                 }
-
-                if self.dialect.supports_limit_comma()
-                    && limit.is_some()
-                    && offset.is_none()
-                    && self.consume_token(&Token::Comma)
-                {
-                    // MySQL style LIMIT x,y => LIMIT y OFFSET x.
-                    // Check <https://dev.mysql.com/doc/refman/8.0/en/select.html> for more details.
-                    offset = Some(Offset {
-                        value: limit.unwrap(),
-                        rows: OffsetRows::None,
+            }
+            if limit_clause.is_none() {
+                if let Some(limit) = limit {
+                    limit_clause = Some(LimitClause::LimitOffset { limit, offset });
+                } else if let Some(offset) = offset {
+                    limit_clause = Some(LimitClause::LimitOffset {
+                        limit: None,
+                        offset: Some(offset),
                     });
-                    limit = Some(self.parse_expr()?);
                 }
             }
 
@@ -10347,9 +10356,8 @@ impl<'a> Parser<'a> {
                 with,
                 body,
                 order_by,
-                limit,
+                limit_clause,
                 limit_by,
-                offset,
                 fetch,
                 locks,
                 for_clause,
@@ -11809,9 +11817,8 @@ impl<'a> Parser<'a> {
                     with: None,
                     body: Box::new(values),
                     order_by: None,
-                    limit: None,
+                    limit_clause: None,
                     limit_by: vec![],
-                    offset: None,
                     fetch: None,
                     locks: vec![],
                     for_clause: None,
diff --git a/tmp/agent-patch-flux-pr-1765.1-of-1.2026-02-28__18-27-22__gpt-5-3-codex/app/tests/sqlparser_common.rs b/app/tests/sqlparser_common.rs
index c7bf287..9719a3b 100644
--- a/tmp/agent-patch-flux-pr-1765.1-of-1.2026-02-28__18-27-22__gpt-5-3-codex/app/tests/sqlparser_common.rs
+++ b/app/tests/sqlparser_common.rs
@@ -483,9 +483,8 @@ fn parse_update_set_from() {
                             flavor: SelectFlavor::Standard,
                         }))),
                         order_by: None,
-                        limit: None,
+                        limit_clause: None,
                         limit_by: vec![],
-                        offset: None,
                         fetch: None,
                         locks: vec![],
                         for_clause: None,
@@ -900,7 +899,7 @@ fn parse_simple_select() {
     assert!(select.distinct.is_none());
     assert_eq!(3, select.projection.len());
     let select = verified_query(sql);
-    assert_eq!(Some(Expr::value(number("5"))), select.limit);
+    assert_eq!(Some(Expr::value(number("5"))), query_limit(&select));
 }
 
 #[test]
@@ -912,10 +911,10 @@ fn parse_limit() {
 fn parse_limit_is_not_an_alias() {
     // In dialects supporting LIMIT it shouldn't be parsed as a table alias
     let ast = verified_query("SELECT id FROM customer LIMIT 1");
-    assert_eq!(Some(Expr::value(number("1"))), ast.limit);
+    assert_eq!(Some(Expr::value(number("1"))), query_limit(&ast));
 
     let ast = verified_query("SELECT 1 LIMIT 5");
-    assert_eq!(Some(Expr::value(number("5"))), ast.limit);
+    assert_eq!(Some(Expr::value(number("5"))), query_limit(&ast));
 }
 
 #[test]
@@ -2493,7 +2492,7 @@ fn parse_select_order_by_limit() {
         ]),
         select.order_by.expect("ORDER BY expected").kind
     );
-    assert_eq!(Some(Expr::value(number("2"))), select.limit);
+    assert_eq!(Some(Expr::value(number("2"))), query_limit(&select));
 }
 
 #[test]
@@ -2654,7 +2653,7 @@ fn parse_select_order_by_nulls_order() {
         ]),
         select.order_by.expect("ORDER BY expeccted").kind
     );
-    assert_eq!(Some(Expr::value(number("2"))), select.limit);
+    assert_eq!(Some(Expr::value(number("2"))), query_limit(&select));
 }
 
 #[test]
@@ -4247,9 +4246,8 @@ fn parse_create_table_as_table() {
             schema_name: None,
         }))),
         order_by: None,
-        limit: None,
+        limit_clause: None,
         limit_by: vec![],
-        offset: None,
         fetch: None,
         locks: vec![],
         for_clause: None,
@@ -4274,9 +4272,8 @@ fn parse_create_table_as_table() {
             schema_name: Some("schema_name".to_string()),
         }))),
         order_by: None,
-        limit: None,
+        limit_clause: None,
         limit_by: vec![],
-        offset: None,
         fetch: None,
         locks: vec![],
         for_clause: None,
@@ -6273,9 +6270,8 @@ fn parse_interval_and_or_xor() {
             flavor: SelectFlavor::Standard,
         }))),
         order_by: None,
-        limit: None,
+        limit_clause: None,
         limit_by: vec![],
-        offset: None,
         fetch: None,
         locks: vec![],
         for_clause: None,
@@ -8180,21 +8176,21 @@ fn parse_offset() {
         rows: OffsetRows::Rows,
     });
     let ast = dialects.verified_query("SELECT foo FROM bar OFFSET 2 ROWS");
-    assert_eq!(ast.offset, expect);
+    assert_eq!(query_offset(&ast), expect);
     let ast = dialects.verified_query("SELECT foo FROM bar WHERE foo = 4 OFFSET 2 ROWS");
-    assert_eq!(ast.offset, expect);
+    assert_eq!(query_offset(&ast), expect);
     let ast = dialects.verified_query("SELECT foo FROM bar ORDER BY baz OFFSET 2 ROWS");
-    assert_eq!(ast.offset, expect);
+    assert_eq!(query_offset(&ast), expect);
     let ast =
         dialects.verified_query("SELECT foo FROM bar WHERE foo = 4 ORDER BY baz OFFSET 2 ROWS");
-    assert_eq!(ast.offset, expect);
+    assert_eq!(query_offset(&ast), expect);
     let ast =
         dialects.verified_query("SELECT foo FROM (SELECT * FROM bar OFFSET 2 ROWS) OFFSET 2 ROWS");
-    assert_eq!(ast.offset, expect);
+    assert_eq!(query_offset(&ast), expect);
     match *ast.body {
         SetExpr::Select(s) => match only(s.from).relation {
             TableFactor::Derived { subquery, .. } => {
-                assert_eq!(subquery.offset, expect);
+                assert_eq!(query_offset(&subquery), expect);
             }
             _ => panic!("Test broke"),
         },
@@ -8202,7 +8198,7 @@ fn parse_offset() {
     }
     let ast = dialects.verified_query("SELECT 'foo' OFFSET 0 ROWS");
     assert_eq!(
-        ast.offset,
+        query_offset(&ast),
         Some(Offset {
             value: Expr::value(number("0")),
             rows: OffsetRows::Rows,
@@ -8210,7 +8206,7 @@ fn parse_offset() {
     );
     let ast = dialects.verified_query("SELECT 'foo' OFFSET 1 ROW");
     assert_eq!(
-        ast.offset,
+        query_offset(&ast),
         Some(Offset {
             value: Expr::value(number("1")),
             rows: OffsetRows::Row,
@@ -8218,7 +8214,7 @@ fn parse_offset() {
     );
     let ast = dialects.verified_query("SELECT 'foo' OFFSET 1");
     assert_eq!(
-        ast.offset,
+        query_offset(&ast),
         Some(Offset {
             value: Expr::value(number("1")),
             rows: OffsetRows::None,
@@ -8274,7 +8270,7 @@ fn parse_fetch() {
         "SELECT foo FROM bar WHERE foo = 4 ORDER BY baz OFFSET 2 ROWS FETCH FIRST 2 ROWS ONLY",
     );
     assert_eq!(
-        ast.offset,
+        query_offset(&ast),
         Some(Offset {
             value: Expr::value(number("2")),
             rows: OffsetRows::Rows,
@@ -8296,7 +8292,7 @@ fn parse_fetch() {
     }
     let ast = verified_query("SELECT foo FROM (SELECT * FROM bar OFFSET 2 ROWS FETCH FIRST 2 ROWS ONLY) OFFSET 2 ROWS FETCH FIRST 2 ROWS ONLY");
     assert_eq!(
-        ast.offset,
+        query_offset(&ast),
         Some(Offset {
             value: Expr::value(number("2")),
             rows: OffsetRows::Rows,
@@ -8307,7 +8303,7 @@ fn parse_fetch() {
         SetExpr::Select(s) => match only(s.from).relation {
             TableFactor::Derived { subquery, .. } => {
                 assert_eq!(
-                    subquery.offset,
+                    query_offset(&subquery),
                     Some(Offset {
                         value: Expr::value(number("2")),
                         rows: OffsetRows::Rows,
@@ -9358,9 +9354,8 @@ fn parse_merge() {
                             flavor: SelectFlavor::Standard,
                         }))),
                         order_by: None,
-                        limit: None,
+                        limit_clause: None,
                         limit_by: vec![],
-                        offset: None,
                         fetch: None,
                         locks: vec![],
                         for_clause: None,
@@ -9681,13 +9676,13 @@ fn test_placeholder() {
     let sql = "SELECT * FROM student LIMIT $1 OFFSET $2";
     let ast = dialects.verified_query(sql);
     assert_eq!(
-        ast.limit,
+        query_limit(&ast),
         Some(Expr::Value(
             (Value::Placeholder("$1".into())).with_empty_span()
         ))
     );
     assert_eq!(
-        ast.offset,
+        query_offset(&ast),
         Some(Offset {
             value: Expr::Value((Value::Placeholder("$2".into())).with_empty_span()),
             rows: OffsetRows::None,
@@ -9761,6 +9756,25 @@ fn verified_query(query: &str) -> Query {
     all_dialects().verified_query(query)
 }
 
+fn query_limit(query: &Query) -> Option<Expr> {
+    match &query.limit_clause {
+        Some(LimitClause::LimitOffset { limit, .. }) => limit.clone(),
+        Some(LimitClause::OffsetCommaLimit { limit, .. }) => Some(limit.clone()),
+        None => None,
+    }
+}
+
+fn query_offset(query: &Query) -> Option<Offset> {
+    match &query.limit_clause {
+        Some(LimitClause::LimitOffset { offset, .. }) => offset.clone(),
+        Some(LimitClause::OffsetCommaLimit { offset, .. }) => Some(Offset {
+            value: offset.clone(),
+            rows: OffsetRows::None,
+        }),
+        None => None,
+    }
+}
+
 fn verified_only_select(query: &str) -> Select {
     all_dialects().verified_only_select(query)
 }
@@ -9777,8 +9791,8 @@ fn parse_offset_and_limit() {
         rows: OffsetRows::None,
     });
     let ast = verified_query(sql);
-    assert_eq!(ast.offset, expect);
-    assert_eq!(ast.limit, Some(Expr::value(number("1"))));
+    assert_eq!(query_offset(&ast), expect);
+    assert_eq!(query_limit(&ast), Some(Expr::value(number("1"))));
 
     // different order is OK
     one_statement_parses_to("SELECT foo FROM bar OFFSET 2 LIMIT 1", sql);
@@ -9790,13 +9804,22 @@ fn parse_offset_and_limit() {
         Box::new(SQLiteDialect {}),
         Box::new(ClickHouseDialect {}),
     ])
-    .one_statement_parses_to("SELECT foo FROM bar LIMIT 2, 1", sql);
+    .one_statement_parses_to("SELECT foo FROM bar LIMIT 2, 1", "SELECT foo FROM bar LIMIT 2, 1");
+    let ast = TestedDialects::new(vec![Box::new(GenericDialect {})])
+        .verified_query("SELECT foo FROM bar LIMIT 2, 1");
+    assert_eq!(
+        ast.limit_clause,
+        Some(LimitClause::OffsetCommaLimit {
+            offset: Expr::value(number("2")),
+            limit: Expr::value(number("1")),
+        })
+    );
 
     // expressions are allowed
     let sql = "SELECT foo FROM bar LIMIT 1 + 2 OFFSET 3 * 4";
     let ast = verified_query(sql);
     assert_eq!(
-        ast.limit,
+        query_limit(&ast),
         Some(Expr::BinaryOp {
             left: Box::new(Expr::value(number("1"))),
             op: BinaryOperator::Plus,
@@ -9804,7 +9827,7 @@ fn parse_offset_and_limit() {
         }),
     );
     assert_eq!(
-        ast.offset,
+        query_offset(&ast),
         Some(Offset {
             value: Expr::BinaryOp {
                 left: Box::new(Expr::value(number("3"))),
@@ -11227,9 +11250,8 @@ fn parse_unload() {
                     flavor: SelectFlavor::Standard,
                 }))),
                 with: None,
-                limit: None,
+                limit_clause: None,
                 limit_by: vec![],
-                offset: None,
                 fetch: None,
                 locks: vec![],
                 for_clause: None,
@@ -12400,9 +12422,8 @@ fn test_extract_seconds_ok() {
             flavor: SelectFlavor::Standard,
         }))),
         order_by: None,
-        limit: None,
+        limit_clause: None,
         limit_by: vec![],
-        offset: None,
         fetch: None,
         locks: vec![],
         for_clause: None,
@@ -14265,8 +14286,7 @@ fn test_select_from_first() {
                 flavor,
             }))),
             order_by: None,
-            limit: None,
-            offset: None,
+            limit_clause: None,
             fetch: None,
             locks: vec![],
             limit_by: vec![],
diff --git a/tmp/agent-patch-flux-pr-1765.1-of-1.2026-02-28__18-27-22__gpt-5-3-codex/app/tests/sqlparser_mssql.rs b/app/tests/sqlparser_mssql.rs
index 386bd17..645af35 100644
--- a/tmp/agent-patch-flux-pr-1765.1-of-1.2026-02-28__18-27-22__gpt-5-3-codex/app/tests/sqlparser_mssql.rs
+++ b/app/tests/sqlparser_mssql.rs
@@ -107,9 +107,8 @@ fn parse_create_procedure() {
             or_alter: true,
             body: vec![Statement::Query(Box::new(Query {
                 with: None,
-                limit: None,
+                limit_clause: None,
                 limit_by: vec![],
-                offset: None,
                 fetch: None,
                 locks: vec![],
                 for_clause: None,
@@ -1161,9 +1160,8 @@ fn parse_substring_in_select() {
                         flavor: SelectFlavor::Standard,
                     }))),
                     order_by: None,
-                    limit: None,
+                    limit_clause: None,
                     limit_by: vec![],
-                    offset: None,
                     fetch: None,
                     locks: vec![],
                     for_clause: None,
@@ -1264,9 +1262,8 @@ fn parse_mssql_declare() {
             }),
             Statement::Query(Box::new(Query {
                 with: None,
-                limit: None,
+                limit_clause: None,
                 limit_by: vec![],
-                offset: None,
                 fetch: None,
                 locks: vec![],
                 for_clause: None,
diff --git a/tmp/agent-patch-flux-pr-1765.1-of-1.2026-02-28__18-27-22__gpt-5-3-codex/app/tests/sqlparser_mysql.rs b/app/tests/sqlparser_mysql.rs
index 13a8a6c..7c8d504 100644
--- a/tmp/agent-patch-flux-pr-1765.1-of-1.2026-02-28__18-27-22__gpt-5-3-codex/app/tests/sqlparser_mysql.rs
+++ b/app/tests/sqlparser_mysql.rs
@@ -1107,9 +1107,8 @@ fn parse_escaped_quote_identifiers_with_escape() {
                 flavor: SelectFlavor::Standard,
             }))),
             order_by: None,
-            limit: None,
+            limit_clause: None,
             limit_by: vec![],
-            offset: None,
             fetch: None,
             locks: vec![],
             for_clause: None,
@@ -1161,9 +1160,8 @@ fn parse_escaped_quote_identifiers_with_no_escape() {
                 flavor: SelectFlavor::Standard,
             }))),
             order_by: None,
-            limit: None,
+            limit_clause: None,
             limit_by: vec![],
-            offset: None,
             fetch: None,
             locks: vec![],
             for_clause: None,
@@ -1209,9 +1207,8 @@ fn parse_escaped_backticks_with_escape() {
                 flavor: SelectFlavor::Standard,
             }))),
             order_by: None,
-            limit: None,
+            limit_clause: None,
             limit_by: vec![],
-            offset: None,
             fetch: None,
             locks: vec![],
             for_clause: None,
@@ -1261,9 +1258,8 @@ fn parse_escaped_backticks_with_no_escape() {
                 flavor: SelectFlavor::Standard,
             }))),
             order_by: None,
-            limit: None,
+            limit_clause: None,
             limit_by: vec![],
-            offset: None,
             fetch: None,
             locks: vec![],
             for_clause: None,
@@ -1438,9 +1434,8 @@ fn parse_simple_insert() {
                         ]
                     })),
                     order_by: None,
-                    limit: None,
+                    limit_clause: None,
                     limit_by: vec![],
-                    offset: None,
                     fetch: None,
                     locks: vec![],
                     for_clause: None,
@@ -1488,9 +1483,8 @@ fn parse_ignore_insert() {
                         ]]
                     })),
                     order_by: None,
-                    limit: None,
+                    limit_clause: None,
                     limit_by: vec![],
-                    offset: None,
                     fetch: None,
                     locks: vec![],
                     for_clause: None,
@@ -1538,9 +1532,8 @@ fn parse_priority_insert() {
                         ]]
                     })),
                     order_by: None,
-                    limit: None,
+                    limit_clause: None,
                     limit_by: vec![],
-                    offset: None,
                     fetch: None,
                     locks: vec![],
                     for_clause: None,
@@ -1585,9 +1578,8 @@ fn parse_priority_insert() {
                         ]]
                     })),
                     order_by: None,
-                    limit: None,
+                    limit_clause: None,
                     limit_by: vec![],
-                    offset: None,
                     fetch: None,
                     locks: vec![],
                     for_clause: None,
@@ -1634,9 +1626,8 @@ fn parse_insert_as() {
                         )]]
                     })),
                     order_by: None,
-                    limit: None,
+                    limit_clause: None,
                     limit_by: vec![],
-                    offset: None,
                     fetch: None,
                     locks: vec![],
                     for_clause: None,
@@ -1698,9 +1689,8 @@ fn parse_insert_as() {
                         ]]
                     })),
                     order_by: None,
-                    limit: None,
+                    limit_clause: None,
                     limit_by: vec![],
-                    offset: None,
                     fetch: None,
                     locks: vec![],
                     for_clause: None,
@@ -1749,9 +1739,8 @@ fn parse_replace_insert() {
                         ]]
                     })),
                     order_by: None,
-                    limit: None,
+                    limit_clause: None,
                     limit_by: vec![],
-                    offset: None,
                     fetch: None,
                     locks: vec![],
                     for_clause: None,
@@ -1791,9 +1780,8 @@ fn parse_empty_row_insert() {
                         rows: vec![vec![], vec![]]
                     })),
                     order_by: None,
-                    limit: None,
+                    limit_clause: None,
                     limit_by: vec![],
-                    offset: None,
                     fetch: None,
                     locks: vec![],
                     for_clause: None,
@@ -1857,9 +1845,8 @@ fn parse_insert_with_on_duplicate_update() {
                         ]]
                     })),
                     order_by: None,
-                    limit: None,
+                    limit_clause: None,
                     limit_by: vec![],
-                    offset: None,
                     fetch: None,
                     locks: vec![],
                     for_clause: None,
@@ -2596,9 +2583,8 @@ fn parse_substring_in_select() {
                         flavor: SelectFlavor::Standard,
                     }))),
                     order_by: None,
-                    limit: None,
+                    limit_clause: None,
                     limit_by: vec![],
-                    offset: None,
                     fetch: None,
                     locks: vec![],
                     for_clause: None,
@@ -2903,9 +2889,8 @@ fn parse_hex_string_introducer() {
                 flavor: SelectFlavor::Standard,
             }))),
             order_by: None,
-            limit: None,
+            limit_clause: None,
             limit_by: vec![],
-            offset: None,
             fetch: None,
             locks: vec![],
             for_clause: None,
diff --git a/tmp/agent-patch-flux-pr-1765.1-of-1.2026-02-28__18-27-22__gpt-5-3-codex/app/tests/sqlparser_postgres.rs b/app/tests/sqlparser_postgres.rs
index a65c4fa..173b299 100644
--- a/tmp/agent-patch-flux-pr-1765.1-of-1.2026-02-28__18-27-22__gpt-5-3-codex/app/tests/sqlparser_postgres.rs
+++ b/app/tests/sqlparser_postgres.rs
@@ -1319,9 +1319,8 @@ fn parse_copy_to() {
                     flavor: SelectFlavor::Standard,
                 }))),
                 order_by: None,
-                limit: None,
+                limit_clause: None,
                 limit_by: vec![],
-                offset: None,
                 fetch: None,
                 locks: vec![],
                 for_clause: None,
@@ -2955,9 +2954,8 @@ fn parse_array_subquery_expr() {
                     }))),
                 }),
                 order_by: None,
-                limit: None,
+                limit_clause: None,
                 limit_by: vec![],
-                offset: None,
                 fetch: None,
                 locks: vec![],
                 for_clause: None,
@@ -4747,9 +4745,8 @@ fn test_simple_postgres_insert_with_alias() {
                     ]]
                 })),
                 order_by: None,
-                limit: None,
+                limit_clause: None,
                 limit_by: vec![],
-                offset: None,
                 fetch: None,
                 locks: vec![],
                 for_clause: None,
@@ -4820,9 +4817,8 @@ fn test_simple_postgres_insert_with_alias() {
                     ]]
                 })),
                 order_by: None,
-                limit: None,
+                limit_clause: None,
                 limit_by: vec![],
-                offset: None,
                 fetch: None,
                 locks: vec![],
                 for_clause: None,
@@ -4891,9 +4887,8 @@ fn test_simple_insert_with_quoted_alias() {
                     ]]
                 })),
                 order_by: None,
-                limit: None,
+                limit_clause: None,
                 limit_by: vec![],
-                offset: None,
                 fetch: None,
                 locks: vec![],
                 for_clause: None,