summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomas Vondra2017-08-30 23:12:35 +0000
committerTomas Vondra2017-08-30 23:12:35 +0000
commit20a13b337bdfb6833b4dc8c76f08076a2055eca4 (patch)
treecd5d20bbde507a5d1a29ca5a9ea9bb0c9a14be54
parent30cd960811fee23e5c72b2fe1e0d86b65a866185 (diff)
Stabilize ordering of results in pg_trgm contrib module
Add explicit ORDER BY clause to stabilize ordering of results for a few tests. Accept a simple plan change, distributing a LIMIT query.
-rw-r--r--contrib/pg_trgm/expected/pg_trgm.out12
-rw-r--r--contrib/pg_trgm/expected/pg_word_trgm.out12
-rw-r--r--contrib/pg_trgm/sql/pg_trgm.sql4
3 files changed, 15 insertions, 13 deletions
diff --git a/contrib/pg_trgm/expected/pg_trgm.out b/contrib/pg_trgm/expected/pg_trgm.out
index 81ccc594d4..8db8d6b7db 100644
--- a/contrib/pg_trgm/expected/pg_trgm.out
+++ b/contrib/pg_trgm/expected/pg_trgm.out
@@ -3603,13 +3603,13 @@ select * from test2 where t ~ 'a[bc]+d';
abcdef
(1 row)
-select * from test2 where t ~ '(abc)*$';
+select * from test2 where t ~ '(abc)*$' ORDER BY t;
t
-------------
- abcdef
- quark
z foo bar
/123/-45/
+ abcdef
+ quark
(4 rows)
select * from test2 where t ~* 'DEF';
@@ -3804,13 +3804,13 @@ select * from test2 where t ~ 'a[bc]+d';
abcdef
(1 row)
-select * from test2 where t ~ '(abc)*$';
+select * from test2 where t ~ '(abc)*$' ORDER BY t;
t
-------------
- abcdef
- quark
z foo bar
/123/-45/
+ abcdef
+ quark
(4 rows)
select * from test2 where t ~* 'DEF';
diff --git a/contrib/pg_trgm/expected/pg_word_trgm.out b/contrib/pg_trgm/expected/pg_word_trgm.out
index bed61c4922..dc5bcf41a4 100644
--- a/contrib/pg_trgm/expected/pg_word_trgm.out
+++ b/contrib/pg_trgm/expected/pg_word_trgm.out
@@ -152,12 +152,14 @@ select t,word_similarity('Kabankala',t) as sml from test_trgm2 where t %> 'Kaban
explain (costs off)
select t <->> 'Kabankala', t from test_trgm2 order by t <->> 'Kabankala' limit 7;
- QUERY PLAN
-------------------------------------------------
+ QUERY PLAN
+------------------------------------------------------------
Limit
- -> Index Scan using trgm_idx2 on test_trgm2
- Order By: (t <->> 'Kabankala'::text)
-(3 rows)
+ -> Remote Subquery Scan on all (datanode_1,datanode_2)
+ -> Limit
+ -> Index Scan using trgm_idx2 on test_trgm2
+ Order By: (t <->> 'Kabankala'::text)
+(5 rows)
select t <->> 'Kabankala', t from test_trgm2 order by t <->> 'Kabankala' limit 7;
?column? | t
diff --git a/contrib/pg_trgm/sql/pg_trgm.sql b/contrib/pg_trgm/sql/pg_trgm.sql
index fe8d0a7495..b91a7b527c 100644
--- a/contrib/pg_trgm/sql/pg_trgm.sql
+++ b/contrib/pg_trgm/sql/pg_trgm.sql
@@ -72,7 +72,7 @@ explain (costs off)
select * from test2 where t ~* 'DEF';
select * from test2 where t ~ '[abc]{3}';
select * from test2 where t ~ 'a[bc]+d';
-select * from test2 where t ~ '(abc)*$';
+select * from test2 where t ~ '(abc)*$' ORDER BY t;
select * from test2 where t ~* 'DEF';
select * from test2 where t ~ 'dEf';
select * from test2 where t ~* '^q';
@@ -110,7 +110,7 @@ explain (costs off)
select * from test2 where t ~* 'DEF';
select * from test2 where t ~ '[abc]{3}';
select * from test2 where t ~ 'a[bc]+d';
-select * from test2 where t ~ '(abc)*$';
+select * from test2 where t ~ '(abc)*$' ORDER BY t;
select * from test2 where t ~* 'DEF';
select * from test2 where t ~ 'dEf';
select * from test2 where t ~* '^q';