Обсуждение: select b[1] from foo

Поиск
Список
Период
Сортировка

select b[1] from foo

От
"rony khoury"
Дата:

Hello ,

Say I perform the following operations on my postgresql box :

create table foo (a int , b int[]) ;
insert into foo values(1,'{1,2,3}');
select * from foo ;
a | b
---------------
1 | {1,2,3}
select b[2] from foo ;

the question is why can't I execute the following statement , and If I
want to do an add , avg , sum , etc ... on the same element , how can I
do that ?
If someone can provide me with an example on how to do that I will be
gratefull .

thanks ,
Rony .