Re: Adding a distinct "pattern" type to resolve the "~" commutator stalemate

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Andrew Dunstan <andrew(at)dunslane(dot)net>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, Florian Pflug <fgp(at)phlo(dot)org>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Adding a distinct "pattern" type to resolve the "~" commutator stalemate
Date: 2011-06-19 20:10:20
Message-ID: 22979.1308514220@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Andrew Dunstan <andrew(at)dunslane(dot)net> writes:
> On 06/19/2011 02:56 PM, Robert Haas wrote:
>> On Sun, Jun 19, 2011 at 9:53 AM, Florian Pflug<fgp(at)phlo(dot)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 in
SELECT '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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2011-06-19 20:45:21 Re: [COMMITTERS] pgsql: Make external_pid_file world readable
Previous Message Andrew Dunstan 2011-06-19 19:38:28 Re: Adding a distinct "pattern" type to resolve the "~" commutator stalemate