mirror of
https://github.com/apache/datafusion-sqlparser-rs.git
synced 2025-12-23 11:12:51 +00:00
Add support for parsing MsSql alias with equals (#1467)
This commit is contained in:
parent
7c20d4ae1f
commit
1dd7d26fbb
4 changed files with 50 additions and 0 deletions
|
|
@ -11181,6 +11181,24 @@ impl<'a> Parser<'a> {
|
|||
self.peek_token().location
|
||||
)
|
||||
}
|
||||
Expr::BinaryOp {
|
||||
left,
|
||||
op: BinaryOperator::Eq,
|
||||
right,
|
||||
} if self.dialect.supports_eq_alias_assigment()
|
||||
&& matches!(left.as_ref(), Expr::Identifier(_)) =>
|
||||
{
|
||||
let Expr::Identifier(alias) = *left else {
|
||||
return parser_err!(
|
||||
"BUG: expected identifier expression as alias",
|
||||
self.peek_token().location
|
||||
);
|
||||
};
|
||||
Ok(SelectItem::ExprWithAlias {
|
||||
expr: *right,
|
||||
alias,
|
||||
})
|
||||
}
|
||||
expr => self
|
||||
.parse_optional_alias(keywords::RESERVED_FOR_COLUMN_ALIAS)
|
||||
.map(|alias| match alias {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue