STET

agent_patch

runs/2026-02-21__03-36-16__gpt-5-1-codex-mini/flux-pr-1765/flux-pr-1765.1-of-1.2026-03-05__17-48-34__gpt-5-1-codex-mini/agent-logs/agent.patch

31373 bytes

Back to adjudication
diff --git a/tmp/agent-patch-flux-pr-1765.1-of-1.2026-03-05__17-48-34__gpt-5-1-codex-mini/app/src/ast/query.rs b/app/src/ast/query.rs
index 12f7293..6d869b5 100644
--- a/tmp/agent-patch-flux-pr-1765.1-of-1.2026-03-05__17-48-34__gpt-5-1-codex-mini/app/src/ast/query.rs
+++ b/app/src/ast/query.rs
@@ -43,14 +43,8 @@ pub struct Query {
     pub body: Box<SetExpr>,
     /// ORDER BY
     pub order_by: Option<OrderBy>,
-    /// `LIMIT { <N> | ALL }`
-    pub limit: Option<Expr>,
-
-    /// `LIMIT { <N> } BY { <expr>,<expr>,... } }`
-    pub limit_by: Vec<Expr>,
-
-    /// `OFFSET <N> [ { ROW | ROWS } ]`
-    pub offset: Option<Offset>,
+    /// `LIMIT` / `OFFSET` clause (including MySQL comma syntax) and optional `BY`.
+    pub limit: Option<LimitClause>,
     /// `FETCH { FIRST | NEXT } <N> [ PERCENT ] { ROW | ROWS } | { ONLY | WITH TIES }`
     pub fetch: Option<Fetch>,
     /// `FOR { UPDATE | SHARE } [ OF table_name ] [ SKIP LOCKED | NOWAIT ]`
@@ -80,13 +74,7 @@ impl fmt::Display for Query {
             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 !self.limit_by.is_empty() {
-            write!(f, " BY {}", display_separated(&self.limit_by, ", "))?;
+            write!(f, " {limit}")?;
         }
         if let Some(ref settings) = self.settings {
             write!(f, " SETTINGS {}", display_comma_separated(settings))?;
@@ -107,6 +95,97 @@ impl fmt::Display for Query {
     }
 }
 
+impl Query {
+    /// Returns the limit expression for this query, if any.
+    pub fn limit_expr(&self) -> Option<&Expr> {
+        self.limit.as_ref().and_then(|limit| limit.limit_expr())
+    }
+
+    /// Returns the offset expression for this query, if any.
+    pub fn offset_expr(&self) -> Option<&Offset> {
+        self.limit.as_ref().and_then(|limit| limit.offset_expr())
+    }
+}
+
+/// `LIMIT` clause with optional `OFFSET` or MySQL comma syntax plus optional `BY`.
+#[derive(Debug, Clone, PartialEq, PartialOrd, Eq, Ord, Hash)]
+#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
+#[cfg_attr(feature = "visitor", derive(Visit, VisitMut))]
+pub struct LimitClause {
+    pub kind: LimitClauseKind,
+    pub limit_by: Vec<Expr>,
+}
+
+impl LimitClause {
+    /// Returns the limit expression if present.
+    pub fn limit_expr(&self) -> Option<&Expr> {
+        match &self.kind {
+            LimitClauseKind::Standard { limit, .. } => limit.as_ref(),
+            LimitClauseKind::Comma { limit, .. } => Some(limit),
+        }
+    }
+
+    /// Returns the offset expression if present (includes MySQL comma syntax).
+    pub fn offset_expr(&self) -> Option<&Offset> {
+        match &self.kind {
+            LimitClauseKind::Standard { offset, .. } => offset.as_ref(),
+            LimitClauseKind::Comma { offset, .. } => Some(offset),
+        }
+    }
+}
+
+impl fmt::Display for LimitClause {
+    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        let printed_any = match &self.kind {
+            LimitClauseKind::Standard { limit, offset } => {
+                let mut printed = false;
+                if let Some(limit) = limit {
+                    write!(f, "LIMIT {limit}")?;
+                    printed = true;
+                }
+                if let Some(offset) = offset {
+                    if printed {
+                        write!(f, " {offset}")?;
+                    } else {
+                        write!(f, "{offset}")?;
+                    }
+                    printed = true;
+                }
+                printed
+            }
+            LimitClauseKind::Comma { offset, limit } => {
+                write!(f, "LIMIT {}, {}", offset.value, limit)?;
+                true
+            }
+        };
+
+        if !self.limit_by.is_empty() {
+            if printed_any {
+                write!(f, " BY {}", display_separated(&self.limit_by, ", "))?;
+            } else {
+                write!(f, "BY {}", display_separated(&self.limit_by, ", "))?;
+            }
+        }
+        Ok(())
+    }
+}
+
+/// Distinguish between standard SQL `LIMIT`/`OFFSET` syntax and MySQL comma form.
+#[derive(Debug, Clone, PartialEq, PartialOrd, Eq, Ord, Hash)]
+#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
+#[cfg_attr(feature = "visitor", derive(Visit, VisitMut))]
+pub enum LimitClauseKind {
+    Standard {
+        limit: Option<Expr>,
+        offset: Option<Offset>,
+    },
+    Comma {
+        offset: Offset,
+        limit: Expr,
+    },
+}
+
+
 /// 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-03-05__17-48-34__gpt-5-1-codex-mini/app/src/ast/spans.rs b/app/src/ast/spans.rs
index fb0fc3f..cb49492 100644
--- a/tmp/agent-patch-flux-pr-1765.1-of-1.2026-03-05__17-48-34__gpt-5-1-codex-mini/app/src/ast/spans.rs
+++ b/app/src/ast/spans.rs
@@ -31,7 +31,8 @@ use super::{
     InterpolateExpr, Join, JoinConstraint, JoinOperator, JsonPath, JsonPathElem, LateralView,
     MatchRecognizePattern, Measure, NamedWindowDefinition, ObjectName, ObjectNamePart, Offset,
     OnConflict, OnConflictAction, OnInsert, OrderBy, OrderByExpr, OrderByKind, Partition,
-    PivotValueSource, ProjectionSelect, Query, ReferentialAction, RenameSelectItem,
+    PivotValueSource, ProjectionSelect, LimitClause, LimitClauseKind, Query,
+    ReferentialAction, RenameSelectItem,
     ReplaceSelectElement, ReplaceSelectItem, Select, SelectInto, SelectItem, SetExpr, SqlOption,
     Statement, Subscript, SymbolDefinition, TableAlias, TableAliasColumnDef, TableConstraint,
     TableFactor, TableObject, TableOptionsClustered, TableWithJoins, UpdateTableFromKind, Use,
@@ -95,8 +96,6 @@ impl Spanned for Query {
             body,
             order_by,
             limit,
-            limit_by,
-            offset,
             fetch,
             locks: _,         // todo
             for_clause: _,    // todo, mssql specific
@@ -110,13 +109,30 @@ impl Spanned for Query {
                 .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_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.kind {
+            LimitClauseKind::Standard { limit, offset } => union_spans(
+                limit
+                    .iter()
+                    .map(|i| i.span())
+                    .chain(offset.iter().map(|i| i.span()))
+                    .chain(self.limit_by.iter().map(|i| i.span())),
+            ),
+            LimitClauseKind::Comma { offset, limit } => union_spans(
+                core::iter::once(offset.span())
+                    .chain(core::iter::once(limit.span()))
+                    .chain(self.limit_by.iter().map(|i| i.span())),
+            ),
+        }
+    }
+}
+
 impl Spanned for Offset {
     fn span(&self) -> Span {
         let Offset {
diff --git a/tmp/agent-patch-flux-pr-1765.1-of-1.2026-03-05__17-48-34__gpt-5-1-codex-mini/app/src/parser/mod.rs b/app/src/parser/mod.rs
index 32a7bcc..e2eff4d 100644
--- a/tmp/agent-patch-flux-pr-1765.1-of-1.2026-03-05__17-48-34__gpt-5-1-codex-mini/app/src/parser/mod.rs
+++ b/app/src/parser/mod.rs
@@ -10231,10 +10231,8 @@ impl<'a> Parser<'a> {
             Ok(Query {
                 with,
                 body: self.parse_insert_setexpr_boxed()?,
-                limit: None,
-                limit_by: vec![],
                 order_by: None,
-                offset: None,
+                limit: None,
                 fetch: None,
                 locks: vec![],
                 for_clause: None,
@@ -10246,10 +10244,8 @@ impl<'a> Parser<'a> {
             Ok(Query {
                 with,
                 body: self.parse_update_setexpr_boxed()?,
-                limit: None,
-                limit_by: vec![],
                 order_by: None,
-                offset: None,
+                limit: None,
                 fetch: None,
                 locks: vec![],
                 for_clause: None,
@@ -10261,10 +10257,8 @@ impl<'a> Parser<'a> {
             Ok(Query {
                 with,
                 body: self.parse_delete_setexpr_boxed()?,
-                limit: None,
-                limit_by: vec![],
                 order_by: None,
-                offset: None,
+                limit: None,
                 fetch: None,
                 locks: vec![],
                 for_clause: None,
@@ -10277,30 +10271,32 @@ impl<'a> Parser<'a> {
 
             let order_by = self.parse_optional_order_by()?;
 
-            let mut limit = None;
+            let mut limit_expr = None;
             let mut offset = None;
+            let mut comma_offset = None;
 
             for _x in 0..2 {
-                if limit.is_none() && self.parse_keyword(Keyword::LIMIT) {
-                    limit = self.parse_limit()?
+                if limit_expr.is_none() && self.parse_keyword(Keyword::LIMIT) {
+                    limit_expr = self.parse_limit()?;
                 }
 
                 if offset.is_none() && self.parse_keyword(Keyword::OFFSET) {
-                    offset = Some(self.parse_offset()?)
+                    offset = Some(self.parse_offset()?);
                 }
 
                 if self.dialect.supports_limit_comma()
-                    && limit.is_some()
+                    && limit_expr.is_some()
                     && offset.is_none()
+                    && comma_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(),
+                    let mut comma_offset_val = Offset {
+                        value: limit_expr.take().unwrap(),
                         rows: OffsetRows::None,
-                    });
-                    limit = Some(self.parse_expr()?);
+                    };
+                    limit_expr = Some(self.parse_expr()?);
+                    comma_offset = Some(comma_offset_val.clone());
+                    offset = Some(comma_offset_val);
                 }
             }
 
@@ -10312,6 +10308,26 @@ impl<'a> Parser<'a> {
                 vec![]
             };
 
+            let limit_clause = if comma_offset.is_some() {
+                Some(LimitClause {
+                    kind: LimitClauseKind::Comma {
+                        offset: comma_offset.unwrap(),
+                        limit: limit_expr.expect("comma LIMIT always has a limit"),
+                    },
+                    limit_by,
+                })
+            } else if limit_expr.is_some() || offset.is_some() || !limit_by.is_empty() {
+                Some(LimitClause {
+                    kind: LimitClauseKind::Standard {
+                        limit: limit_expr,
+                        offset,
+                    },
+                    limit_by,
+                })
+            } else {
+                None
+            };
+
             let settings = self.parse_settings()?;
 
             let fetch = if self.parse_keyword(Keyword::FETCH) {
@@ -10347,9 +10363,7 @@ impl<'a> Parser<'a> {
                 with,
                 body,
                 order_by,
-                limit,
-                limit_by,
-                offset,
+                limit: limit_clause,
                 fetch,
                 locks,
                 for_clause,
@@ -11803,23 +11817,21 @@ impl<'a> Parser<'a> {
             // where there are no parentheses around the VALUES clause.
             let values = SetExpr::Values(self.parse_values(false)?);
             let alias = self.maybe_parse_table_alias()?;
-            Ok(TableFactor::Derived {
-                lateral: false,
-                subquery: Box::new(Query {
-                    with: None,
-                    body: Box::new(values),
-                    order_by: None,
-                    limit: None,
-                    limit_by: vec![],
-                    offset: None,
-                    fetch: None,
-                    locks: vec![],
-                    for_clause: None,
-                    settings: None,
-                    format_clause: None,
-                }),
-                alias,
-            })
+                Ok(TableFactor::Derived {
+                    lateral: false,
+                    subquery: Box::new(Query {
+                        with: None,
+                        body: Box::new(values),
+                        order_by: None,
+                        limit: None,
+                        fetch: None,
+                        locks: vec![],
+                        for_clause: None,
+                        settings: None,
+                        format_clause: None,
+                    }),
+                    alias,
+                })
         } else if dialect_of!(self is BigQueryDialect | PostgreSqlDialect | GenericDialect)
             && self.parse_keyword(Keyword::UNNEST)
         {
diff --git a/tmp/agent-patch-flux-pr-1765.1-of-1.2026-03-05__17-48-34__gpt-5-1-codex-mini/app/tests/sqlparser_common.rs b/app/tests/sqlparser_common.rs
index c7bf287..1da0825 100644
--- a/tmp/agent-patch-flux-pr-1765.1-of-1.2026-03-05__17-48-34__gpt-5-1-codex-mini/app/tests/sqlparser_common.rs
+++ b/app/tests/sqlparser_common.rs
@@ -484,8 +484,6 @@ fn parse_update_set_from() {
                         }))),
                         order_by: None,
                         limit: None,
-                        limit_by: vec![],
-                        offset: None,
                         fetch: None,
                         locks: vec![],
                         for_clause: None,
@@ -900,7 +898,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"))), select.limit_expr());
 }
 
 #[test]
@@ -912,10 +910,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"))), ast.limit_expr());
 
     let ast = verified_query("SELECT 1 LIMIT 5");
-    assert_eq!(Some(Expr::value(number("5"))), ast.limit);
+    assert_eq!(Some(&Expr::value(number("5"))), ast.limit_expr());
 }
 
 #[test]
@@ -4248,8 +4246,6 @@ fn parse_create_table_as_table() {
         }))),
         order_by: None,
         limit: None,
-        limit_by: vec![],
-        offset: None,
         fetch: None,
         locks: vec![],
         for_clause: None,
@@ -4275,8 +4271,6 @@ fn parse_create_table_as_table() {
         }))),
         order_by: None,
         limit: None,
-        limit_by: vec![],
-        offset: None,
         fetch: None,
         locks: vec![],
         for_clause: None,
@@ -6274,8 +6268,6 @@ fn parse_interval_and_or_xor() {
         }))),
         order_by: None,
         limit: None,
-        limit_by: vec![],
-        offset: None,
         fetch: None,
         locks: vec![],
         for_clause: None,
@@ -8180,21 +8172,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!(ast.offset_expr(), expect.as_ref());
     let ast = dialects.verified_query("SELECT foo FROM bar WHERE foo = 4 OFFSET 2 ROWS");
-    assert_eq!(ast.offset, expect);
+    assert_eq!(ast.offset_expr(), expect.as_ref());
     let ast = dialects.verified_query("SELECT foo FROM bar ORDER BY baz OFFSET 2 ROWS");
-    assert_eq!(ast.offset, expect);
+    assert_eq!(ast.offset_expr(), expect.as_ref());
     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!(ast.offset_expr(), expect.as_ref());
     let ast =
         dialects.verified_query("SELECT foo FROM (SELECT * FROM bar OFFSET 2 ROWS) OFFSET 2 ROWS");
-    assert_eq!(ast.offset, expect);
+    assert_eq!(ast.offset_expr(), expect.as_ref());
     match *ast.body {
         SetExpr::Select(s) => match only(s.from).relation {
             TableFactor::Derived { subquery, .. } => {
-                assert_eq!(subquery.offset, expect);
+                assert_eq!(subquery.offset_expr(), expect.as_ref());
             }
             _ => panic!("Test broke"),
         },
@@ -8202,24 +8194,24 @@ fn parse_offset() {
     }
     let ast = dialects.verified_query("SELECT 'foo' OFFSET 0 ROWS");
     assert_eq!(
-        ast.offset,
-        Some(Offset {
+        ast.offset_expr(),
+        Some(&Offset {
             value: Expr::value(number("0")),
             rows: OffsetRows::Rows,
         })
     );
     let ast = dialects.verified_query("SELECT 'foo' OFFSET 1 ROW");
     assert_eq!(
-        ast.offset,
-        Some(Offset {
+        ast.offset_expr(),
+        Some(&Offset {
             value: Expr::value(number("1")),
             rows: OffsetRows::Row,
         })
     );
     let ast = dialects.verified_query("SELECT 'foo' OFFSET 1");
     assert_eq!(
-        ast.offset,
-        Some(Offset {
+        ast.offset_expr(),
+        Some(&Offset {
             value: Expr::value(number("1")),
             rows: OffsetRows::None,
         })
@@ -8274,8 +8266,8 @@ 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,
-        Some(Offset {
+        ast.offset_expr(),
+        Some(&Offset {
             value: Expr::value(number("2")),
             rows: OffsetRows::Rows,
         })
@@ -8296,8 +8288,8 @@ 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,
-        Some(Offset {
+        ast.offset_expr(),
+        Some(&Offset {
             value: Expr::value(number("2")),
             rows: OffsetRows::Rows,
         })
@@ -8307,8 +8299,8 @@ fn parse_fetch() {
         SetExpr::Select(s) => match only(s.from).relation {
             TableFactor::Derived { subquery, .. } => {
                 assert_eq!(
-                    subquery.offset,
-                    Some(Offset {
+                    subquery.offset_expr(),
+                    Some(&Offset {
                         value: Expr::value(number("2")),
                         rows: OffsetRows::Rows,
                     })
@@ -9359,8 +9351,6 @@ fn parse_merge() {
                         }))),
                         order_by: None,
                         limit: None,
-                        limit_by: vec![],
-                        offset: None,
                         fetch: None,
                         locks: vec![],
                         for_clause: None,
@@ -9681,14 +9671,14 @@ fn test_placeholder() {
     let sql = "SELECT * FROM student LIMIT $1 OFFSET $2";
     let ast = dialects.verified_query(sql);
     assert_eq!(
-        ast.limit,
-        Some(Expr::Value(
+        ast.limit_expr(),
+        Some(&Expr::Value(
             (Value::Placeholder("$1".into())).with_empty_span()
-        ))
+        )),
     );
     assert_eq!(
-        ast.offset,
-        Some(Offset {
+        ast.offset_expr(),
+        Some(&Offset {
             value: Expr::Value((Value::Placeholder("$2".into())).with_empty_span()),
             rows: OffsetRows::None,
         }),
@@ -9777,8 +9767,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!(ast.offset_expr(), expect.as_ref());
+    assert_eq!(ast.limit_expr(), Some(&Expr::value(number("1"))));
 
     // different order is OK
     one_statement_parses_to("SELECT foo FROM bar OFFSET 2 LIMIT 1", sql);
@@ -9790,22 +9780,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");
 
     // expressions are allowed
     let sql = "SELECT foo FROM bar LIMIT 1 + 2 OFFSET 3 * 4";
     let ast = verified_query(sql);
     assert_eq!(
-        ast.limit,
-        Some(Expr::BinaryOp {
+        ast.limit_expr(),
+        Some(&Expr::BinaryOp {
             left: Box::new(Expr::value(number("1"))),
             op: BinaryOperator::Plus,
             right: Box::new(Expr::value(number("2"))),
         }),
     );
     assert_eq!(
-        ast.offset,
-        Some(Offset {
+        ast.offset_expr(),
+        Some(&Offset {
             value: Expr::BinaryOp {
                 left: Box::new(Expr::value(number("3"))),
                 op: BinaryOperator::Multiply,
@@ -11228,8 +11218,6 @@ fn parse_unload() {
                 }))),
                 with: None,
                 limit: None,
-                limit_by: vec![],
-                offset: None,
                 fetch: None,
                 locks: vec![],
                 for_clause: None,
@@ -12401,8 +12389,6 @@ fn test_extract_seconds_ok() {
         }))),
         order_by: None,
         limit: None,
-        limit_by: vec![],
-        offset: None,
         fetch: None,
         locks: vec![],
         for_clause: None,
@@ -14266,10 +14252,8 @@ fn test_select_from_first() {
             }))),
             order_by: None,
             limit: None,
-            offset: None,
             fetch: None,
             locks: vec![],
-            limit_by: vec![],
             for_clause: None,
             settings: None,
             format_clause: None,
diff --git a/tmp/agent-patch-flux-pr-1765.1-of-1.2026-03-05__17-48-34__gpt-5-1-codex-mini/app/tests/sqlparser_mssql.rs b/app/tests/sqlparser_mssql.rs
index 386bd17..a18bebe 100644
--- a/tmp/agent-patch-flux-pr-1765.1-of-1.2026-03-05__17-48-34__gpt-5-1-codex-mini/app/tests/sqlparser_mssql.rs
+++ b/app/tests/sqlparser_mssql.rs
@@ -108,8 +108,6 @@ fn parse_create_procedure() {
             body: vec![Statement::Query(Box::new(Query {
                 with: None,
                 limit: None,
-                limit_by: vec![],
-                offset: None,
                 fetch: None,
                 locks: vec![],
                 for_clause: None,
@@ -1162,8 +1160,6 @@ fn parse_substring_in_select() {
                     }))),
                     order_by: None,
                     limit: None,
-                    limit_by: vec![],
-                    offset: None,
                     fetch: None,
                     locks: vec![],
                     for_clause: None,
@@ -1265,8 +1261,6 @@ fn parse_mssql_declare() {
             Statement::Query(Box::new(Query {
                 with: None,
                 limit: 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-03-05__17-48-34__gpt-5-1-codex-mini/app/tests/sqlparser_mysql.rs b/app/tests/sqlparser_mysql.rs
index 13a8a6c..a288456 100644
--- a/tmp/agent-patch-flux-pr-1765.1-of-1.2026-03-05__17-48-34__gpt-5-1-codex-mini/app/tests/sqlparser_mysql.rs
+++ b/app/tests/sqlparser_mysql.rs
@@ -1108,8 +1108,6 @@ fn parse_escaped_quote_identifiers_with_escape() {
             }))),
             order_by: None,
             limit: None,
-            limit_by: vec![],
-            offset: None,
             fetch: None,
             locks: vec![],
             for_clause: None,
@@ -1162,8 +1160,6 @@ fn parse_escaped_quote_identifiers_with_no_escape() {
             }))),
             order_by: None,
             limit: None,
-            limit_by: vec![],
-            offset: None,
             fetch: None,
             locks: vec![],
             for_clause: None,
@@ -1210,8 +1206,6 @@ fn parse_escaped_backticks_with_escape() {
             }))),
             order_by: None,
             limit: None,
-            limit_by: vec![],
-            offset: None,
             fetch: None,
             locks: vec![],
             for_clause: None,
@@ -1262,8 +1256,6 @@ fn parse_escaped_backticks_with_no_escape() {
             }))),
             order_by: None,
             limit: None,
-            limit_by: vec![],
-            offset: None,
             fetch: None,
             locks: vec![],
             for_clause: None,
@@ -1439,8 +1431,6 @@ fn parse_simple_insert() {
                     })),
                     order_by: None,
                     limit: None,
-                    limit_by: vec![],
-                    offset: None,
                     fetch: None,
                     locks: vec![],
                     for_clause: None,
@@ -1489,8 +1479,6 @@ fn parse_ignore_insert() {
                     })),
                     order_by: None,
                     limit: None,
-                    limit_by: vec![],
-                    offset: None,
                     fetch: None,
                     locks: vec![],
                     for_clause: None,
@@ -1539,8 +1527,6 @@ fn parse_priority_insert() {
                     })),
                     order_by: None,
                     limit: None,
-                    limit_by: vec![],
-                    offset: None,
                     fetch: None,
                     locks: vec![],
                     for_clause: None,
@@ -1586,8 +1572,6 @@ fn parse_priority_insert() {
                     })),
                     order_by: None,
                     limit: None,
-                    limit_by: vec![],
-                    offset: None,
                     fetch: None,
                     locks: vec![],
                     for_clause: None,
@@ -1635,8 +1619,6 @@ fn parse_insert_as() {
                     })),
                     order_by: None,
                     limit: None,
-                    limit_by: vec![],
-                    offset: None,
                     fetch: None,
                     locks: vec![],
                     for_clause: None,
@@ -1699,8 +1681,6 @@ fn parse_insert_as() {
                     })),
                     order_by: None,
                     limit: None,
-                    limit_by: vec![],
-                    offset: None,
                     fetch: None,
                     locks: vec![],
                     for_clause: None,
@@ -1750,8 +1730,6 @@ fn parse_replace_insert() {
                     })),
                     order_by: None,
                     limit: None,
