fix sorting on string litteral (#4045)

As noted by Talha https://github.com/citusdata/citus/pull/4029#issuecomment-660466972 there was still some sort order flappiness in the test.

The root cause is that sorting on `1::text` sorts on the literal `'1'` which causes sorting to be indeterministic.

This behaviour is consistent with Postgres' behaviour, so no bug on Citus' side.
pull/4035/head
Nils Dijk 2020-07-20 17:39:27 +02:00 committed by GitHub
parent 32d9cce8a2
commit 00a4a15d95
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View File

@ -121,7 +121,7 @@ SELECT a + 1, a - 1 FROM t0 ORDER BY 1;
3 | 1
(2 rows)
WITH cte1 AS (SELECT row_to_json(row(a))->'f1' FROM t0) SELECT * FROM cte1 ORDER BY 1::text;
WITH cte1 AS (SELECT row_to_json(row(a))->'f1' FROM t0) SELECT * FROM cte1 ORDER BY "?column?"::text;
?column?
---------------------------------------------------------------------
1

View File

@ -32,7 +32,7 @@ SELECT * FROM (SELECT b, '', '' FROM t0 GROUP BY b ) as foo ORDER BY 1;
-- some tests that follow very similar codeoaths
SELECT a + 1 FROM t0 ORDER BY 1;
SELECT a + 1, a - 1 FROM t0 ORDER BY 1;
WITH cte1 AS (SELECT row_to_json(row(a))->'f1' FROM t0) SELECT * FROM cte1 ORDER BY 1::text;
WITH cte1 AS (SELECT row_to_json(row(a))->'f1' FROM t0) SELECT * FROM cte1 ORDER BY "?column?"::text;
-- clean up after test
SET client_min_messages TO WARNING;