15

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 Answer 1

31

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

select '{1,1}'::int[]
Sign up to request clarification or add additional context in comments.

2 Comments

Thank you ! But how can i access the values now ?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.