From: | Florian Pflug <fgp(at)phlo(dot)org> |
---|---|
To: | Robert Haas <robertmhaas(at)gmail(dot)com> |
Cc: | Alvaro Herrera <alvherre(at)commandprompt(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Peter Eisentraut <peter_e(at)gmx(dot)net>, PG Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Boolean operators without commutators vs. ALL/ANY |
Date: | 2011-06-17 16:13:07 |
Message-ID: | F72EFDBD-F2E5-4201-BBD2-9BC1908DC131@phlo.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Jun17, 2011, at 18:00 , Robert Haas wrote:
> On Fri, Jun 17, 2011 at 11:46 AM, Alvaro Herrera
> <alvherre(at)commandprompt(dot)com> wrote:
>> I guess this wouldn't be much of a problem if you could use ANY/ALL with
>> a function instead of an operator, c.f. map().
>
> Yeah. Or really what you want is a lambda-expression, rather than a
> predefined function.
>
> fold(bool_and, map { val ~ $0 } array)
Yeah, to bad we can't just write
SELECT BOOL_AND(val ~ e) FROM UNNEST(array)
Hey...wait a minute... ;-)
(I guess you actually meant
fold(bool_and, map { val ~ $0 } array)
which the equivalent sub-select
SELECT BOOL_AND(e ~ val) FROM UNNEST(array))
Still, you can't put that into a CHECK constraint (because it
counts as sub-select) and it's considerable longer and harder
to read then
val = ANY(array)
best regards,
Florian Pflug
From | Date | Subject | |
---|---|---|---|
Next Message | Florian Pflug | 2011-06-17 16:29:27 | Re: Boolean operators without commutators vs. ALL/ANY |
Previous Message | Ross J. Reedstrom | 2011-06-17 16:03:41 | Re: Boolean operators without commutators vs. ALL/ANY |