fix(repo): pg-upgrade counts tables with a query PostgreSQL accepts (#1245) #1333
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/1245-pg-upgrade-count"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Found by the 4.7.0-rc1 rehearsal on dev (#1245), which is what the rehearsal is for.
What happened.
make pg-upgradestopped at step 4 withERROR: collations are not supported by type integer. The count query endedorder by 1 collate "C", and PostgreSQL reads1there as the integer literal, not as "the first column". The script failed safe as designed: the new volume was removed, the old volume was untouched, and the app was left stopped. Dev was back on 4.6.2 within about two minutes, with every service healthy and no data changed.The fix. Order by
table_name::text collate "C". Checked read-only against dev's live PostgreSQL 16 (115 tables counted) and against a throwaway PostgreSQL 18.Why nothing caught it. The script's tests check the guard, the volumes and
sh -n, but none ran the query on a database. A new test now pullsCOUNT_SQLout of the script and runs it on the suite's own PostgreSQL. It passes with the fix (13 passed) and fails with the old query, with the same error dev saw. ruff is clean.Next: merge, cut
v4.7.0-rc2(rc1's tag contains the broken script), and run the dev rehearsal again.🤖 Generated with Claude Code