agent_patch
runs/2026-02-21__03-36-16__gpt-5-1-codex-mini/flux-pr-1441/flux-pr-1441.1-of-1.2026-02-21__03-36-16__gpt-5-1-codex-mini/agent-logs/agent.patch
8598 bytes
diff --git a/tmp/agent-patch-flux-pr-1441.1-of-1.2026-02-21__03-36-16__gpt-5-1-codex-mini/app/src/ast/ddl.rs b/app/src/ast/ddl.rs
index 4578ae8..449b5ff 100644
--- a/tmp/agent-patch-flux-pr-1441.1-of-1.2026-02-21__03-36-16__gpt-5-1-codex-mini/app/src/ast/ddl.rs
+++ b/app/src/ast/ddl.rs
@@ -30,8 +30,9 @@ use sqlparser_derive::{Visit, VisitMut};
use crate::ast::value::escape_single_quote_string;
use crate::ast::{
- display_comma_separated, display_separated, DataType, Expr, Ident, MySQLColumnPosition,
- ObjectName, OrderByExpr, ProjectionSelect, SequenceOptions, SqlOption, Value,
+ display_comma_separated, display_separated, CommentDef, DataType, Expr, Ident,
+ MySQLColumnPosition, ObjectName, OrderByExpr, ProjectionSelect, SequenceOptions,
+ SqlOption, Value,
};
use crate::tokenizer::Token;
@@ -1049,6 +1050,7 @@ pub struct ViewColumnDef {
pub name: Ident,
pub data_type: Option<DataType>,
pub options: Option<Vec<SqlOption>>,
+ pub comment: Option<CommentDef>,
}
impl fmt::Display for ViewColumnDef {
@@ -1064,6 +1066,17 @@ impl fmt::Display for ViewColumnDef {
display_comma_separated(options.as_slice())
)?;
}
+ if let Some(comment) = self.comment.as_ref() {
+ match comment {
+ CommentDef::WithEq(text) => {
+ write!(f, " COMMENT = '{}'", escape_single_quote_string(text))?
+ }
+ CommentDef::WithoutEq(text)
+ | CommentDef::AfterColumnDefsWithoutEq(text) => {
+ write!(f, " COMMENT '{}'", escape_single_quote_string(text))?
+ }
+ }
+ }
Ok(())
}
}
diff --git a/tmp/agent-patch-flux-pr-1441.1-of-1.2026-02-21__03-36-16__gpt-5-1-codex-mini/app/src/ast/mod.rs b/app/src/ast/mod.rs
index 8c4bc25..aee18d4 100644
--- a/tmp/agent-patch-flux-pr-1441.1-of-1.2026-02-21__03-36-16__gpt-5-1-codex-mini/app/src/ast/mod.rs
+++ b/app/src/ast/mod.rs
@@ -3930,13 +3930,6 @@ impl fmt::Display for Statement {
.map(|to| format!(" TO {to}"))
.unwrap_or_default()
)?;
- if let Some(comment) = comment {
- write!(
- f,
- " COMMENT = '{}'",
- value::escape_single_quote_string(comment)
- )?;
- }
if matches!(options, CreateTableOptions::With(_)) {
write!(f, " {options}")?;
}
@@ -3949,6 +3942,13 @@ impl fmt::Display for Statement {
if matches!(options, CreateTableOptions::Options(_)) {
write!(f, " {options}")?;
}
+ if let Some(comment) = comment {
+ write!(
+ f,
+ " COMMENT = '{}'",
+ value::escape_single_quote_string(comment)
+ )?;
+ }
write!(f, " AS {query}")?;
if *with_no_schema_binding {
write!(f, " WITH NO SCHEMA BINDING")?;
diff --git a/tmp/agent-patch-flux-pr-1441.1-of-1.2026-02-21__03-36-16__gpt-5-1-codex-mini/app/src/parser/mod.rs b/app/src/parser/mod.rs
index 88c3bd1..8336e2f 100644
--- a/tmp/agent-patch-flux-pr-1441.1-of-1.2026-02-21__03-36-16__gpt-5-1-codex-mini/app/src/parser/mod.rs
+++ b/app/src/parser/mod.rs
@@ -8374,10 +8374,19 @@ impl<'a> Parser<'a> {
} else {
None
};
+ let comment = if dialect_of!(self is SnowflakeDialect)
+ && self.parse_keyword(Keyword::COMMENT)
+ {
+ self.prev_token();
+ self.parse_optional_inline_comment()?
+ } else {
+ None
+ };
Ok(ViewColumnDef {
name,
data_type,
options,
+ comment,
})
}
diff --git a/tmp/agent-patch-flux-pr-1441.1-of-1.2026-02-21__03-36-16__gpt-5-1-codex-mini/app/tests/sqlparser_bigquery.rs b/app/tests/sqlparser_bigquery.rs
index 55afe47..873422f 100644
--- a/tmp/agent-patch-flux-pr-1441.1-of-1.2026-02-21__03-36-16__gpt-5-1-codex-mini/app/tests/sqlparser_bigquery.rs
+++ b/app/tests/sqlparser_bigquery.rs
@@ -268,6 +268,7 @@ fn parse_create_view_with_options() {
name: Ident::new("name"),
data_type: None,
options: None,
+ comment: None,
},
ViewColumnDef {
name: Ident::new("age"),
@@ -275,7 +276,8 @@ fn parse_create_view_with_options() {
options: Some(vec![SqlOption::KeyValue {
key: Ident::new("description"),
value: Expr::Value(Value::DoubleQuotedString("field age".to_string())),
- }])
+ }]),
+ comment: None,
},
],
columns
diff --git a/tmp/agent-patch-flux-pr-1441.1-of-1.2026-02-21__03-36-16__gpt-5-1-codex-mini/app/tests/sqlparser_clickhouse.rs b/app/tests/sqlparser_clickhouse.rs
index e30c336..6cc3091 100644
--- a/tmp/agent-patch-flux-pr-1441.1-of-1.2026-02-21__03-36-16__gpt-5-1-codex-mini/app/tests/sqlparser_clickhouse.rs
+++ b/app/tests/sqlparser_clickhouse.rs
@@ -904,7 +904,8 @@ fn parse_create_view_with_fields_data_types() {
}]),
vec![]
)),
- options: None
+ options: None,
+ comment: None,
},
ViewColumnDef {
name: "f".into(),
@@ -915,7 +916,8 @@ fn parse_create_view_with_fields_data_types() {
}]),
vec![]
)),
- options: None
+ options: None,
+ comment: None,
},
]
);
diff --git a/tmp/agent-patch-flux-pr-1441.1-of-1.2026-02-21__03-36-16__gpt-5-1-codex-mini/app/tests/sqlparser_common.rs b/app/tests/sqlparser_common.rs
index 5d5a17c..8761f9d 100644
--- a/tmp/agent-patch-flux-pr-1441.1-of-1.2026-02-21__03-36-16__gpt-5-1-codex-mini/app/tests/sqlparser_common.rs
+++ b/app/tests/sqlparser_common.rs
@@ -6867,7 +6867,8 @@ fn parse_create_view_with_columns() {
.map(|name| ViewColumnDef {
name,
data_type: None,
- options: None
+ options: None,
+ comment: None,
})
.collect::<Vec<_>>()
);
diff --git a/tmp/agent-patch-flux-pr-1441.1-of-1.2026-02-21__03-36-16__gpt-5-1-codex-mini/app/tests/sqlparser_snowflake.rs b/app/tests/sqlparser_snowflake.rs
index 50c5f74..4593b36 100644
--- a/tmp/agent-patch-flux-pr-1441.1-of-1.2026-02-21__03-36-16__gpt-5-1-codex-mini/app/tests/sqlparser_snowflake.rs
+++ b/app/tests/sqlparser_snowflake.rs
@@ -576,6 +576,39 @@ fn parse_sf_create_or_replace_with_comment_for_snowflake() {
}
}
+#[test]
+fn parse_sf_view_column_comment() {
+ let sql = "CREATE OR REPLACE VIEW v (col COMMENT 'details') AS SELECT 1";
+ match snowflake().verified_stmt(sql) {
+ Statement::CreateView { columns, .. } => {
+ assert_eq!(
+ columns,
+ vec![ViewColumnDef {
+ name: Ident::new("col"),
+ data_type: None,
+ options: None,
+ comment: Some(CommentDef::WithoutEq("details".into())),
+ }]
+ );
+ }
+ _ => unreachable!(),
+ }
+}
+
+#[test]
+fn display_sf_view_columns_options_before_comment() {
+ let sql = concat!(
+ "CREATE OR REPLACE VIEW v WITH (tag = 'alpha') (col, other) OPTIONS(description = 'meta') ",
+ "COMMENT = 'view comment' AS SELECT 1"
+ );
+ let expected = concat!(
+ "CREATE OR REPLACE VIEW v WITH (tag = 'alpha') (col, other) OPTIONS(description = 'meta') ",
+ "COMMENT = 'view comment' AS SELECT 1"
+ );
+ let parsed = snowflake().verified_stmt(sql);
+ assert_eq!(expected, parsed.to_string());
+}
+
#[test]
fn test_sf_derived_table_in_parenthesis() {
// Nesting a subquery in an extra set of parentheses is non-standard,