mirror of
https://github.com/apache/datafusion-sqlparser-rs.git
synced 2025-10-07 04:30:24 +00:00
Postgres: support ADD CONSTRAINT NOT VALID
and VALIDATE CONSTRAINT
(#1908)
This commit is contained in:
parent
015caca611
commit
418b94227a
7 changed files with 99 additions and 22 deletions
|
@ -8477,7 +8477,11 @@ impl<'a> Parser<'a> {
|
|||
pub fn parse_alter_table_operation(&mut self) -> Result<AlterTableOperation, ParserError> {
|
||||
let operation = if self.parse_keyword(Keyword::ADD) {
|
||||
if let Some(constraint) = self.parse_optional_table_constraint()? {
|
||||
AlterTableOperation::AddConstraint(constraint)
|
||||
let not_valid = self.parse_keywords(&[Keyword::NOT, Keyword::VALID]);
|
||||
AlterTableOperation::AddConstraint {
|
||||
constraint,
|
||||
not_valid,
|
||||
}
|
||||
} else if dialect_of!(self is ClickHouseDialect|GenericDialect)
|
||||
&& self.parse_keyword(Keyword::PROJECTION)
|
||||
{
|
||||
|
@ -8886,6 +8890,9 @@ impl<'a> Parser<'a> {
|
|||
};
|
||||
|
||||
AlterTableOperation::ReplicaIdentity { identity }
|
||||
} else if self.parse_keywords(&[Keyword::VALIDATE, Keyword::CONSTRAINT]) {
|
||||
let name = self.parse_identifier()?;
|
||||
AlterTableOperation::ValidateConstraint { name }
|
||||
} else {
|
||||
let options: Vec<SqlOption> =
|
||||
self.parse_options_with_keywords(&[Keyword::SET, Keyword::TBLPROPERTIES])?;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue