agent_patch
runs/2026-02-21__03-36-16__gpt-5-1-codex-mini/flux-pr-1576/flux-pr-1576.1-of-1.2026-02-21__03-36-16__gpt-5-1-codex-mini/agent-logs/agent.patch
5778 bytes
diff --git a/tmp/agent-patch-flux-pr-1576.1-of-1.2026-02-21__03-36-16__gpt-5-1-codex-mini/app/src/dialect/mod.rs b/app/src/dialect/mod.rs
index 8cce6a3..b72dd15 100644
--- a/tmp/agent-patch-flux-pr-1576.1-of-1.2026-02-21__03-36-16__gpt-5-1-codex-mini/app/src/dialect/mod.rs
+++ b/app/src/dialect/mod.rs
@@ -138,6 +138,13 @@ pub trait Dialect: Debug + Any {
true
}
+ /// Determine if the dialect recognizes nested bracket-delimited identifiers such as `["foo"]`.
+ ///
+ /// The default implementation assumes nested bracket quoting is not supported.
+ fn is_nested_delimited_identifier_start(&self, mut _chars: Peekable<Chars<'_>>) -> bool {
+ false
+ }
+
/// Determine if a character is a valid start character for an unquoted identifier
fn is_identifier_start(&self, ch: char) -> bool;
diff --git a/tmp/agent-patch-flux-pr-1576.1-of-1.2026-02-21__03-36-16__gpt-5-1-codex-mini/app/src/dialect/redshift.rs b/app/src/dialect/redshift.rs
index 48eb00a..909fca7 100644
--- a/tmp/agent-patch-flux-pr-1576.1-of-1.2026-02-21__03-36-16__gpt-5-1-codex-mini/app/src/dialect/redshift.rs
+++ b/app/src/dialect/redshift.rs
@@ -49,6 +49,18 @@ impl Dialect for RedshiftSqlDialect {
false
}
+ fn is_nested_delimited_identifier_start(&self, mut chars: Peekable<Chars<'_>>) -> bool {
+ chars.next(); // consume '['
+ while let Some(&ch) = chars.peek() {
+ if ch.is_whitespace() {
+ chars.next();
+ } else {
+ break;
+ }
+ }
+ matches!(chars.peek(), Some('"'))
+ }
+
fn is_identifier_start(&self, ch: char) -> bool {
// Extends Postgres dialect with sharp
PostgreSqlDialect {}.is_identifier_start(ch) || ch == '#'
diff --git a/tmp/agent-patch-flux-pr-1576.1-of-1.2026-02-21__03-36-16__gpt-5-1-codex-mini/app/src/tokenizer.rs b/app/src/tokenizer.rs
index aacfc16..52a23db 100644
--- a/tmp/agent-patch-flux-pr-1576.1-of-1.2026-02-21__03-36-16__gpt-5-1-codex-mini/app/src/tokenizer.rs
+++ b/app/src/tokenizer.rs
@@ -1092,9 +1092,45 @@ impl<'a> Tokenizer<'a> {
self.tokenizer_error(
error_loc,
format!("Expected close delimiter '{quote_end}' before EOF."),
- )
+)
}
}
+ '[' if self
+ .dialect
+ .is_nested_delimited_identifier_start(chars.peekable.clone()) =>
+ {
+ let error_loc = chars.location();
+ chars.next(); // consume '['
+ while matches!(chars.peek(), Some(ch) if ch.is_whitespace()) {
+ chars.next();
+ }
+ if chars.peek() != Some(&'\"') {
+ return self.tokenizer_error(
+ error_loc,
+ "Expected '\"' after '[' for nested identifier",
+ );
+ }
+ chars.next(); // consume opening '"'
+ let (s, last_char) = self.parse_quoted_ident(chars, '\"');
+ if last_char != Some('\"') {
+ return self.tokenizer_error(
+ error_loc,
+ "Expected closing '\"' for nested identifier",
+ );
+ }
+ while matches!(chars.peek(), Some(ch) if ch.is_whitespace()) {
+ chars.next();
+ }
+ if chars.peek() != Some(&']') {
+ return self.tokenizer_error(
+ error_loc,
+ "Expected closing ']' for nested identifier",
+ );
+ }
+ chars.next(); // consume closing ']'
+
+ Ok(Some(Token::make_word(&s, Some('['))))
+ }
// numbers and period
'0'..='9' | '.' => {
let mut s = peeking_take_while(chars, |ch| ch.is_ascii_digit());
diff --git a/tmp/agent-patch-flux-pr-1576.1-of-1.2026-02-21__03-36-16__gpt-5-1-codex-mini/app/tests/sqlparser_redshift.rs b/app/tests/sqlparser_redshift.rs
index 9492946..4cb0c00 100644
--- a/tmp/agent-patch-flux-pr-1576.1-of-1.2026-02-21__03-36-16__gpt-5-1-codex-mini/app/tests/sqlparser_redshift.rs
+++ b/app/tests/sqlparser_redshift.rs
@@ -56,6 +56,37 @@ fn test_square_brackets_over_db_schema_table_name() {
);
}
+#[test]
+fn test_nested_double_quotes_inside_square_brackets() {
+ let select = redshift().verified_only_select(r#"SELECT ["col1"] FROM ["test_schema"].["test_table"]"#);
+ assert_eq!(
+ select.projection[0],
+ SelectItem::UnnamedExpr(Expr::Identifier(Ident {
+ value: "col1".to_string(),
+ quote_style: Some('['),
+ span: Span::empty(),
+ })),
+ );
+ assert_eq!(
+ select.from[0],
+ TableWithJoins {
+ relation: table_from_name(ObjectName(vec![
+ Ident {
+ value: "test_schema".to_string(),
+ quote_style: Some('['),
+ span: Span::empty(),
+ },
+ Ident {
+ value: "test_table".to_string(),
+ quote_style: Some('['),
+ span: Span::empty(),
+ }
+ ])),
+ joins: vec![],
+ }
+ );
+}
+
#[test]
fn brackets_over_db_schema_table_name_with_whites_paces() {
match redshift().parse_sql_statements("SELECT [ col1 ] FROM [ test_schema].[ test_table]") {