Skip to content

Fix PostgreSQL column collation diff#7312

Open
HypeMC wants to merge 1 commit intodoctrine:3.10.xfrom
HypeMC:fix-postgres-collation-change
Open

Fix PostgreSQL column collation diff#7312
HypeMC wants to merge 1 commit intodoctrine:3.10.xfrom
HypeMC:fix-postgres-collation-change

Conversation

@HypeMC
Copy link
Contributor

@HypeMC HypeMC commented Feb 16, 2026

Q A
Type bug
Fixed issues -

Summary

Currently, column collation changes are ignored by the schema comparator when using PostgreSQLPlatform.

This PR fixes the issue.

The selectTableColumns query was updated to use collname, as it is the value used in SQL, whereas collcollate represents the underlying operating system LC_COLLATE value.

@HypeMC HypeMC force-pushed the fix-postgres-collation-change branch from 2d4a0a5 to d80fd21 Compare February 17, 2026 02:18
t.typname AS type,
format_type(a.atttypid, a.atttypmod) AS complete_type,
(SELECT tc.collcollate FROM pg_catalog.pg_collation tc WHERE tc.oid = a.attcollation) AS collation,
(SELECT tc.collname FROM pg_catalog.pg_collation tc WHERE tc.oid = a.attcollation) AS collation,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should explain why this change is OK and necessary (if it is).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it's necessary, as collcollate was returning NULL. collname is what's actually used in SQL, while collcollate is described in the docs as:

LC_COLLATE for this collation object. If the provider is not libc, collcollate is NULL and colllocale is used instead.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please include something about this in your commit message. Was this already used for something where it's ok to get null?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@greg0ire Commit message updated. This query seems to be used only for introspection. collname may still be null if the field is not of a string data type.

The `selectTableColumns` query was updated to use `collname`, as that is
the value used in SQL, whereas `collcollate` represents the underlying
operating system `LC_COLLATE` value.
@HypeMC HypeMC force-pushed the fix-postgres-collation-change branch from d80fd21 to 3cdebf6 Compare February 18, 2026 09:27
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.

2 participants