-                    limit_by: vec![],
-                    offset: None,
                     fetch: None,
                     locks: vec![],
                     for_clause: None,
@@ -1792,8 +1770,6 @@ fn parse_empty_row_insert() {
                     })),
                     order_by: None,
                     limit: None,
-                    limit_by: vec![],
-                    offset: None,
                     fetch: None,
                     locks: vec![],
                     for_clause: None,
@@ -1858,8 +1834,6 @@ fn parse_insert_with_on_duplicate_update() {
                     })),
                     order_by: None,
                     limit: None,
-                    limit_by: vec![],
-                    offset: None,
                     fetch: None,
                     locks: vec![],
                     for_clause: None,
@@ -2597,8 +2571,6 @@ fn parse_substring_in_select() {
                     }))),
                     order_by: None,
                     limit: None,
-                    limit_by: vec![],
-                    offset: None,
                     fetch: None,
                     locks: vec![],
                     for_clause: None,
@@ -2739,7 +2711,7 @@ fn parse_set_names() {
 fn parse_limit_my_sql_syntax() {
     mysql_and_generic().one_statement_parses_to(
         "SELECT id, fname, lname FROM customer LIMIT 5, 10",
-        "SELECT id, fname, lname FROM customer LIMIT 10 OFFSET 5",
+        "SELECT id, fname, lname FROM customer LIMIT 5, 10",
     );
     mysql_and_generic().verified_stmt("SELECT * FROM user LIMIT ? OFFSET ?");
 }
@@ -2904,8 +2876,6 @@ fn parse_hex_string_introducer() {
             }))),
             order_by: None,
             limit: 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-03-05__17-48-34__gpt-5-1-codex-mini/app/tests/sqlparser_postgres.rs b/app/tests/sqlparser_postgres.rs
