array operators - Mailing list pgsql-novice

From David Orme
Subject array operators
Date
Msg-id 13D73783-0D92-4C19-A74A-8498F221F6B1@ic.ac.uk
Whole thread Raw
Responses Re: array operators
List pgsql-novice
Hi,

Can someone explain where I've gone wrong?

Given the table array_check:

> postgis_test=# select * from array_check;
> node |  sons
> ------+--------
>     1 |
>     2 |
>     4 |
>     3 |
>    -3 | {1,2}
>    -2 | {-3,3}
>    -1 | {-2,4}
> (7 rows)

and that this query returns an array value...
>
> postgis_test=# select sons from array_check where node = -3;
> sons
> -------
> {1,2}
> (1 row)

and that this works...

> postgis_test=# select node = any('{1,2}') as son_rows from
> array_check ;
> son_rows
> -----------
> t
> t
> f
> f
> f
> f
> f
> (7 rows)

.. why does this not throw an error?

> postgis_test=# select node = any(select sons from array_check where
> node = -3) as son_rows from array_check ;
> ERROR:  operator does not exist: integer = integer[]

Cheers,
David

> postgis_test=# select version();
>
>   version
> ----------------------------------------------------------------------
> ----------------------------------------------------------------------
> -----------
> PostgreSQL 8.0.4 on powerpc-apple-darwin8.2.0, compiled by GCC
> powerpc-apple-darwin8-gcc-4.0.0 (GCC) 4.0.0 20041026 (Apple
> Computer, Inc. build 4061)
> (1 row)



pgsql-novice by date:

Previous
From: kadil
Date:
Subject: Re: vacuuming and manu updates
Next
From: Ted Rolle
Date:
Subject: Route to backend