Skip to content

Commit ac9cb3a

Browse files
authored
fix(server): switch to JSON_EXTRACT and JSON_UNQUOTE for MySQL/MariaDB. Fixes argoproj#13202 (argoproj#13203)
Signed-off-by: spaced <spaced.wombat@gmail.com>
1 parent 10e3a6d commit ac9cb3a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

persist/sqldb/workflow_archive.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,7 @@ func (r *workflowArchive) DeleteExpiredWorkflows(ttl time.Duration) error {
380380
func selectArchivedWorkflowQuery(t dbType) (*db.RawExpr, error) {
381381
switch t {
382382
case MySQL:
383-
return db.Raw("name, namespace, uid, phase, startedat, finishedat, coalesce(workflow->>'$.metadata.labels', '{}') as labels,coalesce(workflow->>'$.metadata.annotations', '{}') as annotations, coalesce(workflow->>'$.status.progress', '') as progress, coalesce(workflow->>'$.metadata.creationTimestamp', '') as creationtimestamp, workflow->>'$.spec.suspend' as suspend, coalesce(workflow->>'$.status.message', '') as message, coalesce(workflow->>'$.status.estimatedDuration', '0') as estimatedduration, coalesce(workflow->>'$.status.resourcesDuration', '{}') as resourcesduration"), nil
383+
return db.Raw("name, namespace, uid, phase, startedat, finishedat, coalesce(JSON_EXTRACT(workflow,'$.metadata.labels'), '{}') as labels,coalesce(JSON_EXTRACT(workflow,'$.metadata.annotations'), '{}') as annotations, coalesce(JSON_UNQUOTE(JSON_EXTRACT(workflow,'$.status.progress')), '') as progress, coalesce(JSON_UNQUOTE(JSON_EXTRACT(workflow,'$.metadata.creationTimestamp')), '') as creationtimestamp, JSON_UNQUOTE(JSON_EXTRACT(workflow,'$.spec.suspend')) as suspend, coalesce(JSON_UNQUOTE(JSON_EXTRACT(workflow,'$.status.message')), '') as message, coalesce(JSON_UNQUOTE(JSON_EXTRACT(workflow,'$.status.estimatedDuration')), '0') as estimatedduration, coalesce(JSON_EXTRACT(workflow,'$.status.resourcesDuration'), '{}') as resourcesduration"), nil
384384
case Postgres:
385385
return db.Raw("name, namespace, uid, phase, startedat, finishedat, coalesce((workflow::json)->'metadata'->>'labels', '{}') as labels, coalesce((workflow::json)->'metadata'->>'annotations', '{}') as annotations, coalesce((workflow::json)->'status'->>'progress', '') as progress, coalesce((workflow::json)->'metadata'->>'creationTimestamp', '') as creationtimestamp, (workflow::json)->'spec'->>'suspend' as suspend, coalesce((workflow::json)->'status'->>'message', '') as message, coalesce((workflow::json)->'status'->>'estimatedDuration', '0') as estimatedduration, coalesce((workflow::json)->'status'->>'resourcesDuration', '{}') as resourcesduration"), nil
386386
}

0 commit comments

Comments
 (0)