Skip to content

Commit aa97b73

Browse files
Add dialect flags for NOT VALID and VALIDATE CONSTRAINT
1 parent abd80f9 commit aa97b73

2 files changed

Lines changed: 22 additions & 0 deletions

File tree

src/dialect/mod.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1060,6 +1060,20 @@ pub trait Dialect: Debug + Any {
10601060
fn supports_space_separated_column_options(&self) -> bool {
10611061
false
10621062
}
1063+
1064+
/// Returns true if the dialect supports `ADD <table_constraint> [NOT VALID]` in `ALTER TABLE` statements.
1065+
///
1066+
/// -[PostgreSQL](https://www.postgresql.org/docs/17/sql-altertable.html)
1067+
fn supports_constraint_not_validation(&self) -> bool {
1068+
false
1069+
}
1070+
1071+
/// Returns true if the dialect supports `VALIDATE CONSTRAINT <constraint_name>` in `ALTER TABLE` statements.
1072+
///
1073+
/// -[PostgreSQL](https://www.postgresql.org/docs/17/sql-altertable.html)
1074+
fn supports_validate_constraint(&self) -> bool {
1075+
false
1076+
}
10631077
}
10641078

10651079
/// This represents the operators for which precedence must be defined

src/dialect/postgresql.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,4 +258,12 @@ impl Dialect for PostgreSqlDialect {
258258
fn supports_set_names(&self) -> bool {
259259
true
260260
}
261+
262+
fn supports_constraint_not_validation(&self) -> bool {
263+
true
264+
}
265+
266+
fn supports_validate_constraint(&self) -> bool {
267+
true
268+
}
261269
}

0 commit comments

Comments
 (0)