I have a postgresql table with a column that is a text datatype. This column value is a JSON string array. These values could be in any order such as
["a", "b", "c"]
or
["c", "a", "b", "d"]
or
["a"]
Now one of these values "b" is no longer used and needs to be removed from each record in the table.
so ["a", "b", "c"] should be converted to ["a", "c"]
I have looked into using one of the postgres functions array_remove() but haven't been able to get it to work.
Is it possible to convert to an array type and convert back to a string after using remove?
jsonorjsonbdata type for JSON values, nottext. There are many functions for working with it.