Skip to content

Conversation

jfroche
Copy link
Collaborator

@jfroche jfroche commented Oct 8, 2025

We introduced a patch to override pgmq.drop_queue(TEXT) to conditionally drop objects only if they are part of the extension in ansible/ansible/files/postgresql_extension_custom_scripts/pgmq/after-create.sql. This script might have been installed on installations with existing 1.4.4 extensions.

When the user tries to upgrade pgmq from 1.4.4 to 1.5.1, the upgrade process will fail because the upgrade script doesn't expect pgmq.drop_queue(TEXT) to exist.

This change introduce the a patch to the pgmq extension to use CREATE OR REPLACE FUNCTION instead of CREATE FUNCTION for pgmq.drop_queue(TEXT) in the upgrade script from 1.4.5 to 1.5.0.

We also test that the install/upgrade of the extension works well with our after create script.

@jfroche jfroche force-pushed the fix/upgrade-pgmq-drop-queue branch 2 times, most recently from 21f9421 to 8a0ed1b Compare October 9, 2025 09:27
@jfroche jfroche changed the title fix(pgmq): override drop_queue to conditionally drop objects fix(pgmq): replace drop_queue function if exists Oct 9, 2025
@jfroche jfroche force-pushed the fix/upgrade-pgmq-drop-queue branch from 8a0ed1b to 37fac6b Compare October 9, 2025 09:52
@jfroche jfroche marked this pull request as ready for review October 9, 2025 09:52
@jfroche jfroche requested review from a team as code owners October 9, 2025 09:52
@jfroche jfroche force-pushed the fix/upgrade-pgmq-drop-queue branch from 37fac6b to df6d946 Compare October 9, 2025 10:04
jfroche and others added 3 commits October 9, 2025 14:16
We introduced a patch to override pgmq.drop_queue(TEXT) to conditionally
drop objects only if they are part of the extension in `ansible/ansible/files/postgresql_extension_custom_scripts/pgmq/after-create.sql`
. This script might have been installed on installations with existing 1.4.4 extensions.

When the user tries to upgrade pgmq from 1.4.4 to 1.5.1, the upgrade
process will fail because the upgrade script doesn't expect
`pgmq.drop_queue(TEXT)` to exist.

This change introduce the a patch to the pgmq extension to use
`CREATE OR REPLACE FUNCTION` instead of `CREATE FUNCTION` for
`pgmq.drop_queue(TEXT)` in the upgrade script from 1.4.5 to 1.5.0.
…cript

We create a new custom nixos test for the pgmq extension to test that the extension works
well with the after-create.sql script present in
`ansible/files/postgresql_extension_custom_scripts/pgmq/after-create.sql`.
@samrose samrose force-pushed the fix/upgrade-pgmq-drop-queue branch from df6d946 to cb01cd2 Compare October 9, 2025 18:18
Copy link
Collaborator

@samrose samrose left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

passes all tests on relevant branches

@samrose samrose merged commit bbfc14b into develop Oct 9, 2025
24 of 25 checks passed
@samrose samrose deleted the fix/upgrade-pgmq-drop-queue branch October 9, 2025 20:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants