I have column "session" in table "A" which looks like this
session |
---|
[1,3,5,2] |
[5,1,3,2] |
values in rows saved as VARCHAR, but i want to cast it to array and do some operations on values inside the array
is there a way a to cast those to array? , thank you
CodePudding user response:
You need to replace your brackets []
to braces {}
to make it a standard array
type. then cast it to int[]
.
select unnest(replace(replace(session, '[', '{'), ']', '}')::int[])