Repository navigation
fix(drop): drop an auto-populated table's jobs table with it - #1615
Draft
dimitri-yatsenko wants to merge 1 commit into
Draft
dimitri-yatsenko wants to merge 1 commit into
dimitri-yatsenko wants to merge 1 commit into
Conversation
drop_quick() dropped only the table itself, so drop() left an auto-populated table's jobs table, ~~<table_name>, in place with its records and its primary key. A table later declared under the same name picked it up through its jobs property. When the new primary key was wider, populate(reserve_jobs=True) computed nothing and raised nothing: the old records, keyed on part of the new primary key, covered every new key. drop_quick() now drops the jobs table of a Computed or Imported table after the table itself. drop() reaches each table as a FreeTable, so the tier is read from the table name, as Schema.jobs does. A Manual or Lookup table never drops a jobs table, though a Manual `result` and a Computed `__result` map to the same `~~result`. The jobs table is itself dropped through drop_quick(), so its ~lineage rows and, on PostgreSQL, its enum type go with it. Jobs tables left by earlier releases remain, so the jobs property now checks an existing jobs table's primary key against the one it would be declared with, and raises if they differ, naming the jobs table and the command that removes it. Job computes its foreign-key-derived primary key once, so a table with a primary key attribute of its own still logs the "Ignoring non-FK primary key attribute" warning once per access. The tests run on MySQL and PostgreSQL. In the issue's reproduction, drop() removes ~~result and its lineage rows, and the table declared again with a wider primary key populates all six keys. drop_quick() removes ~~result too, with its enum type on PostgreSQL. Dropping a Manual table leaves the Computed table's ~~result in place. A jobs table left behind by a plain DROP TABLE makes jobs raise; the command in the message removes it, and populate then completes. A table with a primary key attribute of its own passes the check and warns once. Closes #1601.
dimitri-yatsenko
requested review from
MilagrosMarin,
lum-agilyti and
ttngu207
October 17, 2026 22:26
dimitri-yatsenko
marked this pull request as draft
October 18, 2026 00:20
Member
Author
|
Holding this as a draft: on PostgreSQL it would make an existing data-loss bug much more likely.
The enum fix goes in first, in its own PR; this one goes back to review after that. |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
drop_quick() dropped only the table itself, so drop() left an
auto-populated table's jobs table, ~~<table_name>, in place with its
records and its primary key. A table later declared under the same name
picked it up through its jobs property. When the new primary key was
wider, populate(reserve_jobs=True) computed nothing and raised nothing:
the old records, keyed on part of the new primary key, covered every new
key.
drop_quick() now drops the jobs table of a Computed or Imported table
after the table itself. drop() reaches each table as a FreeTable, so the
tier is read from the table name, as Schema.jobs does. A Manual or Lookup
table never drops a jobs table, though a Manual
resultand a Computed__resultmap to the same~~result. The jobs table is itself droppedthrough drop_quick(), so its ~lineage rows and, on PostgreSQL, its enum
type go with it.
Jobs tables left by earlier releases remain, so the jobs property now
checks an existing jobs table's primary key against the one it would be
declared with, and raises if they differ, naming the jobs table and the
command that removes it. Job computes its foreign-key-derived primary key
once, so a table with a primary key attribute of its own still logs the
"Ignoring non-FK primary key attribute" warning once per access.
The tests run on MySQL and PostgreSQL. In the issue's reproduction,
drop() removes ~~result and its lineage rows, and the table declared
again with a wider primary key populates all six keys. drop_quick()
removes ~~result too, with its enum type on PostgreSQL. Dropping a Manual
table leaves the Computed table's ~~result in place. A jobs table left
behind by a plain DROP TABLE makes jobs raise; the command in the message
removes it, and populate then completes. A table with a primary key
attribute of its own passes the check and warns once.
Closes #1601.