Re: Arrya variable as argument to IN expression

From: "A(dot) Kretschmer" <andreas(dot)kretschmer(at)schollglas(dot)com>
To: pgsql-sql(at)postgresql(dot)org
Subject: Re: Arrya variable as argument to IN expression
Date: 2005-11-17 09:26:38
Message-ID: 20051117092638.GF20828@webserv.wug-glas.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

am 17.11.2005, um 0:28:51 -0800 mailte Emil Kaffeshop folgendes:
> Hello I am trying the following:
> a INTEGER[] := ''{10,15,20}'';
> b INTEGER := 15;
> flag BOOLEAN := FALSE;
>
> SELECT b IN (a) INTO flag; !!! does not work

Sorry, i can't understand your query.

Perhaps you are searchfing for something like:

test=# select * from foo;
a | b | flag
---------+---+------
{1,2,3} | 1 | t
{5,6,7} | 1 | t
(2 rows)

test=# select * from foo where b = any(a);
a | b | flag
---------+---+------
{1,2,3} | 1 | t
(1 row)

>
> Is it legal to expect the array to be interpret as
> list of integers which IN expression takes ?

Please read http://www.postgresql.org/docs/8.1/interactive/arrays.html
to learn more about arrays.

HTH, Andreas
--
Andreas Kretschmer (Kontakt: siehe Header)
Heynitz: 035242/47212, D1: 0160/7141639
GnuPG-ID 0x3FFF606C http://wwwkeys.de.pgp.net
=== Schollglas Unternehmensgruppe ===

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Andy Ballingall 2005-11-17 09:46:22 idea for a geographically distributed database: how best to implement?
Previous Message Andy Ballingall 2005-11-17 08:44:24 idea for a geographically distributed database: how best to implement?