I have a table containing lists like so:
['string1','string2']
['string3']
etc
And would like to split each element into its own row.
I've tried converting to an array by doing a regex replace to remove the square brackets :
SELECT
ARRAY[regexp_replace(
regexp_replace(place_id, '\[', '')
, '\]', '')::text]
from place_ids
Which gives i.e.:
{'string1','string2'}
However I'm not sure how to split these out. I've tried using unnest :
SELECT
unnest(
ARRAY[regexp_replace(
regexp_replace(place_id, '\[', '')
, '\]', '')::text]
)
from place_ids
But this seems to just remove the array brackets:
'string1','string2'
I was hoping to get something like:
'string1'
'string2'
'string3'