You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
PGMQ queue creation fails on preview branch reset: relation "pgmq.q_my_queue_msg_id_seq" does not exist #4492
When resetting a Supabase preview branch, PGMQ queue creation fails with a sequence-related error. The pgmq.create() call for a queue (e.g., my_queue) references a sequence (pgmq.q_my_queue_msg_id_seq) that doesn't exist, causing the migration to fail.
To Reproduce
Steps to reproduce the behavior, please provide code snippets or a repository:
Create a preview branch with migrations that create PGMQ queues:
CREATE EXTENSION IF NOT EXISTS pgmq;
SELECTpgmq.create('my_queue');
SELECTpgmq.create('my_queue_dlq');
Let the branch build successfully (first build works).
Reset the preview branch via the Supabase dashboard.
Hi @sweatybridge
I believe this issue is related with platform branching, not the migrations command 😕
So probably the user doesn't have access to full the migration script
Hi @sweatybridge it's not about migrations but rather about a behaviour of the Preview Branches. Once the extension pgmq has been enabled and a queue has been created and the preview branch is restarted, that error always happens.
I've described the steps to reproduce. You could even run the CREATE EXTENSION IF NOT EXISTS pgmq inside the SQL Editor and the create a queue. Then restart the preview branch. It's not a migrations issue.
Looks like the issue has returned @sweatybridge@kallebysantos. It tends to happen when a branch is left active overnight. Also, I rebased my local feature branch and git push --force-with-lease to the remote feature branch. Then the Supabase Preview Branch integration triggered the branch rebuild then the same error happened again. I think something isn't being properly cleared/restored by Supabase for the pgmq extension.
We experience this as well. It seems as though the CLI command supabase db reset isn't properly resetting the pgmq schema. We testing the fix and updated an old migration by adding the extra line DROP SCHEMA IF EXISTS pgmq CASCADE; before running CREATE EXTENSION IF NOT EXISTS pgmq;. Now we can reset our branches without issue.
Hey @sweatybridge, I've tracked this down to a side effect of how pgmq is excluded in drop.sql. Because PR #3043 added pgmq to the exclusion loop in drop.go and drop.sql, branch resets refuse to clean up the queue tables, leaving them orphaned for the next migration run.
Similarly, the sed replacement in dump_schema.sh from PR #4391 strips WITH SCHEMA "pgmq". This installs pgmq into public on Branch copies, causing issue #40666.
I have submitted PR #4940 to cleanly resolve both of these problems by removing the pgmq exclusions from drop.sql (so resets successfully drop the queues) and fixing the sed syntax to include CREATE SCHEMA IF NOT EXISTS "pgmq"!
Unlike PR #4471, PR #4940 does not add any custom Go-level retries or extension management; it strictly reverts the unintended schema exclusions.
We're closing this because it has not had any activity for 45 days, and we try to keep the Supabase CLI issue tracker focused on reports that are still current.
If this still reproduces on the latest Supabase CLI, please comment with /reopen on its own line and include your CLI version, updated reproduction steps, and any recent error output. We appreciate the signal and are happy to take another look.
Activity
ToJen commentedon Nov 21, 2025
Hey @sweatybridge, any thoughts on this
sweatybridge commentedon Nov 24, 2025
Can you show me the full migration file that you are trying to apply? The error happens at statement 786 but your example only has 3 statements.
kallebysantos commentedon Nov 24, 2025
Hi @sweatybridge
I believe this issue is related with platform branching, not the
migrationscommand 😕So probably the user doesn't have access to full the migration script
ToJen commentedon Nov 24, 2025
Hi @sweatybridge it's not about migrations but rather about a behaviour of the Preview Branches. Once the extension pgmq has been enabled and a queue has been created and the preview branch is restarted, that error always happens.
I've described the steps to reproduce. You could even run the
CREATE EXTENSION IF NOT EXISTS pgmqinside the SQL Editor and the create a queue. Then restart the preview branch. It's not a migrations issue.sweatybridge commentedon Nov 24, 2025
Could you share your postgres version and project ref?
I tried reproducing here but to no avail. https://github.com/qiao-supabase/branching-demo/pull/25/files
Migrations ran successfully on every reset of preview branch.
ToJen commentedon Nov 27, 2025
Made a mistake when cleaning different migrations files. I hadn't enabled pgmq and created the queue at the right position before using it.
ToJen commentedon Nov 27, 2025
Looks like the issue has returned @sweatybridge @kallebysantos. It tends to happen when a branch is left active overnight. Also, I rebased my local feature branch and
git push --force-with-leaseto the remote feature branch. Then the Supabase Preview Branch integration triggered the branch rebuild then the same error happened again. I think something isn't being properly cleared/restored by Supabase for thepgmqextension.qualitate-samparl commentedon Dec 1, 2025
We experience this as well. It seems as though the CLI command
supabase db resetisn't properly resetting the pgmq schema. We testing the fix and updated an old migration by adding the extra lineDROP SCHEMA IF EXISTS pgmq CASCADE;before runningCREATE EXTENSION IF NOT EXISTS pgmq;. Now we can reset our branches without issue.dumko2001 commentedon Mar 8, 2026
Hey @sweatybridge, I've tracked this down to a side effect of how
pgmqis excluded indrop.sql. Because PR #3043 addedpgmqto the exclusion loop indrop.goanddrop.sql, branch resets refuse to clean up the queue tables, leaving them orphaned for the next migration run.Similarly, the
sedreplacement indump_schema.shfrom PR #4391 stripsWITH SCHEMA "pgmq". This installspgmqintopublicon Branch copies, causing issue #40666.I have submitted PR #4940 to cleanly resolve both of these problems by removing the
pgmqexclusions fromdrop.sql(so resets successfully drop the queues) and fixing the sed syntax to includeCREATE SCHEMA IF NOT EXISTS "pgmq"!Unlike PR #4471, PR #4940 does not add any custom Go-level retries or extension management; it strictly reverts the unintended schema exclusions.
github-actions commentedon Jun 17, 2026
Hi! Thanks for opening this issue.
We're closing this because it has not had any activity for 45 days, and we try to keep the Supabase CLI issue tracker focused on reports that are still current.
If this still reproduces on the latest Supabase CLI, please comment with
/reopenon its own line and include your CLI version, updated reproduction steps, and any recent error output. We appreciate the signal and are happy to take another look.