PL/Java is a free add-on module that brings Java™ Stored Procedures, Triggers, Functions, Aggregates, Operators, Types, etc., to the PostgreSQL™ backend.
PL/Java supports a pre-extension, legacy installation method just using the LOAD command. It can still have some uses, such as when a DBA does not have write access to the directories where official extension files have to go. And PL/Java has supported later packaging such an 'unpackaged' installation into extension form. (The old PostgreSQL syntax for that, CREATE EXTENSION FROM unpackaged, was dropped in PG 13, but an equivalent sequence of steps still works).
That packaging used to rely on CREATE OR REPLACE silently absorbing a preexisting object into the current extension. However, since postgres/postgres@b9b21ac, CREATE OR REPLACE instead fails if the object exists and is not yet an extension member. Therefore, the few objects for which PL/Java does CREATE OR REPLACE within the InstallHelper.groundwork method also need to have conditional ALTER EXTENSION ADD done in that method first. (Conditional, because in the case where the unpackaged installation might also be an older PL/Java version, some objects we'll CREATE OR REPLACE for the current version might not be there yet.)
Only those few objects must be treated that way; ALTER EXTENSION ADD for the rest can still be done in the extension update script where anyone would expect.
PL/Java supports a pre-extension, legacy installation method just using the
LOAD
command. It can still have some uses, such as when a DBA does not have write access to the directories where official extension files have to go. And PL/Java has supported later packaging such an 'unpackaged' installation into extension form. (The old PostgreSQL syntax for that,CREATE EXTENSION FROM unpackaged
, was dropped in PG 13, but an equivalent sequence of steps still works).That packaging used to rely on
CREATE OR REPLACE
silently absorbing a preexisting object into the current extension. However, since postgres/postgres@b9b21ac,CREATE OR REPLACE
instead fails if the object exists and is not yet an extension member. Therefore, the few objects for which PL/Java doesCREATE OR REPLACE
within theInstallHelper.groundwork
method also need to have conditionalALTER EXTENSION ADD
done in that method first. (Conditional, because in the case where the unpackaged installation might also be an older PL/Java version, some objects we'llCREATE OR REPLACE
for the current version might not be there yet.)Only those few objects must be treated that way;
ALTER EXTENSION ADD
for the rest can still be done in the extension update script where anyone would expect.