Skip to content

fix(pgmq): resolve drop_queue overloading bug - #2400

Open
mandar1045 wants to merge 2 commits into
supabase:developfrom
mandar1045:fix/pgmq-drop-queue-overload
Open

fix(pgmq): resolve drop_queue overloading bug#2400
mandar1045 wants to merge 2 commits into
supabase:developfrom
mandar1045:fix/pgmq-drop-queue-overload

Conversation

@mandar1045

@mandar1045 mandar1045 commented Aug 26, 2026

Copy link
Copy Markdown

TL;DR

Fixes an issue where "pgmq" extension setup fails on PostgreSQL 17.6+ because "pgmq.drop_queue" has multiple versions.

Problem

Running "npx supabase db reset" fails when creating the "pgmq" extension.

This happens because PostgreSQL 17.6+ can have multiple "pgmq.drop_queue" functions, but the setup script only tries to remove one of them.

Solution

Updated the setup script to find and remove all versions of "pgmq.drop_queue" before creating the extension.

Also added a check to make sure we only remove functions that are actually registered with the extension.

Updated the function signature to match pgmq 1.5.1.

Testing

Tested with PostgreSQL 17.6.1.

The script now runs successfully without the duplicate-function error.

Ref

@mandar1045
mandar1045 requested review from a team as code owners August 26, 2026 22:37
Fixes supabase#1867

When pgmq was updated to 1.5.1, the drop_queue function introduced overloading (adding a partitioned parameter). The static drop commands in the after-create.sql script failed with 'function is not unique', breaking local db resets for new projects.

This replaces the static drops with a dynamic loop over pg_proc to safely drop all overloaded signatures, and updates the patched function signature to align with 1.5.1 API while maintaining backwards compatibility.
@mandar1045
mandar1045 force-pushed the fix/pgmq-drop-queue-overload branch from 5cffa24 to 84e8d45 Compare September 2, 2026 19:07
@mandar1045

Copy link
Copy Markdown
Author

Pushed an update: the detachment loop now explicitly checks pg_depend before running ALTER EXTENSION ... DROP FUNCTION. This ensures we only detach functions that are registered as extension members, preventing errors if an overload exists outside extension metadata.

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.

CREATE EXTENSION pgmq fails in Postgres 17.6.1.016+ due to function overload handling bug in after-create script

1 participant