Re: Boolean operators without commutators vs. ALL/ANY

Florian G. Pflug <fgp@phlo.org>

From: Florian Pflug <fgp@phlo.org>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Robert Haas <robertmhaas@gmail.com>, PG Hackers <pgsql-hackers@postgresql.org>
Date: 2011-06-14T10:10:18Z
Lists: pgsql-hackers
On Jun13, 2011, at 05:44 , Tom Lane wrote:
> Robert Haas <robertmhaas@gmail.com> writes:
>> On Sun, Jun 12, 2011 at 7:46 AM, Florian Pflug <fgp@phlo.org> wrote:
>>> (B) There should be a way to use ANY()/ALL() with the
>>> array elements becoming the left arguments of the operator.
> 
>> It seems to me that if we provided some way of handling this, your
>> first proposal would be moot; and I have to say I like the idea of
>> allowing this a lot more than tinkering with the operator names.
> 
> There are syntactic reasons not to do that.  It'd be a lot easier just
> to provide a commutator operator for ~.

My suggestion would be the add a commutator for "~" as a short-term
solution (preferably in 9.1).

Since "~" doesn't inspire any obvious names for a possible commutator,
I suggest adding "=~" and "~=".

Is there any support for that proposal?

In the long term, I'd like to add support for "(ANY() <op> <expr>)"
(Note the enclosing parens). I've checked that this works grammar-wise,
but haven't no idea how much tweaking the executor needs to support
that...

best regards,
Florian Pflug