Skip to content

Commit 0e3263a

Browse files
Add dialect flags for NOT VALID and VALIDATE CONSTRAINT
1 parent 1bbc05c commit 0e3263a

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

src/dialect/mod.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1032,6 +1032,20 @@ pub trait Dialect: Debug + Any {
10321032
fn supports_space_separated_column_options(&self) -> bool {
10331033
false
10341034
}
1035+
1036+
/// Returns true if the dialect supports `ADD <table_constraint> [NOT VALID]` in `ALTER TABLE` statements.
1037+
///
1038+
/// -[PostgreSQL](https://www.postgresql.org/docs/17/sql-altertable.html)
1039+
fn supports_constraint_not_validation(&self) -> bool {
1040+
false
1041+
}
1042+
1043+
/// Returns true if the dialect supports `VALIDATE CONSTRAINT <constraint_name>` in `ALTER TABLE` statements.
1044+
///
1045+
/// -[PostgreSQL](https://www.postgresql.org/docs/17/sql-altertable.html)
1046+
fn supports_validate_constraint(&self) -> bool {
1047+
false
1048+
}
10351049
}
10361050

10371051
/// 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)