Re: Boolean operators without commutators vs. ALL/ANY

From: Florian Pflug <fgp(at)phlo(dot)org>
To: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Peter Eisentraut <peter_e(at)gmx(dot)net>, Robert Haas <robertmhaas(at)gmail(dot)com>, PG Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Boolean operators without commutators vs. ALL/ANY
Date: 2011-06-17 16:29:27
Message-ID: B5326A38-8183-4DFA-B660-FDDBAE9A17FD@phlo.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Jun17, 2011, at 17:46 , Alvaro Herrera wrote:
> Excerpts from Florian Pflug's message of vie jun 17 10:49:46 -0400 2011:
> Maybe, but the mnemonic rule seems quite a bit easier (to me anyway).
> In my head I think of ~ as "matches", so "text matches regex", whereas
> "regex matches text" doesn't make as much sense. (Hmm now that I see
> it, maybe in english this is not so clear, but in spanish the difference
> is pretty obvious).

I can't really argue with that, only state for that record that it's
different for me. I think of "~" as "similar" or "approximately equal",
and hence intuitively expect it to be symmetric. Whether or not
"matches" technically implies some direction or not I cannot say as
I'm not an english native speaker myself. But if I had to guess, I'd say
it doesn't.

>>>> How is that worse than the situation with "=~" and "~="?
>>>
>>> With =~ it is to the right, with ~= it is to the left.
>>
>> It's always where the tilde is. Yeah, you have to remember that.
>> Just as today you have to remember that the pattern goes on the
>> right side.
>
> Well, the mnemonic would be that ~ is still "text matches regex", while
> ~= is "the weird operator that goes the other way around", so it's still
> pretty clear.

Again, that depends on a person's background. For me it'd be
"~= is the regexp matching operator" and "~ is for some strange
reasons its commutator".

>>> 'm all for it, let's change the description then! Shall I submit a patch?
>
> Yes, please.

Will do, but after we've reached an overall agreement about the fate
or "~" and friends.

>>> (Or, alternatively,
>>> use a different data type for regexes than plain text ... but that has
>>> been in the Todo list for years ...)
>>
>> I actually like that idea. Since we probably don't want a type for every
>> kind of pattern we support (like, similar to, regexp), such a type wouldn't
>> be much more than a synonym for text though. I personally don't have a
>> problem with that, but I somehow feel there's gonna be quite some pushback...
>
> Hmm, why? Maybe that's something we can discuss.

Ok, I'll start a new thread for this.

best regards,
Florian Pflug

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Nicolas Barbier 2011-06-17 16:37:17 Re: XPATH evaluation
Previous Message Florian Pflug 2011-06-17 16:13:07 Re: Boolean operators without commutators vs. ALL/ANY