Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit9613a1d

Browse files
committed
Improve regression test for pg_filenode_relation().
Make it print the details in case there's a failure.Andres Freund, slightly modified by me
1 parente182701 commit9613a1d

File tree

2 files changed

+15
-26
lines changed

2 files changed

+15
-26
lines changed

‎src/test/regress/expected/alter_table.out

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2319,22 +2319,16 @@ Check constraints:
23192319
DROP TABLE alter2.tt8;
23202320
DROP SCHEMA alter2;
23212321
-- Check that we map relation oids to filenodes and back correctly.
2322-
--Don't displayall themappings so the test output doesn't change
2323-
--all thetime, but make sure we actually do test some values.
2322+
--Only displaybadmappings so the test output doesn't change all the
2323+
-- time.
23242324
SELECT
2325-
SUM((mapped_oid != oid OR mapped_oid IS NULL)::int) incorrectly_mapped,
2326-
count(*) > 200 have_mappings
2327-
FROM (
2328-
SELECT
2329-
oid, reltablespace, relfilenode, relname,
2330-
pg_filenode_relation(reltablespace, pg_relation_filenode(oid)) mapped_oid
2331-
FROM pg_class
2332-
WHERE relkind IN ('r', 'i', 'S', 't', 'm')
2333-
) mapped;
2334-
incorrectly_mapped | have_mappings
2335-
--------------------+---------------
2336-
0 | t
2337-
(1 row)
2325+
oid, mapped_oid, reltablespace, relfilenode, relname
2326+
FROM pg_class,
2327+
pg_filenode_relation(reltablespace, pg_relation_filenode(oid)) AS mapped_oid
2328+
WHERE relkind IN ('r', 'i', 'S', 't', 'm') AND mapped_oid IS DISTINCT FROM oid;
2329+
oid | mapped_oid | reltablespace | relfilenode | relname
2330+
-----+------------+---------------+-------------+---------
2331+
(0 rows)
23382332

23392333
-- Checks on creating and manipulation of user defined relations in
23402334
-- pg_catalog.

‎src/test/regress/sql/alter_table.sql

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1554,18 +1554,13 @@ DROP TABLE alter2.tt8;
15541554
DROPSCHEMA alter2;
15551555

15561556
-- Check that we map relation oids to filenodes and back correctly.
1557-
--Don't displayall themappings so the test output doesn't change
1558-
--all thetime, but make sure we actually do test some values.
1557+
--Only displaybadmappings so the test output doesn't change all the
1558+
-- time.
15591559
SELECT
1560-
SUM((mapped_oid!=oidOR mapped_oid ISNULL)::int) incorrectly_mapped,
1561-
count(*)>200 have_mappings
1562-
FROM (
1563-
SELECT
1564-
oid, reltablespace, relfilenode, relname,
1565-
pg_filenode_relation(reltablespace, pg_relation_filenode(oid)) mapped_oid
1566-
FROM pg_class
1567-
WHERE relkindIN ('r','i','S','t','m')
1568-
) mapped;
1560+
oid, mapped_oid, reltablespace, relfilenode, relname
1561+
FROM pg_class,
1562+
pg_filenode_relation(reltablespace, pg_relation_filenode(oid))AS mapped_oid
1563+
WHERE relkindIN ('r','i','S','t','m')AND mapped_oid IS DISTINCTFROMoid;
15691564

15701565
-- Checks on creating and manipulation of user defined relations in
15711566
-- pg_catalog.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp