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.
PostgreSQL ARRAY_AGG() function is an aggregate function that accepts a set of values and returns an array where each value in the input set is assigned to an element of the array.
Unnest function generates a table structure of an array in PostgreSQL. Unnest array function is beneficial in PostgreSQL for expanding the array into the set of values or converting the array into the structure of the rows. PostgreSQL offers unnest() function.
'{1,1}'
can be casted to an array directly:
select '{1,1}'::int[]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With