arange int4range,
tags text[]
) WITH (autovacuum_enabled = false);
+CREATE TABLE stats_import.test_mr(
+ id INTEGER PRIMARY KEY,
+ name text,
+ mrange int4multirange
+) WITH (autovacuum_enabled = false);
SELECT
pg_catalog.pg_restore_relation_stats(
'schemaname', 'stats_import',
stats_import | test | id | f | 0.36 | 5 | 0.6 | {2,1,3} | {0.3,0.25,0.05} | {1,2,3,4} | | | | | | |
(1 row)
+-- test for multiranges
+INSERT INTO stats_import.test_mr
+VALUES
+ (1, 'red', '{[1,3),[5,9),[20,30)}'::int4multirange),
+ (2, 'red', '{[11,13),[15,19),[20,30)}'::int4multirange),
+ (3, 'red', '{[21,23),[25,29),[120,130)}'::int4multirange);
+-- ensure that we set attribute stats for a multirange
+SELECT pg_catalog.pg_restore_attribute_stats(
+ 'schemaname', 'stats_import',
+ 'relname', 'test_mr',
+ 'attname', 'mrange',
+ 'inherited', false,
+ 'range_length_histogram', '{19,29,109}'::text,
+ 'range_empty_frac', '0'::real,
+ 'range_bounds_histogram', '{"[1,30)","[11,30)","[21,130)"}'::text
+);
+ pg_restore_attribute_stats
+----------------------------
+ t
+(1 row)
+
--
-- Test the ability to exactly copy data from one table to an identical table,
-- correctly reconstructing the stakind order as well as the staopN and
REVOKE ALL ON SCHEMA stats_import FROM regress_test_extstat_clear;
DROP ROLE regress_test_extstat_clear;
DROP SCHEMA stats_import CASCADE;
-NOTICE: drop cascades to 6 other objects
+NOTICE: drop cascades to 7 other objects
DETAIL: drop cascades to type stats_import.complex_type
drop cascades to table stats_import.test
+drop cascades to table stats_import.test_mr
drop cascades to table stats_import.part_parent
drop cascades to sequence stats_import.testseq
drop cascades to view stats_import.testview
tags text[]
) WITH (autovacuum_enabled = false);
+CREATE TABLE stats_import.test_mr(
+ id INTEGER PRIMARY KEY,
+ name text,
+ mrange int4multirange
+) WITH (autovacuum_enabled = false);
+
SELECT
pg_catalog.pg_restore_relation_stats(
'schemaname', 'stats_import',
AND inherited = false
AND attname = 'id';
+-- test for multiranges
+INSERT INTO stats_import.test_mr
+VALUES
+ (1, 'red', '{[1,3),[5,9),[20,30)}'::int4multirange),
+ (2, 'red', '{[11,13),[15,19),[20,30)}'::int4multirange),
+ (3, 'red', '{[21,23),[25,29),[120,130)}'::int4multirange);
+
+-- ensure that we set attribute stats for a multirange
+SELECT pg_catalog.pg_restore_attribute_stats(
+ 'schemaname', 'stats_import',
+ 'relname', 'test_mr',
+ 'attname', 'mrange',
+ 'inherited', false,
+ 'range_length_histogram', '{19,29,109}'::text,
+ 'range_empty_frac', '0'::real,
+ 'range_bounds_histogram', '{"[1,30)","[11,30)","[21,130)"}'::text
+);
+
--
-- Test the ability to exactly copy data from one table to an identical table,
-- correctly reconstructing the stakind order as well as the staopN and