Re: IN and ANY

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Dennis Bjorklund <db(at)zigo(dot)dhs(dot)org>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: IN and ANY
Date: 2004-03-02 06:45:02
Message-ID: 24070.1078209902@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Dennis Bjorklund <db(at)zigo(dot)dhs(dot)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

In response to

  • IN and ANY at 2004-03-02 05:57:01 from Dennis Bjorklund

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Shridhar Daithankar 2004-03-02 06:58:22 Re: Avoid MVCC using exclusive lock possible?
Previous Message Alvaro Herrera 2004-03-02 06:21:32 Re: Pl/Java - next step?