Re: Why are no NEGATORS defined in the standard operators

Lists: pgsql-general
From: Daniel Migowski <dmigowski(at)ikoffice(dot)de>
To: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Why are no NEGATORS defined in the standard operators
Date: 2016-06-11 08:00:48
Message-ID: 41ED3F5450C90F4D8381BC4D8DF6BBDCAF46C6E0@EXCHANGESERVER.ikoffice.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

Hello,

while trying to bake my own fixedpoint datatype I noticed the definition for =(int8,int8) to be

CREATE OPERATOR =(
PROCEDURE = int8eq,
LEFTARG = int8,
RIGHTARG = int8,
COMMUTATOR = =,
RESTRICT = eqsel,
JOIN = eqjoinsel,
HASHES,
MERGES);

in PostgreSQL 9.5, but I wonder, why there is no NEGATOR clause defined here? According to the docs it should help to add

NEGATOR = <>

In query optimization. Is there some reason for it? Or is it a Bug in pgAdmin III that the negator is not shown?

Regards,
Daniel Migowski


From: Julien Rouhaud <julien(dot)rouhaud(at)dalibo(dot)com>
To: Daniel Migowski <dmigowski(at)ikoffice(dot)de>, "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Why are no NEGATORS defined in the standard operators
Date: 2016-06-11 09:27:48
Message-ID: dfc085f9-b5a7-5cff-b0a4-a313e70a2a05@dalibo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

Hello

On 11/06/2016 10:00, Daniel Migowski wrote:
> Hello,
>
> while trying to bake my own fixedpoint datatype I noticed the definition
> for =(int8,int8) to be
>
>
>
> CREATE OPERATOR =(
>
> PROCEDURE = int8eq,
>
> LEFTARG = int8,
>
> RIGHTARG = int8,
>
> COMMUTATOR = =,
>
> RESTRICT = eqsel,
>
> JOIN = eqjoinsel,
>
> HASHES,
>
> MERGES);
>
>
>
> in PostgreSQL 9.5, but I wonder, why there is no NEGATOR clause defined
> here? According to the docs it should help to add
>
>
>
> NEGATOR = <>
>
>
>
> In query optimization. Is there some reason for it? Or is it a Bug in
> pgAdmin III that the negator is not shown?
>

I guess this is a bug in pgAdmin3, because the negator is defined in the
catalog:

# select o1.oprname, o1.oprcode, o1.oprnegate, o2.oprname as negate from
pg_operator o1 join pg_operator o2 on o1.oprnegate = o2.oid where
o1.oprname = '=' and o1.oprleft = 'int8'::regtype and o1.oprright =
'int8'::regtype;

oprname │ oprcode │ oprnegate │ negate
═════════╪═════════╪═══════════╪════════
= │ int8eq │ 411 │ <>
(1 row)

--
Julien Rouhaud
http://dalibo.com - http://dalibo.org


From: Daniel Migowski <dmigowski(at)ikoffice(dot)de>
To: Julien Rouhaud <julien(dot)rouhaud(at)dalibo(dot)com>, "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Why are no NEGATORS defined in the standard operators
Date: 2016-06-11 09:29:44
Message-ID: 41ED3F5450C90F4D8381BC4D8DF6BBDCAF46C721@EXCHANGESERVER.ikoffice.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

OK, I file a bug report.

-----Ursprüngliche Nachricht-----
Von: Julien Rouhaud [mailto:julien(dot)rouhaud(at)dalibo(dot)com]
Gesendet: Samstag, 11. Juni 2016 11:28
An: Daniel Migowski <dmigowski(at)ikoffice(dot)de>; pgsql-general(at)postgresql(dot)org
Betreff: Re: [GENERAL] Why are no NEGATORS defined in the standard operators

Hello

On 11/06/2016 10:00, Daniel Migowski wrote:
> Hello,
>
> while trying to bake my own fixedpoint datatype I noticed the
> definition for =(int8,int8) to be
>
>
>
> CREATE OPERATOR =(
>
> PROCEDURE = int8eq,
>
> LEFTARG = int8,
>
> RIGHTARG = int8,
>
> COMMUTATOR = =,
>
> RESTRICT = eqsel,
>
> JOIN = eqjoinsel,
>
> HASHES,
>
> MERGES);
>
>
>
> in PostgreSQL 9.5, but I wonder, why there is no NEGATOR clause
> defined here? According to the docs it should help to add
>
>
>
> NEGATOR = <>
>
>
>
> In query optimization. Is there some reason for it? Or is it a Bug in
> pgAdmin III that the negator is not shown?
>

I guess this is a bug in pgAdmin3, because the negator is defined in the
catalog:

# select o1.oprname, o1.oprcode, o1.oprnegate, o2.oprname as negate from pg_operator o1 join pg_operator o2 on o1.oprnegate = o2.oid where o1.oprname = '=' and o1.oprleft = 'int8'::regtype and o1.oprright = 'int8'::regtype;

oprname │ oprcode │ oprnegate │ negate
═════════╪═════════╪═══════════╪════════
= │ int8eq │ 411 │ <>
(1 row)

--
Julien Rouhaud
http://dalibo.com - http://dalibo.org