Re: IN, BETWEEN, spec compliance, and odd operator names

From: Martijn van Oosterhout <kleptog(at)svana(dot)org>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: IN, BETWEEN, spec compliance, and odd operator names
Date: 2008-08-25 19:54:06
Message-ID: 20080825195406.GA24686@svana.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Aug 25, 2008 at 10:43:30AM -0400, Tom Lane wrote:
> Martijn van Oosterhout <kleptog(at)svana(dot)org> writes:
> > ISTM the problem is that there's no easy way to refer to "operators
> > found in a default opclass", so perhaps we could invent a construct:
>
> > A OPERATOR(btree,2) B
>
> Huh? I don't understand why you think we need to expose this to users.
> A user would presumably just write the name of the operator he wants,
> if he's writing out a direct operator call.

The user would, yes. I was talking about the internal representation.
We're talking about the operator name that the parser is going to use
when expanding the BETWEEN clause. Instead of using the string "<=" you
use the string "btree.2" and then in the operator resolution code you
treat that as an operator class lookup. The above construct doesn't
actually work for the end-user because of a parser error.

> To me the issue is what we consider IN and BETWEEN and similar
> constructs to "mean", which in a datatype world boils down to choosing
> which of the datatype's operators to implement the construct with.

I was thinking the problem was using real operator names. Here we make
up an unambiguous name that is not currently in use that can be
resolved to the required operator on demand.

If you define the lookup to always match the type of the left-hand
value you can force consistant semantics. Whether its the semantics you
want is another question.

Have a nice day,
--
Martijn van Oosterhout <kleptog(at)svana(dot)org> http://svana.org/kleptog/
> Please line up in a tree and maintain the heap invariant while
> boarding. Thank you for flying nlogn airlines.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2008-08-25 20:01:19 Re: IN, BETWEEN, spec compliance, and odd operator names
Previous Message Nathan Boley 2008-08-25 19:44:04 Re: IN, BETWEEN, spec compliance, and odd operator names