Thread: Arrays Question

Arrays Question

From
Achilleus Mantzios
Date:
Hi
Is it possible to have subarrays from an array constant??
Is it possible to have indices on arrays??

For the first here it is whats on 7.1.2:

dynacom=# select  '{1,2,3}'::_int4  ;
 ?column?
----------
 {1,2,3}
(1 row)

dynacom=#

dynacom=# select  '{1,2,3}[1:2]'::_int4  ;
 ?column?
----------
 {1,2,3}
(1 row)

dynacom=#

What would someone expect is the select to return {1,2}.

Any one has a clue???

If postgresql had this feature along with the indexing on arrays, that would
make it (not that it is not allready!) the perfect candidate for tree
manipulation.

Thanx in advance
--
Achilleus Mantzios
S/W Engineer
IT dept
Dynacom Tankers Mngmt
tel:    +30-10-8981112
fax:    +30-10-8981877
email:  it@dynacomtm.com
        rnd@gatewaynet.com


Re: Arrays Question

From
Oleg Bartunov
Date:
Check contrib/intarray for indexed access methods to arrays of integers.
Oleg
On Fri, 25 Jan 2002, Achilleus Mantzios wrote:

> Hi
> Is it possible to have subarrays from an array constant??
> Is it possible to have indices on arrays??
>
> For the first here it is whats on 7.1.2:
>
> dynacom=# select  '{1,2,3}'::_int4  ;
>  ?column?
> ----------
>  {1,2,3}
> (1 row)
>
> dynacom=#
>
> dynacom=# select  '{1,2,3}[1:2]'::_int4  ;
>  ?column?
> ----------
>  {1,2,3}
> (1 row)
>
> dynacom=#
>
> What would someone expect is the select to return {1,2}.
>
> Any one has a clue???
>
> If postgresql had this feature along with the indexing on arrays, that would
> make it (not that it is not allready!) the perfect candidate for tree
> manipulation.
>
> Thanx in advance
>
Regards,    Oleg
_____________________________________________________________
Oleg Bartunov, sci.researcher, hostmaster of AstroNet,
Sternberg Astronomical Institute, Moscow University (Russia)
Internet: oleg@sai.msu.su, http://www.sai.msu.su/~megera/
phone: +007(095)939-16-83, +007(095)939-23-83