Обсуждение: how to get the size of array?

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

how to get the size of array?

От
Emi Lu
Дата:
Hello,

Is there a way that I can get the size of one array ?

For example, create table test (id varchar[]);
insert into test values('{}');
insert into test values('{1, 2, 3}');

I am looking for something like :  select sizeOf(id) as size from test;


so that I can get results like:
size
-------
0
3

Thanks a lot,
Ying



Re: how to get the size of array?

От
Andreas Kretschmer
Дата:
Emi Lu <emilu@encs.concordia.ca> schrieb:

> Hello,
> 
> Is there a way that I can get the size of one array ?

Yes: http://www.postgresql.org/docs/8.1/interactive/functions-array.html

HTH, Andreas
-- 
Really, I'm not out to destroy Microsoft. That will just be a completely
unintentional side effect.                              (Linus Torvalds)
"If I was god, I would recompile penguin with --enable-fly."    (unknow)
Kaufbach, Saxony, Germany, Europe.              N 51.05082°, E 13.56889°