fix(branching): ensure pgmq extension creation syntax is dumped on branch operations#4940
fix(branching): ensure pgmq extension creation syntax is dumped on branch operations#4940dumko2001 wants to merge 1 commit intosupabase:developfrom
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Central YAML (base), Organization UI (inherited) Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
💤 Files with no reviewable changes (1)
📝 WalkthroughSummary by CodeRabbit
WalkthroughThe changes modify how the pgmq schema is handled in the migration system. The pgmq entry was removed from the ManagedSchemas exclusion list in drop.go, and the corresponding SQL schema-dropping filter now omits pgmq from its exclusion clause. Additionally, the dump_schema.sh script was updated to change the pgmq extension handling during pg_dump—instead of appending a semicolon, it now creates the pgmq schema explicitly and applies a WITH SCHEMA clause to the CREATE EXTENSION command. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
What kind of change does this PR introduce?
Bug fix #40666 #4492
What is the current behavior?
pgmqqueues fail to create during Supabase Branch Resets (producingschema pgmq does not existorsequence already existserrors).pg_dump --schema-onlyoriginally produced a segmentation fault with older versions ofpgmq(fixed intembo-io/pgmq1.5.0), leading to it being deliberately excluded indump.govia fix: exclude pgmq schema from db dump and pull #3043.CREATE SCHEMA pgmqis not emitted due to this exclusion,dump_schema.shattempts to strip the schema requirement fromCREATE EXTENSION IF NOT EXISTS pgmq WITH SCHEMA pgmq.WITH SCHEMAdefinition, the pgmq extension inappropriately initializes intopublicon Branch copies instead of its own schema. This breaks downstream logic, leaving orphaned tables on the branch.pgmqis explicitly ignored indrop.go/drop.sql, resulting in queue tables never actually being wiped when a Branch is Reset.What is the new behavior?
pgmqinsidedump_schema.sh. Instead of stripping the schema, it now prependsCREATE SCHEMA IF NOT EXISTS "pgmq";and preservesWITH SCHEMA "pgmq". This ensures pgmq is consistently installed in its correct schema during branch creations.pgmqfromManagedSchemasindrop.goand the exclusion array indrop.sql. This allowssupabase db resetand Branch Reset operations to accurately drop and rebuild thepgmqschema, clearing the orphaned queue tables and sequences, preventing "already exists" failures during migrations.