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

IN with arrays

From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: pgsql-hackers(at)postgresql(dot)org
Subject: IN with arrays
Date: 2007-04-16 06:48:54
Message-ID: 200704160848.55208.peter_e@gmx.net (view raw or flat)
Thread:
Lists: pgsql-hackers
I'm wondering why a IN b isn't equivalent to a = ANY b for arrays, as it 
is for subqueries.

That is, why can't you write

SELECT 1 IN ( ARRAY[1, 2, 3] );

when you can write

SELECT 1 = ANY ( ARRAY[1, 2, 3] );

?

I'm guessing that there is a semantic inconsistency between these 
expressions, as the first one considers what is in parentheses as a 
list, the second one as a single expression.  That would be very bad.

-- 
Peter Eisentraut
http://developer.postgresql.org/~petere/

Responses

pgsql-hackers by date

Next:From: Martin LanghoffDate: 2007-04-16 07:18:23
Subject: Hacking on PostgreSQL via GIT
Previous:From: Neil ConwayDate: 2007-04-16 04:47:40
Subject: Re: Build-Problem with pgc.c on OSX 10.4

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