in Uncategorized

Remove Duplicates From Array in Postgres 9.5+ JSONB Column

Recently needed to clean up some data that looked like this:

in a jsonb column. The result I need is:

Took me a while to figure this out but here’s the query in case anyone needs it.

The above query would update a single record, but how do you update every record with the corresponding row?

Write a Comment

Comment