Mass Update JSONB Error
henryzhang03 opened this issue · comments
So I am trying to do a query similar to this:
await db`
update example
set
example_object = v.example_object::jsonb,
from (values ${db(valuesArray)}) as v (
example_object
)
where example.identifier = v.identifier;`;
example_object in this case is an object in my typescript code. However, if I try to insert it this way, it complains that it is an [object Object] and can't parse it. On the other hand, if I don't include the jsonb cast, it complains that it just text. Can someone please help me resolve this issue? As it is very mission critical.