On Jun17, 2011, at 15:36 , Alvaro Herrera wrote:
> Excerpts from Florian Pflug's message of vie jun 17 04:46:32 -0400 2011:
>> On Jun17, 2011, at 03:42 , Alvaro Herrera wrote:
>>> To make matters worse, our delimiters for regexes are the same as for
>>> strings, the single quote.  So you get
>>> 
>>> foo =~ 'bar'    /* foo is the text column, bar is the regex */
>>> 'bar' =~ foo    /* no complaint but it's wrong */
>>> 
>>> 'bar' ~= foo    /* okay */
>>> 'foo' ~= bar    /* no complaint but it's wrong */
>>> 
>>> How do I tell which is the regex here?  If we used, say, /, that would
>>> be a different matter:
>> 
>> How is this different from the situation today where the operator
>> is just "~"?
> 
> Err, we don't have commutators today?


So? How does that reduce that risk of somebody writing "pattern ~ text"
instead of "text ~ pattern"? Modifying your quote from above
--------
foo ~ 'bar'    /* foo is the text column, bar is the regex */
'bar' ~ foo    /* no complaint but it's wrong */

How do I tell which is the regex here?
--------

How is that worse than the situation with "=~" and "~="?

"=~" and "~=" at least don't *look* symmetric when they really are
not, which is the heart of the complaint, and also what makes defining
a sensible commutator impossible.

Also, do you have a better suggestion for how we can fix my original
gripe? Adding support for 'ANY/ALL op scalar" was shot down by Tom,
so it looks like we need a commutator for "~". "@" is severely disliked
by Tom, on the grounds that it's already been deprecated in other places.
"=~" is argued against by you and Robert Haas (I think). We're running
out of options here...

best regards,
Florian Pflug


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to