Fix AS query clause should be after the create table options (#1339)

This commit is contained in:
hulk 2024-07-16 01:54:44 +08:00 committed by GitHub
parent 993216f3ac
commit 20f7ac59e3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 61 additions and 10 deletions

View file

@ -5418,13 +5418,6 @@ impl<'a> Parser<'a> {
let create_table_config = self.parse_optional_create_table_config()?;
// Parse optional `AS ( query )`
let query = if self.parse_keyword(Keyword::AS) {
Some(self.parse_boxed_query()?)
} else {
None
};
let default_charset = if self.parse_keywords(&[Keyword::DEFAULT, Keyword::CHARSET]) {
self.expect_token(&Token::Eq)?;
let next_token = self.next_token();
@ -5477,6 +5470,13 @@ impl<'a> Parser<'a> {
None
};
// Parse optional `AS ( query )`
let query = if self.parse_keyword(Keyword::AS) {
Some(self.parse_boxed_query()?)
} else {
None
};
Ok(CreateTableBuilder::new(table_name)
.temporary(temporary)
.columns(columns)