aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2019-08-21 10:43:23 -0400
committerTom Lane <tgl@sss.pgh.pa.us>2019-08-21 10:43:23 -0400
commitbbd93667bde56d3900add55479759f33d20ece1e (patch)
tree6aa7c14fe761a51502fd85d8f848a5eb80a87ae7 /src
parent3f0f99125e5c0fd704de3c07abe691ebefc51a50 (diff)
downloadpostgresql-bbd93667bde56d3900add55479759f33d20ece1e.tar.gz
postgresql-bbd93667bde56d3900add55479759f33d20ece1e.zip
Remove unnecessary test dependency on the contents of pg_pltemplate.
Using pg_pltemplate as test data was probably not very forward-looking, considering we've had many discussions around removing that catalog altogether. Use a nearby temp table instead, to make these two test scripts more self-contained. This is a better test case anyway, since it exercises the scenario where the entries in the anyarray column actually vary in type intra-query.
Diffstat (limited to 'src')
-rw-r--r--src/test/regress/expected/json.out16
-rw-r--r--src/test/regress/expected/jsonb.out22
-rw-r--r--src/test/regress/sql/json.sql8
-rw-r--r--src/test/regress/sql/jsonb.sql16
4 files changed, 39 insertions, 23 deletions
diff --git a/src/test/regress/expected/json.out b/src/test/regress/expected/json.out
index 69b0a6ee6d6..c4156cf2a66 100644
--- a/src/test/regress/expected/json.out
+++ b/src/test/regress/expected/json.out
@@ -384,13 +384,17 @@ SELECT row_to_json(row((select array_agg(x) as d from generate_series(5,10) x)),
(1 row)
-- anyarray column
-select to_json(histogram_bounds) histogram_bounds
+analyze rows;
+select attname, to_json(histogram_bounds) histogram_bounds
from pg_stats
-where attname = 'tmplname' and tablename = 'pg_pltemplate';
- histogram_bounds
----------------------------------------------------------------------------------------
- ["plperl","plperlu","plpgsql","plpython2u","plpython3u","plpythonu","pltcl","pltclu"]
-(1 row)
+where tablename = 'rows' and
+ schemaname = pg_my_temp_schema()::regnamespace::text
+order by 1;
+ attname | histogram_bounds
+---------+------------------------
+ x | [1,2,3]
+ y | ["txt1","txt2","txt3"]
+(2 rows)
-- to_json, timestamps
select to_json(timestamp '2014-05-28 12:22:35.614298');
diff --git a/src/test/regress/expected/jsonb.out b/src/test/regress/expected/jsonb.out
index 0f917557942..a2a19f81041 100644
--- a/src/test/regress/expected/jsonb.out
+++ b/src/test/regress/expected/jsonb.out
@@ -280,13 +280,20 @@ SELECT array_to_json(ARRAY [jsonb '{"a":1}', jsonb '{"b":[2,3]}']);
(1 row)
-- anyarray column
-select to_jsonb(histogram_bounds) histogram_bounds
+CREATE TEMP TABLE rows AS
+SELECT x, 'txt' || x as y
+FROM generate_series(1,3) AS x;
+analyze rows;
+select attname, to_jsonb(histogram_bounds) histogram_bounds
from pg_stats
-where attname = 'tmplname' and tablename = 'pg_pltemplate';
- histogram_bounds
-----------------------------------------------------------------------------------------------
- ["plperl", "plperlu", "plpgsql", "plpython2u", "plpython3u", "plpythonu", "pltcl", "pltclu"]
-(1 row)
+where tablename = 'rows' and
+ schemaname = pg_my_temp_schema()::regnamespace::text
+order by 1;
+ attname | histogram_bounds
+---------+--------------------------
+ x | [1, 2, 3]
+ y | ["txt1", "txt2", "txt3"]
+(2 rows)
-- to_jsonb, timestamps
select to_jsonb(timestamp '2014-05-28 12:22:35.614298');
@@ -354,9 +361,6 @@ select to_jsonb(timestamptz '-Infinity');
(1 row)
--jsonb_agg
-CREATE TEMP TABLE rows AS
-SELECT x, 'txt' || x as y
-FROM generate_series(1,3) AS x;
SELECT jsonb_agg(q)
FROM ( SELECT $$a$$ || x AS b, y AS c,
ARRAY[ROW(x.*,ARRAY[1,2,3]),
diff --git a/src/test/regress/sql/json.sql b/src/test/regress/sql/json.sql
index e0216645923..20354f04e37 100644
--- a/src/test/regress/sql/json.sql
+++ b/src/test/regress/sql/json.sql
@@ -104,9 +104,13 @@ SELECT row_to_json(row((select array_agg(x) as d from generate_series(5,10) x)),
-- anyarray column
-select to_json(histogram_bounds) histogram_bounds
+analyze rows;
+
+select attname, to_json(histogram_bounds) histogram_bounds
from pg_stats
-where attname = 'tmplname' and tablename = 'pg_pltemplate';
+where tablename = 'rows' and
+ schemaname = pg_my_temp_schema()::regnamespace::text
+order by 1;
-- to_json, timestamps
diff --git a/src/test/regress/sql/jsonb.sql b/src/test/regress/sql/jsonb.sql
index 58703a90b70..efd4c451853 100644
--- a/src/test/regress/sql/jsonb.sql
+++ b/src/test/regress/sql/jsonb.sql
@@ -64,9 +64,17 @@ SELECT array_to_json(ARRAY [jsonb '{"a":1}', jsonb '{"b":[2,3]}']);
-- anyarray column
-select to_jsonb(histogram_bounds) histogram_bounds
+CREATE TEMP TABLE rows AS
+SELECT x, 'txt' || x as y
+FROM generate_series(1,3) AS x;
+
+analyze rows;
+
+select attname, to_jsonb(histogram_bounds) histogram_bounds
from pg_stats
-where attname = 'tmplname' and tablename = 'pg_pltemplate';
+where tablename = 'rows' and
+ schemaname = pg_my_temp_schema()::regnamespace::text
+order by 1;
-- to_jsonb, timestamps
@@ -90,10 +98,6 @@ select to_jsonb(timestamptz '-Infinity');
--jsonb_agg
-CREATE TEMP TABLE rows AS
-SELECT x, 'txt' || x as y
-FROM generate_series(1,3) AS x;
-
SELECT jsonb_agg(q)
FROM ( SELECT $$a$$ || x AS b, y AS c,
ARRAY[ROW(x.*,ARRAY[1,2,3]),