Test sql and output changes for hstore
authorPallavi Sontakke <[email protected]>
Wed, 10 Feb 2016 07:05:27 +0000 (12:35 +0530)
committerPallavi Sontakke <[email protected]>
Wed, 10 Feb 2016 07:05:27 +0000 (12:35 +0530)
Add order by clause for consistent test results from
json_agg() function

contrib/hstore/expected/hstore.out
contrib/hstore/sql/hstore.sql

index 9749e45c14392acafb89201dba55a8f3c0663b73..e4cf91504e2adf2517a3fae344ef9bc71c1a088e 100644 (file)
@@ -1493,14 +1493,14 @@ select hstore_to_jsonb_loose('"a key" =>1, b => t, c => null, d=> 12345, e => 01
 create table test_json_agg (f1 text, f2 hstore);
 insert into test_json_agg values ('rec1','"a key" =>1, b => t, c => null, d=> 12345, e => 012345, f=> 1.234, g=> 2.345e+4'),
        ('rec2','"a key" =>2, b => f, c => "null", d=> -12345, e => 012345.6, f=> -1.234, g=> 0.345e-4');
-select json_agg(q) from test_json_agg q;
+select json_agg(q order by (f1)) from test_json_agg q;
                                                           json_agg                                                          
 ----------------------------------------------------------------------------------------------------------------------------
  [{"f1":"rec1","f2":{"b": "t", "c": null, "d": "12345", "e": "012345", "f": "1.234", "g": "2.345e+4", "a key": "1"}},      +
   {"f1":"rec2","f2":{"b": "f", "c": "null", "d": "-12345", "e": "012345.6", "f": "-1.234", "g": "0.345e-4", "a key": "2"}}]
 (1 row)
 
-select json_agg(q) from (select f1, hstore_to_json_loose(f2) as f2 from test_json_agg) q;
+select json_agg(q order by f1) from (select f1, hstore_to_json_loose(f2) as f2 from test_json_agg) q;
                                                        json_agg                                                       
 ----------------------------------------------------------------------------------------------------------------------
  [{"f1":"rec1","f2":{"b": true, "c": null, "d": 12345, "e": "012345", "f": 1.234, "g": 2.345e+4, "a key": 1}},       +
index 5a9e9ee5ae8b2c18b49f8a31929ed873c282af63..92c495cb974d4726ed759f7cbbb4b198237ee0b6 100644 (file)
@@ -343,5 +343,5 @@ select hstore_to_jsonb_loose('"a key" =>1, b => t, c => null, d=> 12345, e => 01
 create table test_json_agg (f1 text, f2 hstore);
 insert into test_json_agg values ('rec1','"a key" =>1, b => t, c => null, d=> 12345, e => 012345, f=> 1.234, g=> 2.345e+4'),
        ('rec2','"a key" =>2, b => f, c => "null", d=> -12345, e => 012345.6, f=> -1.234, g=> 0.345e-4');
-select json_agg(q) from test_json_agg q;
-select json_agg(q) from (select f1, hstore_to_json_loose(f2) as f2 from test_json_agg) q;
+select json_agg(q order by (f1)) from test_json_agg q;
+select json_agg(q order by f1) from (select f1, hstore_to_json_loose(f2) as f2 from test_json_agg) q;