- My goal: I need this UPDATE query to run consistently on my PostgreSQL DB.
- Issue: This UPDATE query used to run consistently but suddenly stopped working for some apps. The query is below.
- Steps I've taken to troubleshoot: Tried casting types and made sure every value was defined, etc. The exact same query on the same table/DB works for some modules but not others.
- Additional info: (Cloud or Self-hosted, Screenshots)
UPDATE main.task
SET status = 'completed',
status_updated_at=NOW(),
result = ((COALESCE(result::jsonb, '{}'::jsonb) || jsonb_build_object('response_creator', '{{current_user.email}}'))::json)
WHERE id = '{{task_id.value}}'
task_id.value (UUID) and current_user.email (string) are defined. The error I get is:
"invalid input syntax for type uuid: "$2""
However, I get the same error if I try to cast it to UUID like so:
WHERE id = '{{task_id.value}}'::uuid
and I get a different error like so:
WHERE id = {{task_queue_item_id.value}}::uuid
the error is: "could not determine data type of parameter $1"
It’s very strange to me that this exact same query works on some modules and not others. It makes me think that there’s something wrong with the variable binding here. Would appreciate some help.