mirror of
https://github.com/apache/datafusion-sqlparser-rs.git
synced 2025-08-19 13:40:15 +00:00
extract operator: add support for Postgres keywords (#427)
Signed-off-by: Maciej Obuchowski <obuchowski.maciej@gmail.com>
This commit is contained in:
parent
0d1c5d1205
commit
3af3ca07b6
4 changed files with 88 additions and 0 deletions
|
|
@ -906,6 +906,21 @@ impl<'a> Parser<'a> {
|
|||
Keyword::HOUR => Ok(DateTimeField::Hour),
|
||||
Keyword::MINUTE => Ok(DateTimeField::Minute),
|
||||
Keyword::SECOND => Ok(DateTimeField::Second),
|
||||
Keyword::CENTURY => Ok(DateTimeField::Century),
|
||||
Keyword::DECADE => Ok(DateTimeField::Decade),
|
||||
Keyword::DOY => Ok(DateTimeField::Doy),
|
||||
Keyword::DOW => Ok(DateTimeField::Dow),
|
||||
Keyword::EPOCH => Ok(DateTimeField::Epoch),
|
||||
Keyword::ISODOW => Ok(DateTimeField::Isodow),
|
||||
Keyword::ISOYEAR => Ok(DateTimeField::Isoyear),
|
||||
Keyword::JULIAN => Ok(DateTimeField::Julian),
|
||||
Keyword::MICROSECONDS => Ok(DateTimeField::Microseconds),
|
||||
Keyword::MILLENIUM => Ok(DateTimeField::Millenium),
|
||||
Keyword::MILLISECONDS => Ok(DateTimeField::Milliseconds),
|
||||
Keyword::QUARTER => Ok(DateTimeField::Quarter),
|
||||
Keyword::TIMEZONE => Ok(DateTimeField::Timezone),
|
||||
Keyword::TIMEZONE_HOUR => Ok(DateTimeField::TimezoneHour),
|
||||
Keyword::TIMEZONE_MINUTE => Ok(DateTimeField::TimezoneMinute),
|
||||
_ => self.expected("date/time field", Token::Word(w))?,
|
||||
},
|
||||
unexpected => self.expected("date/time field", unexpected),
|
||||
|
|
@ -948,6 +963,21 @@ impl<'a> Parser<'a> {
|
|||
Keyword::HOUR,
|
||||
Keyword::MINUTE,
|
||||
Keyword::SECOND,
|
||||
Keyword::CENTURY,
|
||||
Keyword::DECADE,
|
||||
Keyword::DOW,
|
||||
Keyword::DOY,
|
||||
Keyword::EPOCH,
|
||||
Keyword::ISODOW,
|
||||
Keyword::ISOYEAR,
|
||||
Keyword::JULIAN,
|
||||
Keyword::MICROSECONDS,
|
||||
Keyword::MILLENIUM,
|
||||
Keyword::MILLISECONDS,
|
||||
Keyword::QUARTER,
|
||||
Keyword::TIMEZONE,
|
||||
Keyword::TIMEZONE_HOUR,
|
||||
Keyword::TIMEZONE_MINUTE,
|
||||
]
|
||||
.iter()
|
||||
.any(|d| kw.keyword == *d) =>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue