test: assert routines are created before the views and triggers that call them - #194
Merged
Merged
Conversation
…call them The ordering fix shipped in 3.0.0-rc.9 with no test of its own. It was covered only incidentally, by a partition-trigger test that happens to need a function to exist — so a regression would have failed pointing at triggers rather than at ordering, and only on the Postgres legs. Confirmed the test earns its place: reverting DiffSorter to the previous order fails it with "Failed asserting that 2 is less than 0", and restoring the fix passes. The docblock above testUpOrderDropsProgrammableBeforeTables still described CreateRoutine as part of the trailing group with CreateView and CreateTrigger, which stopped being true when the fix landed. Corrected, with a pointer to the new test. Postgres suite 47 tests; unit + SQLite 333 tests. Co-Authored-By: Claude <noreply@anthropic.com>
|
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.



Why
The routine-ordering fix shipped in
3.0.0-rc.9(#192) with no test of its own.It was covered only incidentally — by a partition-trigger test that happens to need a function to exist. So a regression would have failed pointing at triggers rather than at ordering, and only on the Postgres legs. That is the kind of coverage that looks fine on a green run and misleads you on a red one.
I found this auditing my own work rather than from a failure, which is the better time to find it.
The bug it guards
CreateRoutineused to sort last, afterCreateViewandCreateTrigger, so a trigger whose function was also new was emitted before the function existed:Views have the same dependency, so both are asserted.
It earns its place
Verified the test actually fails without the fix rather than assuming it:
Also
The docblock on
testUpOrderDropsProgrammableBeforeTablesstill describedCreateRoutineas part of the trailing group withCreateViewandCreateTrigger— which stopped being true when the fix landed. Stale comments that contradict behaviour are worse than none, so it now points at the new test.Postgres suite 47 tests / 139 assertions; unit + SQLite 334 tests.
🤖 Generated with Claude Code