mirror of
https://github.com/apache/datafusion-sqlparser-rs.git
synced 2025-10-07 12:40:22 +00:00
Postgres: Support parenthesized SET
options for ALTER TABLE
(#1947)
Co-authored-by: Ifeanyi Ubah <ify1992@yahoo.com>
This commit is contained in:
parent
2ed2cbe291
commit
f49c30feb6
4 changed files with 53 additions and 4 deletions
|
@ -9045,17 +9045,22 @@ impl<'a> Parser<'a> {
|
|||
let name = self.parse_identifier()?;
|
||||
AlterTableOperation::ValidateConstraint { name }
|
||||
} else {
|
||||
let options: Vec<SqlOption> =
|
||||
let mut options =
|
||||
self.parse_options_with_keywords(&[Keyword::SET, Keyword::TBLPROPERTIES])?;
|
||||
if !options.is_empty() {
|
||||
AlterTableOperation::SetTblProperties {
|
||||
table_properties: options,
|
||||
}
|
||||
} else {
|
||||
return self.expected(
|
||||
"ADD, RENAME, PARTITION, SWAP, DROP, REPLICA IDENTITY, or SET TBLPROPERTIES after ALTER TABLE",
|
||||
options = self.parse_options(Keyword::SET)?;
|
||||
if !options.is_empty() {
|
||||
AlterTableOperation::SetOptionsParens { options }
|
||||
} else {
|
||||
return self.expected(
|
||||
"ADD, RENAME, PARTITION, SWAP, DROP, REPLICA IDENTITY, SET, or SET TBLPROPERTIES after ALTER TABLE",
|
||||
self.peek_token(),
|
||||
);
|
||||
);
|
||||
}
|
||||
}
|
||||
};
|
||||
Ok(operation)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue