Skip to content

Commit e61ab4b

Browse files
committed
Restore GO as column alias
- these tests were disabled during rebase due to other branches that had been merged
1 parent 98de54a commit e61ab4b

2 files changed

Lines changed: 25 additions & 26 deletions

File tree

src/dialect/mssql.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,6 @@ impl Dialect for MsSqlDialect {
156156
| Keyword::PRINT
157157
| Keyword::WHILE
158158
| Keyword::RETURN
159-
| Keyword::GO
160159
| Keyword::THROW
161160
| Keyword::RAISERROR
162161
| Keyword::MERGE => false,

tests/sqlparser_mssql.rs

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -2918,31 +2918,31 @@ fn parse_mssql_go_keyword() {
29182918
ms().statements_parse_to(single_line_comment_following_go, 2, "USE some_database\nGO");
29192919
assert_eq!(stmts[1], Statement::Go(GoStatement { count: None }));
29202920

2921-
// let actually_column_alias = "SELECT NULL AS GO";
2922-
// let stmt = ms().verified_only_select(actually_column_alias);
2923-
// assert_eq!(
2924-
// only(stmt.projection),
2925-
// SelectItem::ExprWithAlias {
2926-
// expr: Expr::Value(Value::Null.with_empty_span()),
2927-
// alias: Ident::new("GO"),
2928-
// }
2929-
// );
2930-
2931-
// let actually_column_alias = "SELECT NULL GO";
2932-
// let stmt = ms().one_statement_parses_to(actually_column_alias, "SELECT NULL AS GO");
2933-
// match &stmt {
2934-
// Statement::Query(query) => {
2935-
// let select = query.body.as_select().unwrap();
2936-
// assert_eq!(
2937-
// only(select.clone().projection),
2938-
// SelectItem::ExprWithAlias {
2939-
// expr: Expr::Value(Value::Null.with_empty_span()),
2940-
// alias: Ident::new("GO"),
2941-
// }
2942-
// );
2943-
// }
2944-
// _ => panic!("Expected Query statement"),
2945-
// }
2921+
let actually_column_alias = "SELECT NULL AS GO";
2922+
let stmt = ms().verified_only_select(actually_column_alias);
2923+
assert_eq!(
2924+
only(stmt.projection),
2925+
SelectItem::ExprWithAlias {
2926+
expr: Expr::Value(Value::Null.with_empty_span()),
2927+
alias: Ident::new("GO"),
2928+
}
2929+
);
2930+
2931+
let actually_column_alias = "SELECT NULL GO";
2932+
let stmt = ms().one_statement_parses_to(actually_column_alias, "SELECT NULL AS GO");
2933+
match &stmt {
2934+
Statement::Query(query) => {
2935+
let select = query.body.as_select().unwrap();
2936+
assert_eq!(
2937+
only(select.clone().projection),
2938+
SelectItem::ExprWithAlias {
2939+
expr: Expr::Value(Value::Null.with_empty_span()),
2940+
alias: Ident::new("GO"),
2941+
}
2942+
);
2943+
}
2944+
_ => panic!("Expected Query statement"),
2945+
}
29462946

29472947
let cte_following_go = "USE some_database;\nGO\n;WITH cte AS (\nSELECT 1 x\n)\nSELECT * FROM cte;";
29482948
let stmts = ms().parse_sql_statements(cte_following_go).unwrap();

0 commit comments

Comments
 (0)