mirror of
https://git.postgresql.org/git/postgresql.git
synced 2026-02-22 22:37:01 +08:00
Add output test for pg_dependencies statistics import
Commit 302879bd68d115 has 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 in 0e80f3f88dea. 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:
@ -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;
|
||||
|
||||
Reference in New Issue
Block a user