Re: Bug in CREATE OPERATOR - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Bug in CREATE OPERATOR
Date
Msg-id 5711.977334718@sss.pgh.pa.us
Whole thread Raw
In response to Bug in CREATE OPERATOR  ("Christopher Kings-Lynne" <chriskl@familyhealth.com.au>)
List pgsql-hackers
"Christopher Kings-Lynne" <chriskl@familyhealth.com.au> writes:
> [ "CREATE OPERATOR testbit" is accepted ]

Not only that, but it looks like you can create aggregate functions and
types that have operator-like names :-(.  Someone was way too eager to
save a production or two, I think:

DefineStmt:  CREATE def_type def_name definition               {        ...               }       ;

def_type:  OPERATOR                            { $$ = OPERATOR; }       | TYPE_P                               { $$ =
TYPE_P;}       | AGGREGATE                            { $$ = AGGREGATE; }       ;
 

def_name:  PROCEDURE                          { $$ = "procedure"; }       | JOIN                                { $$ =
"join";}       | all_Op                              { $$ = $1; }       | ColId                               { $$ =
$1;}       ;
 

Seems to me that this should be simplified down to
CREATE OPERATOR all_Op ...
CREATE TYPE ColId ...
CREATE AGGREGATE ColId ...

Any objections?  Has anyone got an idea why PROCEDURE and JOIN are
special-cased here?  PROCEDURE, at least, could be promoted from
ColLabel to ColId were it not offered as an alternative to ColId here.


> Now we have a big problem, as the DROP OPERATOR command cannot delete the
> illegally named operator.

Just remove it by DELETEing the row from pg_operator.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Thomas Lockhart
Date:
Subject: Replication toolkit added to repository
Next
From: Paul A Vixie
Date:
Subject: day 2 results