mirror of
https://github.com/apache/datafusion-sqlparser-rs.git
synced 2025-08-19 13:40:15 +00:00
feat: Parse special keywords as functions (current_user, user, etc) (#561)
* feat: Parse special keywors as functions (current_user, user, etc) * explain special field
This commit is contained in:
parent
b6e36ad760
commit
54a29e872d
6 changed files with 111 additions and 17 deletions
|
@ -421,6 +421,20 @@ impl<'a> Parser<'a> {
|
|||
self.prev_token();
|
||||
Ok(Expr::Value(self.parse_value()?))
|
||||
}
|
||||
Keyword::CURRENT_CATALOG
|
||||
| Keyword::CURRENT_USER
|
||||
| Keyword::SESSION_USER
|
||||
| Keyword::USER
|
||||
if dialect_of!(self is PostgreSqlDialect | GenericDialect) =>
|
||||
{
|
||||
Ok(Expr::Function(Function {
|
||||
name: ObjectName(vec![w.to_ident()]),
|
||||
args: vec![],
|
||||
over: None,
|
||||
distinct: false,
|
||||
special: true,
|
||||
}))
|
||||
}
|
||||
Keyword::CURRENT_TIMESTAMP | Keyword::CURRENT_TIME | Keyword::CURRENT_DATE => {
|
||||
self.parse_time_functions(ObjectName(vec![w.to_ident()]))
|
||||
}
|
||||
|
@ -598,6 +612,7 @@ impl<'a> Parser<'a> {
|
|||
args,
|
||||
over,
|
||||
distinct,
|
||||
special: false,
|
||||
}))
|
||||
}
|
||||
|
||||
|
@ -612,6 +627,7 @@ impl<'a> Parser<'a> {
|
|||
args,
|
||||
over: None,
|
||||
distinct: false,
|
||||
special: false,
|
||||
}))
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue