File tree Expand file tree Collapse file tree 5 files changed +16
-2
lines changed
Expand file tree Collapse file tree 5 files changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -347,6 +347,10 @@ pub enum AlterTableOperation {
347347 equals : bool ,
348348 value : ValueWithSpan ,
349349 } ,
350+ /// `VALIDATE CONSTRAINT <name>`
351+ ValidateConstraint {
352+ name : Ident ,
353+ } ,
350354}
351355
352356/// An `ALTER Policy` (`Statement::AlterPolicy`) operation
@@ -784,6 +788,9 @@ impl fmt::Display for AlterTableOperation {
784788 AlterTableOperation :: ReplicaIdentity { identity } => {
785789 write ! ( f, "REPLICA IDENTITY {identity}" )
786790 }
791+ AlterTableOperation :: ValidateConstraint { name } => {
792+ write ! ( f, "VALIDATE CONSTRAINT {name}" )
793+ }
787794 }
788795 }
789796}
Original file line number Diff line number Diff line change @@ -1198,6 +1198,7 @@ impl Spanned for AlterTableOperation {
11981198 AlterTableOperation :: AutoIncrement { value, .. } => value. span ( ) ,
11991199 AlterTableOperation :: Lock { .. } => Span :: empty ( ) ,
12001200 AlterTableOperation :: ReplicaIdentity { .. } => Span :: empty ( ) ,
1201+ AlterTableOperation :: ValidateConstraint { name } => name. span ,
12011202 }
12021203 }
12031204}
Original file line number Diff line number Diff line change @@ -1035,14 +1035,14 @@ pub trait Dialect: Debug + Any {
10351035
10361036 /// Returns true if the dialect supports `ADD <table_constraint> [NOT VALID]` in `ALTER TABLE` statements.
10371037 ///
1038- /// -[PostgreSQL](https://www.postgresql.org/docs/17/sql-altertable.html)
1038+ /// - [PostgreSQL](https://www.postgresql.org/docs/17/sql-altertable.html)
10391039 fn supports_constraint_not_valid ( & self ) -> bool {
10401040 false
10411041 }
10421042
10431043 /// Returns true if the dialect supports `VALIDATE CONSTRAINT <constraint_name>` in `ALTER TABLE` statements.
10441044 ///
1045- /// -[PostgreSQL](https://www.postgresql.org/docs/17/sql-altertable.html)
1045+ /// - [PostgreSQL](https://www.postgresql.org/docs/17/sql-altertable.html)
10461046 fn supports_validate_constraint ( & self ) -> bool {
10471047 false
10481048 }
Original file line number Diff line number Diff line change @@ -980,6 +980,7 @@ define_keywords!(
980980 UUID ,
981981 VACUUM ,
982982 VALID ,
983+ VALIDATE ,
983984 VALIDATION_MODE ,
984985 VALUE ,
985986 VALUES ,
Original file line number Diff line number Diff line change @@ -8899,6 +8899,11 @@ impl<'a> Parser<'a> {
88998899 };
89008900
89018901 AlterTableOperation::ReplicaIdentity { identity }
8902+ } else if self.parse_keywords(&[Keyword::VALIDATE, Keyword::CONSTRAINT])
8903+ && self.dialect.supports_validate_constraint()
8904+ {
8905+ let name = self.parse_identifier()?;
8906+ AlterTableOperation::ValidateConstraint { name }
89028907 } else {
89038908 let options: Vec<SqlOption> =
89048909 self.parse_options_with_keywords(&[Keyword::SET, Keyword::TBLPROPERTIES])?;
You can’t perform that action at this time.
0 commit comments