From ccbef282b9cd4c5bd2fe12fbeec948b0a350f987 Mon Sep 17 00:00:00 2001 From: Kartik Verma Date: Fri, 18 Feb 2022 11:20:20 +0530 Subject: [PATCH] fix: use org_id filter only when id is not blank --- store/postgres/groups.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/store/postgres/groups.go b/store/postgres/groups.go index 9c335ab50..34d7404d0 100644 --- a/store/postgres/groups.go +++ b/store/postgres/groups.go @@ -92,12 +92,12 @@ func (s Store) ListGroups(ctx context.Context, org model.Organization) ([]model. query := listGroupsQuery if org.Id != "" { - query = query + `WHERE org_id=$1` + query = query + fmt.Sprintf("WHERE org_id='%s'", org.Id) } query = query + ";" err := s.DB.WithTimeout(ctx, func(ctx context.Context) error { - return s.DB.SelectContext(ctx, &fetchedGroups, query, org.Id) + return s.DB.SelectContext(ctx, &fetchedGroups, query) }) if errors.Is(err, sql.ErrNoRows) {