Re: Boolean operators without commutators vs. ALL/ANY - Mailing list pgsql-hackers

From Florian Pflug
Subject Re: Boolean operators without commutators vs. ALL/ANY
Date
Msg-id B5326A38-8183-4DFA-B660-FDDBAE9A17FD@phlo.org
Whole thread Raw
In response to Re: Boolean operators without commutators vs. ALL/ANY  (Alvaro Herrera <alvherre@commandprompt.com>)
List 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



pgsql-hackers by date:

Previous
From: Florian Pflug
Date:
Subject: Re: Boolean operators without commutators vs. ALL/ANY
Next
From: Nicolas Barbier
Date:
Subject: Re: XPATH evaluation