Skip to content

Commit e9d7b1d

Browse files
authored
Fix locale-dependent ordering in cypher_merge tests (#2558)
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.
1 parent d40b88b commit e9d7b1d

2 files changed

Lines changed: 8 additions & 8 deletions

File tree

‎regress/expected/cypher_merge.out‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1759,8 +1759,8 @@ $$) AS (a agtype);
17591759
SELECT * FROM cypher('issue_1446', $$
17601760
MATCH (n)
17611761
RETURN labels(n) AS label, count(*) AS cnt
1762-
ORDER BY label
1763-
$$) AS (label agtype, cnt agtype);
1762+
$$) AS (label agtype, cnt agtype)
1763+
ORDER BY label::text COLLATE "C";
17641764
label | cnt
17651765
-------+-----
17661766
["A"] | 1
@@ -1807,8 +1807,8 @@ $$) AS (a agtype);
18071807
SELECT * FROM cypher('issue_1446', $$
18081808
MATCH (n)
18091809
RETURN labels(n) AS label, count(*) AS cnt
1810-
ORDER BY label
1811-
$$) AS (label agtype, cnt agtype);
1810+
$$) AS (label agtype, cnt agtype)
1811+
ORDER BY label::text COLLATE "C";
18121812
label | cnt
18131813
------------+-----
18141814
["X"] | 1

‎regress/sql/cypher_merge.sql‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -811,8 +811,8 @@ $$) AS (a agtype);
811811
SELECT * FROM cypher('issue_1446', $$
812812
MATCH (n)
813813
RETURN labels(n) AS label, count(*) AS cnt
814-
ORDER BY label
815-
$$) AS (label agtype, cnt agtype);
814+
$$) AS (label agtype, cnt agtype)
815+
ORDER BY label::text COLLATE "C";
816816
SELECT * FROM cypher('issue_1446', $$
817817
MATCH ()-[e]->()
818818
RETURN count(*) AS edge_count
@@ -833,8 +833,8 @@ $$) AS (a agtype);
833833
SELECT * FROM cypher('issue_1446', $$
834834
MATCH (n)
835835
RETURN labels(n) AS label, count(*) AS cnt
836-
ORDER BY label
837-
$$) AS (label agtype, cnt agtype);
836+
$$) AS (label agtype, cnt agtype)
837+
ORDER BY label::text COLLATE "C";
838838
SELECT * FROM cypher('issue_1446', $$
839839
MATCH ()-[e]->()
840840
RETURN count(*) AS edge_count

0 commit comments

Comments
 (0)