public inbox for [email protected]
help / color / mirror / Atom feedFrom: Peter Eisentraut <[email protected]>
To: Matthias van de Meent <[email protected]>
Cc: Gurjeet Singh <[email protected]>
Cc: Postgres Hackers <[email protected]>
Subject: Re: Named Operators
Date: Tue, 31 Jan 2023 11:21:12 +0100
Message-ID: <[email protected]> (raw)
In-Reply-To: <CAEze2Wi_BfgeykixwzL2Hh9HU8M-fQ6g-6R3BuuvXVDhU8mdkg@mail.gmail.com>
References: <CABwTF4VVuacLV+coERacdDxUXg5tDMHZxvgH5+ek0UZvoq386g@mail.gmail.com>
<CAEze2WjeYjcf-bm_4gggK7PQ+9fQQ6=hzGeYxTRY9r+D-BPt8g@mail.gmail.com>
<CABwTF4Uh3FUK6_9mj_aszciLt-CU0eYKiCdaL1nXShjxaHhbqQ@mail.gmail.com>
<CAEze2Wi37EvNBk4a-oj_Gv4o74X6cOcqP8XSGGYMTnZOn=hsew@mail.gmail.com>
<[email protected]>
<CAEze2Wi_BfgeykixwzL2Hh9HU8M-fQ6g-6R3BuuvXVDhU8mdkg@mail.gmail.com>
On 27.01.23 16:34, Matthias van de Meent wrote:
> On Fri, 27 Jan 2023 at 16:26, Peter Eisentraut
> <[email protected]> wrote:
>>
>> On 12.01.23 14:55, Matthias van de Meent wrote:
>>>> Matter of taste, I guess. But more importantly, defining an operator
>>>> gives you many additional features that the planner can use to
>>>> optimize your query differently, which it can't do with functions. See
>>>> the COMMUTATOR, HASHES, etc. clause in the CREATE OPERATOR command.
>>> I see. Wouldn't it be better then to instead make it possible for the
>>> planner to detect the use of the functions used in operators and treat
>>> them as aliases of the operator? Or am I missing something w.r.t.
>>> differences between operator and function invocation?
>>>
>>> E.g. indexes on `int8pl(my_bigint, 1)` does not match queries for
>>> `my_bigint + 1` (and vice versa), while they should be able to support
>>> that, as OPERATOR(pg_catalog.+(int8, int8)) 's function is int8pl.
>>
>> I have been thinking about something like this for a long time.
>> Basically, we would merge pg_proc and pg_operator internally. Then, all
>> the special treatment for operators would also be available to
>> two-argument functions.
>
> And single-argument functions in case of prefix operators, right?
Right.
(The removal of postfix operators is helpful to remove ambiguity here.)
view thread (14+ messages) latest in thread
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected], [email protected], [email protected]
Subject: Re: Named Operators
In-Reply-To: <[email protected]>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox