Skip to content

Commit

Permalink
Fix typo in Dialect::supports_eq_alias_assigment (#1478)
Browse files Browse the repository at this point in the history
  • Loading branch information
alamb authored Nov 6, 2024
1 parent e2197ee commit a9a9d58
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/dialect/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -582,7 +582,7 @@ pub trait Dialect: Debug + Any {
/// SELECT col_alias = col FROM tbl;
/// SELECT col_alias AS col FROM tbl;
/// ```
fn supports_eq_alias_assigment(&self) -> bool {
fn supports_eq_alias_assignment(&self) -> bool {
false
}

Expand Down
2 changes: 1 addition & 1 deletion src/dialect/mssql.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ impl Dialect for MsSqlDialect {
true
}

fn supports_eq_alias_assigment(&self) -> bool {
fn supports_eq_alias_assignment(&self) -> bool {
true
}

Expand Down
2 changes: 1 addition & 1 deletion src/parser/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11235,7 +11235,7 @@ impl<'a> Parser<'a> {
left,
op: BinaryOperator::Eq,
right,
} if self.dialect.supports_eq_alias_assigment()
} if self.dialect.supports_eq_alias_assignment()
&& matches!(left.as_ref(), Expr::Identifier(_)) =>
{
let Expr::Identifier(alias) = *left else {
Expand Down
4 changes: 2 additions & 2 deletions tests/sqlparser_common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11353,7 +11353,7 @@ fn test_any_some_all_comparison() {

#[test]
fn test_alias_equal_expr() {
let dialects = all_dialects_where(|d| d.supports_eq_alias_assigment());
let dialects = all_dialects_where(|d| d.supports_eq_alias_assignment());
let sql = r#"SELECT some_alias = some_column FROM some_table"#;
let expected = r#"SELECT some_column AS some_alias FROM some_table"#;
let _ = dialects.one_statement_parses_to(sql, expected);
Expand All @@ -11362,7 +11362,7 @@ fn test_alias_equal_expr() {
let expected = r#"SELECT (a * b) AS some_alias FROM some_table"#;
let _ = dialects.one_statement_parses_to(sql, expected);

let dialects = all_dialects_where(|d| !d.supports_eq_alias_assigment());
let dialects = all_dialects_where(|d| !d.supports_eq_alias_assignment());
let sql = r#"SELECT x = (a * b) FROM some_table"#;
let expected = r#"SELECT x = (a * b) FROM some_table"#;
let _ = dialects.one_statement_parses_to(sql, expected);
Expand Down

0 comments on commit a9a9d58

Please sign in to comment.