Skip to content

Commit 9613a1d

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 parent e182701 commit 9613a1d

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 display all the mappings so the test output doesn't change
2323-
-- all the time, but make sure we actually do test some values.
2322+
-- Only display bad mappings 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
DROP SCHEMA alter2;
15551555

15561556
-- Check that we map relation oids to filenodes and back correctly.
1557-
-- Don't display all the mappings so the test output doesn't change
1558-
-- all the time, but make sure we actually do test some values.
1557+
-- Only display bad mappings so the test output doesn't change all the
1558+
-- time.
15591559
SELECT
1560-
SUM((mapped_oid != oid OR mapped_oid IS NULL)::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 relkind IN ('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 relkind IN ('r', 'i', 'S', 't', 'm') AND mapped_oid IS DISTINCT FROM oid;
15691564

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

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy