Postgres: Support parenthesized SET options for ALTER TABLE (#1947)

Co-authored-by: Ifeanyi Ubah <ify1992@yahoo.com>
This commit is contained in:
carl 2025-07-23 11:53:17 -04:00 committed by GitHub
parent 2ed2cbe291
commit f49c30feb6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 53 additions and 4 deletions

View file

@ -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)