Convert a Text to an Array - PostgreSQL

Viewed 22276

im learning PostgreSQL and i encountered a little Problem.

I have a text like this:

'{1,1}'

and want to create an Array that holds my two values, so that i can access them. How do i do that ? I tried

SELECT string_to_array('{1,1}', '{', '}', ',');

But that does not seem to work.

1 Answers

'{1,1}' can be casted to an array directly:

select '{1,1}'::int[]
Related