Query regarding function cleanup in extension upgrade path

From: Ayush Vatsa <ayushvatsa1810(at)gmail(dot)com>
To: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Query regarding function cleanup in extension upgrade path
Date: 2024-02-14 16:28:29
Message-ID: CACX+KaMFA=k1_c7C8ywm7eG2Y05sYyzYoseVr8epWhqO-T7McQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi PostgreSQL Community,
I have been working on a few extensions but got confused in the upgrade
scenario.
To ask the question let me give a hypothetical example:-
Suppose we have an extension named xyz with version 1.0. It has
xyz--1.0.sql and xyz.c file. I have declared a function named fun() in the
xyz--1.0.sql file and its definition in the xyz.c file.
Now I want to drop this function in the next upgrade i.e. xyz--1.0--1.1 so
I will use DROP FUNCTION fun(); in it and remove the definition from the
xyz.c file.
Here my doubt is wouldn't xyz--1.0 complain about the missing definition of
fun() and if yes how can I clean up my function definition in the xyz.c
file?
I had earlier asked the same question in DBS StackExchange
<https://dba.stackexchange.com/questions/335645/how-to-drop-a-function-in-postgres-extension-upgrade-script-with-required-cleanu?noredirect=1#comment653807_335645>
but didn't get any reply hence trying my luck here.

Regards
Ayush Vatsa
Amazon Web Services (AWS)

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2024-02-14 16:37:37 Re: Query regarding function cleanup in extension upgrade path
Previous Message Ron Johnson 2024-02-14 16:08:15 Re: Postgres pg_cron extension