index a65c4fa..8d05a1e 100644
--- a/tmp/agent-patch-flux-pr-1765.1-of-1.2026-03-05__17-48-34__gpt-5-1-codex-mini/app/tests/sqlparser_postgres.rs
+++ b/app/tests/sqlparser_postgres.rs
@@ -1320,8 +1320,6 @@ fn parse_copy_to() {
                 }))),
                 order_by: None,
                 limit: None,
-                limit_by: vec![],
-                offset: None,
                 fetch: None,
                 locks: vec![],
                 for_clause: None,
@@ -2956,8 +2954,6 @@ fn parse_array_subquery_expr() {
                 }),
                 order_by: None,
                 limit: None,
-                limit_by: vec![],
-                offset: None,
                 fetch: None,
                 locks: vec![],
                 for_clause: None,
@@ -4748,8 +4744,6 @@ fn test_simple_postgres_insert_with_alias() {
                 })),
                 order_by: None,
                 limit: None,
-                limit_by: vec![],
-                offset: None,
                 fetch: None,
                 locks: vec![],
                 for_clause: None,
@@ -4821,8 +4815,6 @@ fn test_simple_postgres_insert_with_alias() {
                 })),
                 order_by: None,
                 limit: None,
-                limit_by: vec![],
-                offset: None,
                 fetch: None,
                 locks: vec![],
                 for_clause: None,
@@ -4892,8 +4884,6 @@ fn test_simple_insert_with_quoted_alias() {
                 })),
                 order_by: None,
                 limit: None,
-                limit_by: vec![],
-                offset: None,
                 fetch: None,
                 locks: vec![],
                 for_clause: None,