add SELECT INTO statement variation (#447)

Signed-off-by: Maciej Obuchowski <obuchowski.maciej@gmail.com>
This commit is contained in:
Maciej Obuchowski 2022-03-30 22:01:55 +02:00 committed by GitHub
parent b68e9a3801
commit d38c30e9ff
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 74 additions and 2 deletions

View file

@ -2892,6 +2892,21 @@ impl<'a> Parser<'a> {
let projection = self.parse_comma_separated(Parser::parse_select_item)?;
let into = if self.parse_keyword(Keyword::INTO) {
let temporary = self
.parse_one_of_keywords(&[Keyword::TEMP, Keyword::TEMPORARY])
.is_some();
let unlogged = self.parse_keyword(Keyword::UNLOGGED);
let name = self.parse_object_name()?;
Some(SelectInto {
temporary,
unlogged,
name,
})
} else {
None
};
// Note that for keywords to be properly handled here, they need to be
// added to `RESERVED_FOR_COLUMN_ALIAS` / `RESERVED_FOR_TABLE_ALIAS`,
// otherwise they may be parsed as an alias as part of the `projection`
@ -2973,6 +2988,7 @@ impl<'a> Parser<'a> {
distinct,
top,
projection,
into,
from,
lateral_views,
selection,