PostgreSQL - Invoking SQL function while doing CREATE OR REPLACE on it

Hi @PJatLiquibase ,

I am using the community edition of Liquibase, so this is being done using a formatted SQL changelog.

I realized what was happening.
I had 2 changeSets in a single changelog:

  • changeSet 1 - was dropping a user-defined type (using DROP TYPE CASCADE) which was inadvertently also dropping these functions which were using this type
  • changeSet 2 - was doing a CREATE OR REPLACE FUNCTION which re-created these functions

Since each changeSet is a separate transaction, the tiny gap in time after the first transaction commit, but before the second transaction could commit was when these functions actually ceased to exist.
Any invocations of these functions during this time window failed.

This has been fixed now.
Appreciate your response.

Thanks,
Nagendra

1 Like