Skip to content

Commit

Permalink
fix(postgre): correctly count number of constraints
Browse files Browse the repository at this point in the history
When multiple fields are provided the existing query gives the cound which is greater than 1. This later causes a new constraint creation. This in it's turn is cannot be run in concurrent environment.
  • Loading branch information
MaximBalaganskiy authored Mar 4, 2024
1 parent ec3c545 commit 140e8e7
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ public static string CountUniqueConstrain(TableInfo tableInfo)
bool usePG_Catalog = true; // PG_Catalog used instead of Information_Schema
if (usePG_Catalog)
{
q = @"SELECT COUNT(*)
q = @"SELECT COUNT(distinct c.conname)
FROM pg_catalog.pg_namespace nr,
pg_catalog.pg_class r,
pg_catalog.pg_attribute a,
Expand Down

0 comments on commit 140e8e7

Please sign in to comment.