Commit bbd93667 authored by Tom Lane's avatar Tom Lane

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.
parent 3f0f9912
...@@ -384,13 +384,17 @@ SELECT row_to_json(row((select array_agg(x) as d from generate_series(5,10) x)), ...@@ -384,13 +384,17 @@ SELECT row_to_json(row((select array_agg(x) as d from generate_series(5,10) x)),
(1 row) (1 row)
-- anyarray column -- anyarray column
select to_json(histogram_bounds) histogram_bounds analyze rows;
select attname, to_json(histogram_bounds) histogram_bounds
from pg_stats from pg_stats
where attname = 'tmplname' and tablename = 'pg_pltemplate'; where tablename = 'rows' and
histogram_bounds schemaname = pg_my_temp_schema()::regnamespace::text
--------------------------------------------------------------------------------------- order by 1;
["plperl","plperlu","plpgsql","plpython2u","plpython3u","plpythonu","pltcl","pltclu"] attname | histogram_bounds
(1 row) ---------+------------------------
x | [1,2,3]
y | ["txt1","txt2","txt3"]
(2 rows)
-- to_json, timestamps -- to_json, timestamps
select to_json(timestamp '2014-05-28 12:22:35.614298'); select to_json(timestamp '2014-05-28 12:22:35.614298');
......
...@@ -280,13 +280,20 @@ SELECT array_to_json(ARRAY [jsonb '{"a":1}', jsonb '{"b":[2,3]}']); ...@@ -280,13 +280,20 @@ SELECT array_to_json(ARRAY [jsonb '{"a":1}', jsonb '{"b":[2,3]}']);
(1 row) (1 row)
-- anyarray column -- 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 from pg_stats
where attname = 'tmplname' and tablename = 'pg_pltemplate'; where tablename = 'rows' and
histogram_bounds schemaname = pg_my_temp_schema()::regnamespace::text
---------------------------------------------------------------------------------------------- order by 1;
["plperl", "plperlu", "plpgsql", "plpython2u", "plpython3u", "plpythonu", "pltcl", "pltclu"] attname | histogram_bounds
(1 row) ---------+--------------------------
x | [1, 2, 3]
y | ["txt1", "txt2", "txt3"]
(2 rows)
-- to_jsonb, timestamps -- to_jsonb, timestamps
select to_jsonb(timestamp '2014-05-28 12:22:35.614298'); select to_jsonb(timestamp '2014-05-28 12:22:35.614298');
...@@ -354,9 +361,6 @@ select to_jsonb(timestamptz '-Infinity'); ...@@ -354,9 +361,6 @@ select to_jsonb(timestamptz '-Infinity');
(1 row) (1 row)
--jsonb_agg --jsonb_agg
CREATE TEMP TABLE rows AS
SELECT x, 'txt' || x as y
FROM generate_series(1,3) AS x;
SELECT jsonb_agg(q) SELECT jsonb_agg(q)
FROM ( SELECT $$a$$ || x AS b, y AS c, FROM ( SELECT $$a$$ || x AS b, y AS c,
ARRAY[ROW(x.*,ARRAY[1,2,3]), ARRAY[ROW(x.*,ARRAY[1,2,3]),
......
...@@ -104,9 +104,13 @@ SELECT row_to_json(row((select array_agg(x) as d from generate_series(5,10) x)), ...@@ -104,9 +104,13 @@ SELECT row_to_json(row((select array_agg(x) as d from generate_series(5,10) x)),
-- anyarray column -- anyarray column
select to_json(histogram_bounds) histogram_bounds analyze rows;
select attname, to_json(histogram_bounds) histogram_bounds
from pg_stats 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 -- to_json, timestamps
......
...@@ -64,9 +64,17 @@ SELECT array_to_json(ARRAY [jsonb '{"a":1}', jsonb '{"b":[2,3]}']); ...@@ -64,9 +64,17 @@ SELECT array_to_json(ARRAY [jsonb '{"a":1}', jsonb '{"b":[2,3]}']);
-- anyarray column -- 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 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 -- to_jsonb, timestamps
...@@ -90,10 +98,6 @@ select to_jsonb(timestamptz '-Infinity'); ...@@ -90,10 +98,6 @@ select to_jsonb(timestamptz '-Infinity');
--jsonb_agg --jsonb_agg
CREATE TEMP TABLE rows AS
SELECT x, 'txt' || x as y
FROM generate_series(1,3) AS x;
SELECT jsonb_agg(q) SELECT jsonb_agg(q)
FROM ( SELECT $$a$$ || x AS b, y AS c, FROM ( SELECT $$a$$ || x AS b, y AS c,
ARRAY[ROW(x.*,ARRAY[1,2,3]), ARRAY[ROW(x.*,ARRAY[1,2,3]),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment