Skip to content

Commit

Permalink
[cherry-pick] Adjust the query by UUID sql so that it can use the idx…
Browse files Browse the repository at this point in the history
…_task_extra_at… (#20546)

Adjust the query by UUID sql so that it can use the idx_task_extra_attrs_report_uuids

  fixes #20505

Signed-off-by: stonezdj <[email protected]>
  • Loading branch information
stonezdj authored Jun 4, 2024
1 parent 81fcc0a commit 7025568
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/pkg/task/dao/task.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,8 @@ func (t *taskDAO) ListScanTasksByReportUUID(ctx context.Context, uuid string) ([
}

var tasks []*Task
param := fmt.Sprintf(`{"report_uuids":["%s"]}`, uuid)
sql := `SELECT * FROM task WHERE extra_attrs::jsonb @> cast( ? as jsonb )`
param := fmt.Sprintf(`"%s"`, uuid)
sql := `SELECT * FROM task WHERE extra_attrs::jsonb -> 'report_uuids' @> ?`
_, err = ormer.Raw(sql, param).QueryRows(&tasks)
if err != nil {
return nil, err
Expand Down

0 comments on commit 7025568

Please sign in to comment.