diff options
author | Alexander Korotkov <akorotkov@postgresql.org> | 2019-09-20 15:31:12 +0300 |
---|---|---|
committer | Alexander Korotkov <akorotkov@postgresql.org> | 2019-09-20 15:33:45 +0300 |
commit | 5033e9580869fec514d787dc9d3b0b63cce0bcfb (patch) | |
tree | 0db1af162c07e2096544279b975e855ce15e76be | |
parent | c53e40a132dca2ea8db73ce705a9019197ec338b (diff) | |
download | postgresql-5033e9580869fec514d787dc9d3b0b63cce0bcfb.tar.gz postgresql-5033e9580869fec514d787dc9d3b0b63cce0bcfb.zip |
Provide stable test for NULL-values in KNN SP-GiST
f5f084fc3e has removed test because of its instability. This commit provides
alternative test with determined ordering using extra ORDER BY expression.
Backpatch-through: 12
-rw-r--r-- | src/test/regress/expected/create_index_spgist.out | 10 | ||||
-rw-r--r-- | src/test/regress/sql/create_index_spgist.sql | 4 |
2 files changed, 14 insertions, 0 deletions
diff --git a/src/test/regress/expected/create_index_spgist.out b/src/test/regress/expected/create_index_spgist.out index 81b4a67c390..1dd110dfc51 100644 --- a/src/test/regress/expected/create_index_spgist.out +++ b/src/test/regress/expected/create_index_spgist.out @@ -555,6 +555,16 @@ WHERE seq.dist IS DISTINCT FROM idx.dist; ---+------+---+---+------+--- (0 rows) +-- check ORDER BY distance to NULL +SELECT (SELECT p FROM kd_point_tbl ORDER BY p <-> pt, p <-> '0,0' LIMIT 1) +FROM (VALUES (point '1,2'), (NULL), ('1234,5678')) pts(pt); + p +------------- + (59,21) + (59,21) + (1239,5647) +(3 rows) + EXPLAIN (COSTS OFF) SELECT count(*) FROM radix_text_tbl WHERE t = 'P0123456789abcdef'; QUERY PLAN diff --git a/src/test/regress/sql/create_index_spgist.sql b/src/test/regress/sql/create_index_spgist.sql index 66d77286356..68632e3732e 100644 --- a/src/test/regress/sql/create_index_spgist.sql +++ b/src/test/regress/sql/create_index_spgist.sql @@ -225,6 +225,10 @@ SELECT * FROM quad_point_tbl_ord_seq3 seq FULL JOIN kd_point_tbl_ord_idx3 idx ON seq.n = idx.n WHERE seq.dist IS DISTINCT FROM idx.dist; +-- check ORDER BY distance to NULL +SELECT (SELECT p FROM kd_point_tbl ORDER BY p <-> pt, p <-> '0,0' LIMIT 1) +FROM (VALUES (point '1,2'), (NULL), ('1234,5678')) pts(pt); + EXPLAIN (COSTS OFF) SELECT count(*) FROM radix_text_tbl WHERE t = 'P0123456789abcdef'; |