Skip to content

fix: hold back a sequence drop while a held-back table's default still uses it - #166

Merged
jasdeepkhalsa merged 1 commit into
mainfrom
fix/held-back-sequence-drop
Nov 5, 2026
Merged

jasdeepkhalsa merged 1 commit into
mainfrom
fix/held-back-sequence-drop

Conversation

@jasdeepkhalsa

Copy link
Copy Markdown
Member

Without --allow-destructive, a dropped table's DROP is held back. So is the drop of any type, domain, routine or sequence that the held-back table still uses, which SupaForge finds by searching the table's definition for the name.

A column default names its sequence only inside a string literal, nextval('public.shared_seq'::regclass), and the search ran over a form of the SQL with literals blanked. So the sequence was dropped anyway. That failed with cannot drop sequence shared_seq because other objects depend on it, and rolled back the other fixes in its batch.

The search now also covers sequence names in nextval('…') and '…'::regclass literals.

Found by the corpus case sequence_shared_and_owned_with_options (after → before), once DBDiff writes that column's change as a plain default change rather than a serial change containing its own DROP SEQUENCE. The new test fails without the fix; the same scan through the CLI now applies the column change and holds back both drops, with no errors.

🤖 Generated with Claude Code

…l uses it

A column default names its sequence only inside a string literal
(nextval('public.shared_seq'::regclass)), which the skeleton the check
searches blanks. Without --allow-destructive, a dropped table was held back
but the sequence its default drew on was dropped anyway, failed with
"cannot drop sequence ... because other objects depend on it", and rolled
back the other fixes in its batch.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@jasdeepkhalsa
jasdeepkhalsa merged commit a84d971 into main Nov 5, 2026
28 checks passed
@jasdeepkhalsa
jasdeepkhalsa deleted the fix/held-back-sequence-drop branch November 5, 2026 01:22
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.

1 participant