Re: Adding a distinct "pattern" type to resolve the "~" commutator stalemate - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Adding a distinct "pattern" type to resolve the "~" commutator stalemate
Date
Msg-id 22979.1308514220@sss.pgh.pa.us
Whole thread Raw
In response to Re: Adding a distinct "pattern" type to resolve the "~" commutator stalemate  (Andrew Dunstan <andrew@dunslane.net>)
Responses Re: Adding a distinct "pattern" type to resolve the "~" commutator stalemate
List pgsql-hackers
Andrew Dunstan <andrew@dunslane.net> writes:
> On 06/19/2011 02:56 PM, Robert Haas wrote:
>> On Sun, Jun 19, 2011 at 9:53 AM, Florian Pflug<fgp@phlo.org>  wrote:
>>> Amidst the discussion, Alvaro suggested that we resolve the issue
>>> by adding a distinct type for patterns as opposed to text. That'd
>>> allow us to make "~" it's own commutator by defining both
>>> text ~ pattern
>>> and
>>> pattern ~ text.

>> That's kind of a neat idea.  There might be an efficiency benefit to
>> having a regex type that is precompiled by the input function.

> What do we do when we get text or unknown in place of pattern? How are 
> we going to know if the pattern is supposed to be the left or right operand?

Yeah, this would result inSELECT 'something' ~ 'something';
failing outright.  I don't think it's a good substitute for biting
the bullet and choosing distinct operator names.

(I do think a distinct regex datatype might be a good idea, but it
doesn't eliminate this particular problem.)
        regards, tom lane


pgsql-hackers by date:

Previous
From: Andrew Dunstan
Date:
Subject: Re: Adding a distinct "pattern" type to resolve the "~" commutator stalemate
Next
From: Peter Eisentraut
Date:
Subject: Re: [COMMITTERS] pgsql: Make external_pid_file world readable