msosno
asked on
PostgreSQL, array value must start with '{'
I need to execute the following PostgreSQL statement:
select ('{'0'}'::varchar[]) as "content", .......
The column content is of type array. It does not exist in this particular table and needs to be initialized.
In the beginning I was getting "array value must start with '{' ". Then I added curly braces and tried experimenting, but it still does not work. How can the query be fixed?
select ('{'0'}'::varchar[]) as "content", .......
The column content is of type array. It does not exist in this particular table and needs to be initialized.
In the beginning I was getting "array value must start with '{' ". Then I added curly braces and tried experimenting, but it still does not work. How can the query be fixed?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
select x.content[2] from (select '{"0","21","32"}'::text[] as content) as x;
content
---------
21
(1 row)