How to split the array and store into respected columns of table in Postgresql DataBase

2.7k views Asked by At

I am inserting the array of elements {idno,age,salary} as {1,10000,30} in PostgreSQL database and I need to split and store into the respected columns of the table.

How to store the split array elements in respect columns of table?

First is this possible , if possible can some one explain me ,how can we do it?

1

There are 1 answers

0
Roman Pekar On BEST ANSWER

Like this?

insert into test(idno, age, salary)
select D[1], D[2], D[3]
from (select '{1,10000,30}'::int[]) as A(D);

sql fiddle demo