Repository navigation
Fix URI collation migration on PostgreSQL - #928
Closed
niektenhoopen wants to merge 1 commit into
Closed
niektenhoopen wants to merge 1 commit into
niektenhoopen wants to merge 1 commit into
Conversation
The table name was bound as a parameter while still containing the
{{%table}} placeholder, which is only resolved in the SQL string, so
the regclass cast failed with an undefined relation.
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.
The
m261010_120000_make_uri_comparisons_sensitivemigration in 5.14.0 fails on PostgreSQL:The update is rolled back and the migration stays pending, so the site responds with 503 until it is resolved.
Cause
In the PostgreSQL branch, the table name is bound as a parameter of
CAST(:table AS regclass).CacheRecord::tableName()returns{{%blitz_caches}}, andSchema::quoteTableName()returns names containing{{unchanged. The{{%...}}placeholder is only resolved in the SQL string, not in parameter values, so PostgreSQL receives the literal placeholder.Fix
Bind
$tableSchema->fullNameinstead. The table schema is already loaded at the top of the migration, and itsfullNameis the resolved name with the table prefix applied (and the schema prepended when it is not the default schema).Testing
craft migrate/all.uricolumn has collationC, and is stillvarchar(2048) NOT NULL. A secondcraft upfinds nothing pending.UriCollationMigrationTest.phppass, and the new test fails against the unpatched migration.