diff options
author | Pallavi Sontakke | 2016-02-10 07:05:27 +0000 |
---|---|---|
committer | Pavan Deolasee | 2016-10-18 09:57:45 +0000 |
commit | 7ed1ba850b7e1d12521e3e8113ff659c5dc4937f (patch) | |
tree | 453c3c046ab10fe09e7ad54a33657e9ceacbc78b | |
parent | c92296d6cd8d3f2dd0b6b39b3264c17d48e61c72 (diff) |
Test sql and output changes for hstore
Add order by clause for consistent test results from
json_agg() function
-rw-r--r-- | contrib/hstore/expected/hstore.out | 4 | ||||
-rw-r--r-- | contrib/hstore/sql/hstore.sql | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/contrib/hstore/expected/hstore.out b/contrib/hstore/expected/hstore.out index 9749e45c14..e4cf91504e 100644 --- a/contrib/hstore/expected/hstore.out +++ b/contrib/hstore/expected/hstore.out @@ -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}}, + diff --git a/contrib/hstore/sql/hstore.sql b/contrib/hstore/sql/hstore.sql index 5a9e9ee5ae..92c495cb97 100644 --- a/contrib/hstore/sql/hstore.sql +++ b/contrib/hstore/sql/hstore.sql @@ -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; |