Re[2]: [PATCH] Optional OR REPLACE in CREATE OPERATOR statement

From: Svetlana Derevyanko <s(dot)derevyanko(at)postgrespro(dot)ru>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re[2]: [PATCH] Optional OR REPLACE in CREATE OPERATOR statement
Date: 2022-07-06 12:00:55
Message-ID: 1657108855.606587877@f406.i.mail.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


 
>Вторник, 5 июля 2022, 18:29 +03:00 от Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>:

>=?UTF-8?B?U3ZldGxhbmEgRGVyZXZ5YW5rbw==?= < s(dot)derevyanko(at)postgrespro(dot)ru > writes:
>> It seems useful to have [OR REPLACE] option in CREATE OPERATOR statement, as in CREATE FUNCTION. This option may be good for writing extension update scripts, to avoid errors with re-creating the same operator.
>No, that's not acceptable. CREATE OR REPLACE should always produce
>exactly the same final state of the object, but in this case we cannot
>change the underlying function if the operator already exists.
>
>(At least, not without writing a bunch of infrastructure to update
>existing views/rules that might use the operator; which among other
>things would create a lot of deadlock risks.)
>
>regards, tom lane
Hello,
 
> CREATE OR REPLACE should always produce exactly the same final state of the object,
> but in this case we cannot change the underlying function if the operator already exists.
   
Do you mean that for existing operator CREATE OR REPLACE should be the same as DROP OPERATOR and CREATE OPERATOR,  with relevant re-creation of existing view/rules/..., using this operator? If yes, what exactly is wrong with  changing only RESTRICT and JOIN parameters (or is the problem in possible user`s confusion with attempts to change something more?). If no, could you, please, clarify what "final state" here means?
 
Also, if OR REPLACE is unacceptable, then what do you think about IF NOT EXISTS option?
 
Thanks,
 
--
Svetlana Derevyanko
Postgres Professional:  http://www.postgrespro.com
The Russian Postgres Company

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2022-07-06 12:25:04 Re: pg15b2: large objects lost on upgrade
Previous Message Justin Pryzby 2022-07-06 11:56:00 Re: pg15b2: large objects lost on upgrade