pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedArrya variable as argument to IN expression
4+ messages / 4 participants
[nested] [flat]
* Arrya variable as argument to IN expression
@ 2005-11-17 08:28 Emil Kaffeshop <emildg@yahoo.com>
0 siblings, 3 replies; 4+ messages in thread
From: Emil Kaffeshop @ 2005-11-17 08:28 UTC (permalink / raw)
To: pgsql-sql
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
Is it legal to expect the array to be interpret as
list of integers which IN expression takes ?
Best Regards
Emil kafegiiski
__________________________________
Yahoo! FareChase: Search multiple travel sites in one click.
http://farechase.yahoo.com
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: Arrya variable as argument to IN expression
@ 2005-11-17 09:26 A. Kretschmer <andreas.kretschmer@schollglas.com>
parent: Emil Kaffeshop <emildg@yahoo.com>
2 siblings, 0 replies; 4+ messages in thread
From: A. Kretschmer @ 2005-11-17 09:26 UTC (permalink / raw)
To: 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 ===
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: Arrya variable as argument to IN expression
@ 2005-11-17 09:51 Achilleus Mantzios <achill@matrix.gatewaynet.com>
parent: Emil Kaffeshop <emildg@yahoo.com>
2 siblings, 0 replies; 4+ messages in thread
From: Achilleus Mantzios @ 2005-11-17 09:51 UTC (permalink / raw)
To: Emil Kaffeshop <emildg@yahoo.com>; +Cc: pgsql-sql
O Emil Kaffeshop Ýãñáøå óôéò Nov 17, 2005 :
> 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
contrib/intarray and
SELECT intset(b) ~ a::int[] INTO flag;
are your friends.
>
> Is it legal to expect the array to be interpret as
> list of integers which IN expression takes ?
>
> Best Regards
> Emil kafegiiski
>
>
>
>
> __________________________________
> Yahoo! FareChase: Search multiple travel sites in one click.
> http://farechase.yahoo.com
>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: explain analyze is your friend
>
--
-Achilleus
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: Arrya variable as argument to IN expression
@ 2005-11-17 14:23 Tom Lane <tgl@sss.pgh.pa.us>
parent: Emil Kaffeshop <emildg@yahoo.com>
2 siblings, 0 replies; 4+ messages in thread
From: Tom Lane @ 2005-11-17 14:23 UTC (permalink / raw)
To: Emil Kaffeshop <emildg@yahoo.com>; +Cc: pgsql-sql
Emil Kaffeshop <emildg@yahoo.com> writes:
> SELECT b IN (a) INTO flag; !!! does not work
> Is it legal to expect the array to be interpret as
> list of integers which IN expression takes ?
No. But try "b = any (a)".
regards, tom lane
^ permalink raw reply [nested|flat] 4+ messages in thread
end of thread, other threads:[~2005-11-17 14:23 UTC | newest]
Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2005-11-17 08:28 Arrya variable as argument to IN expression Emil Kaffeshop <emildg@yahoo.com>
2005-11-17 09:26 ` A. Kretschmer <andreas.kretschmer@schollglas.com>
2005-11-17 09:51 ` Achilleus Mantzios <achill@matrix.gatewaynet.com>
2005-11-17 14:23 ` Tom Lane <tgl@sss.pgh.pa.us>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox