Re: IN and ANY - Mailing list pgsql-hackers

From Tom Lane
Subject Re: IN and ANY
Date
Msg-id 24070.1078209902@sss.pgh.pa.us
Whole thread Raw
In response to IN and ANY  (Dennis Bjorklund <db@zigo.dhs.org>)
Responses Re: IN and ANY  (Joe Conway <mail@joeconway.com>)
List pgsql-hackers
Dennis Bjorklund <db@zigo.dhs.org> writes:
> Hmm, the draft seems to be broken since I can only find ANY defined for
> subqueries in other sections, and not for value lists. Strange but not 
> uncommon. Now I don't know what the standard says about this. Maybe 
> someone with the sql99 spec wants to check.

I think you are reading the term "equivalent" as meaning an equivalence
in both directions.  It looks to me that the spec's definition of
<in predicate> is (mis)using the term to mean "is defined as".
In SQL92 I see
        1) Let IVL be an <in value list>.             ( IVL )           is equivalent to the <table value constructor>:
           ( VALUES IVL )
 
        ...
        4) The expression             RVC IN IPV           is equivalent to             RVC = ANY IPV

These two rules together define both forms of IN in terms of the
"= ANY (subquery)" construct.  But surely the first rule is not
meant to say that VALUES is a noise word.  So this has to be a
one-way implication.

Accordingly I think you are in error to suggest that "= ANY (valuelist)"
is supposed to work.  I think ANY is only supposed to have a table
subquery to the right.

I don't have a strong opinion about "IN array", but am worried that
allowing it would create ambiguity about which interpretation is meant.
Is the left-hand side supposed to be compared against the whole array or
each array member?
        regards, tom lane


pgsql-hackers by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: Pl/Java - next step?
Next
From: Shridhar Daithankar
Date:
Subject: Re: Avoid MVCC using exclusive lock possible?