Skip to content

Fix locale-dependent ordering in cypher_merge tests - #2558

Open
crdv7 wants to merge 1 commit into
apache:masterfrom
crdv7:fix-cypher-merge-locale-ordering
Open

Fix locale-dependent ordering in cypher_merge tests#2558
crdv7 wants to merge 1 commit into
apache:masterfrom
crdv7:fix-cypher-merge-locale-ordering

Conversation

@crdv7

@crdv7 crdv7 commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

The issue_1446 regression test orders labels(n) inside Cypher. Since the
result is an agtype value, its string components are compared using the
database's default collation. This makes the output order locale-dependent.
For example, the unmodified test returns the mixed-case labels in the
following orders:

C:             X, Y, Z, hub, shared
en_US.utf8:    hub, shared, X, Y, Z

The entities and counts are correct in both cases, but pg_regress reports a
failure because the row order differs from the expected output.

Move the incidental ordering out of Cypher and sort the displayed label text
with an explicit C collation. Apply the same deterministic ordering to both
issue_1446 verification queries. The test continues to verify the same
MERGE results without depending on the database locale.

This is the same class of regression-test portability issue addressed by
#2439.

The issue_1446 regression queries sort agtype labels using the database's
default collation, so their row order varies across database collations. For
example, C and en_US.utf8 order the mixed-case labels differently. Move the
incidental ordering to the enclosing SQL queries and use the C collation so
the expected output is independent of the database locale.
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.

1 participant