diff --git a/src/postgres/discovery/mod.rs b/src/postgres/discovery/mod.rs index 69ee13c4..9e191d70 100644 --- a/src/postgres/discovery/mod.rs +++ b/src/postgres/discovery/mod.rs @@ -171,7 +171,7 @@ impl SchemaDiscovery { .executor .fetch_all( self.query - .query_table_constraints(schema.clone(), table.clone()), + .query_table_constriants(schema.clone(), table.clone()), ) .await?; diff --git a/src/postgres/query/constraints/mod.rs b/src/postgres/query/constraints/mod.rs index fdc53ad7..c609b604 100644 --- a/src/postgres/query/constraints/mod.rs +++ b/src/postgres/query/constraints/mod.rs @@ -44,7 +44,7 @@ pub struct TableConstraintsQueryResult { } impl SchemaQueryBuilder { - pub fn query_table_constraints( + pub fn query_table_constriants( &self, schema: SeaRc, table: SeaRc, @@ -197,13 +197,9 @@ impl SchemaQueryBuilder { Expr::col((Schema::TableConstraints, Tcf::TableSchema)).eq(schema.to_string()), ) .and_where(Expr::col((Schema::TableConstraints, Tcf::TableName)).eq(table.to_string())) - .cond_where( - Condition::any() - .add(Expr::col((rcsq.clone(), Kcuf::TableName)).is_null()) - .add( - Expr::col((rcsq.clone(), Kcuf::TableName)) - .not_in_subquery(select_base_table_and_view()), - ), + .and_where( + Expr::col((rcsq.clone(), Kcuf::TableName)) + .not_in_subquery(select_base_table_and_view()), ) .order_by((Schema::TableConstraints, Tcf::ConstraintName), Order::Asc) .order_by((Schema::KeyColumnUsage, Kcuf::OrdinalPosition), Order::Asc)