Skip site navigation (1) Skip section navigation (2)

array operators

From: David Orme <d(dot)orme(at)imperial(dot)ac(dot)uk>
To: pgsql-novice(at)postgresql(dot)org
Subject: array operators
Date: 2005-10-28 13:33:10
Message-ID: 13D73783-0D92-4C19-A74A-8498F221F6B1@ic.ac.uk (view raw or flat)
Thread:
Lists: 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)



Responses

pgsql-novice by date

Next:From: Ted RolleDate: 2005-10-28 14:10:49
Subject: Route to backend
Previous:From: kadilDate: 2005-10-28 07:49:59
Subject: Re: vacuuming and manu updates

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group