I have next part of query:
x
'goals', COALESCE(
json_object_agg(log.type, COALESCE(log.data, TRUE)) FILTER (WHERE log.type IS NOT NULL),
'{}'
)
and I am getting next error:
ERROR: COALESCE types jsonb and boolean cannot be matched
LINE 30: ject_agg(log.type, COALESCE(log.data, TRUE)) FIL
^
Advertisement
Answer
The error with the query comes here:
coalesce(log.data, true)
Both operands of coalesce()
must have the same datatype. It looks like data
is json
, so it mismatches against boolean value true
.
Probably, you want to cast the boolean to a json text:
coalesce(log.data, 'true'::json)
This should also work:
coalesce(log.data, 'true')