mirror of
https://github.com/postgres/postgres.git
synced 2026-04-15 22:10:45 -04:00
Add output test for pg_dependencies statistics import
Commit302879bd68has added the ability to restore extended stats of the type "dependencies", but it has forgotten the addition of a test to verify that the value restored was actually set. This test is the pg_dependencies equivalent of the test added for pg_ndistinct in0e80f3f88d. Author: Corey Huinker <corey.huinker@gmail.com> Discussion: https://postgr.es/m/CADkLM=dZr_Ut3jKw94_BisyyDtNZPRJWeOALXVzcJz=ZFTAhvQ@mail.gmail.com
This commit is contained in:
parent
c6a10a89fe
commit
f9562b95c6
2 changed files with 19 additions and 0 deletions
|
|
@ -1814,6 +1814,7 @@ SELECT pg_catalog.pg_restore_extended_stats(
|
|||
t
|
||||
(1 row)
|
||||
|
||||
-- Check the presence of the restored stats, for each object.
|
||||
SELECT replace(e.n_distinct, '}, ', E'},\n') AS n_distinct
|
||||
FROM pg_stats_ext AS e
|
||||
WHERE e.statistics_schemaname = 'stats_import' AND
|
||||
|
|
@ -1824,6 +1825,17 @@ WHERE e.statistics_schemaname = 'stats_import' AND
|
|||
[{"attributes": [2, 3], "ndistinct": 4}]
|
||||
(1 row)
|
||||
|
||||
SELECT replace(e.dependencies, '}, ', E'},\n') AS dependencies
|
||||
FROM pg_stats_ext AS e
|
||||
WHERE e.statistics_schemaname = 'stats_import' AND
|
||||
e.statistics_name = 'test_stat_dependencies' AND
|
||||
e.inherited = false;
|
||||
dependencies
|
||||
------------------------------------------------------------
|
||||
[{"attributes": [2], "dependency": 3, "degree": 1.000000},+
|
||||
{"attributes": [3], "dependency": 2, "degree": 1.000000}]
|
||||
(1 row)
|
||||
|
||||
DROP SCHEMA stats_import CASCADE;
|
||||
NOTICE: drop cascades to 7 other objects
|
||||
DETAIL: drop cascades to type stats_import.complex_type
|
||||
|
|
|
|||
|
|
@ -1297,10 +1297,17 @@ SELECT pg_catalog.pg_restore_extended_stats(
|
|||
'dependencies', '[{"attributes": [2], "dependency": 3, "degree": 1.000000},
|
||||
{"attributes": [3], "dependency": 2, "degree": 1.000000}]'::pg_dependencies);
|
||||
|
||||
-- Check the presence of the restored stats, for each object.
|
||||
SELECT replace(e.n_distinct, '}, ', E'},\n') AS n_distinct
|
||||
FROM pg_stats_ext AS e
|
||||
WHERE e.statistics_schemaname = 'stats_import' AND
|
||||
e.statistics_name = 'test_stat_ndistinct' AND
|
||||
e.inherited = false;
|
||||
|
||||
SELECT replace(e.dependencies, '}, ', E'},\n') AS dependencies
|
||||
FROM pg_stats_ext AS e
|
||||
WHERE e.statistics_schemaname = 'stats_import' AND
|
||||
e.statistics_name = 'test_stat_dependencies' AND
|
||||
e.inherited = false;
|
||||
|
||||
DROP SCHEMA stats_import CASCADE;
|
||||
|
|
|
|||
Loading…
Reference in a new issue