Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix typo in Dialect::supports_eq_alias_assigment #1478

Merged
merged 1 commit into from
Nov 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -11209,7 +11209,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 @@ -11435,7 +11435,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 @@ -11444,7 +11444,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
Loading