fix(system-api): use distinct in intances filter query (#6867)

This commit is contained in:
Tim Möhlmann 2023-11-07 08:12:16 +02:00 committed by GitHub
parent f3b8a3aece
commit b3ff359fc1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View File

@ -291,7 +291,7 @@ func prepareInstancesQuery(ctx context.Context, db prepareDatabase) (sq.SelectBu
return sq.Select( return sq.Select(
InstanceColumnID.identifier(), InstanceColumnID.identifier(),
countColumn.identifier(), countColumn.identifier(),
).From(instanceTable.identifier()). ).Distinct().From(instanceTable.identifier()).
LeftJoin(join(InstanceDomainInstanceIDCol, InstanceColumnID)), LeftJoin(join(InstanceDomainInstanceIDCol, InstanceColumnID)),
func(builder sq.SelectBuilder) sq.SelectBuilder { func(builder sq.SelectBuilder) sq.SelectBuilder {
return sq.Select( return sq.Select(

View File

@ -55,7 +55,7 @@ var (
` projections.instance_domains.creation_date,` + ` projections.instance_domains.creation_date,` +
` projections.instance_domains.change_date, ` + ` projections.instance_domains.change_date, ` +
` projections.instance_domains.sequence` + ` projections.instance_domains.sequence` +
` FROM (SELECT projections.instances.id, COUNT(*) OVER () FROM projections.instances` + ` FROM (SELECT DISTINCT projections.instances.id, COUNT(*) OVER () FROM projections.instances` +
` LEFT JOIN projections.instance_domains ON projections.instances.id = projections.instance_domains.instance_id) AS f` + ` LEFT JOIN projections.instance_domains ON projections.instances.id = projections.instance_domains.instance_id) AS f` +
` LEFT JOIN projections.instances ON f.id = projections.instances.id` + ` LEFT JOIN projections.instances ON f.id = projections.instances.id` +
` LEFT JOIN projections.instance_domains ON f.id = projections.instance_domains.instance_id` + ` LEFT JOIN projections.instance_domains ON f.id = projections.instance_domains.instance_id` +