Skip to content

Commit 10838a1

Browse files
committed
Rewrite \d+ in regression tests
1 parent f69e676 commit 10838a1

File tree

2 files changed

+57
-24
lines changed

2 files changed

+57
-24
lines changed

expected/pathman_basic.out

Lines changed: 40 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1441,28 +1441,46 @@ SELECT pathman.replace_hash_partition('test.hash_rel_0', 'test.hash_rel_extern')
14411441
test.hash_rel_extern
14421442
(1 row)
14431443

1444-
\d+ test.hash_rel_0
1445-
Table "test.hash_rel_0"
1446-
Column | Type | Modifiers | Storage | Stats target | Description
1447-
--------+---------+------------------------------------------------------------+---------+--------------+-------------
1448-
id | integer | not null default nextval('test.hash_rel_id_seq'::regclass) | plain | |
1449-
value | integer | not null | plain | |
1450-
abc | integer | | plain | |
1451-
Indexes:
1452-
"hash_rel_0_pkey" PRIMARY KEY, btree (id)
1453-
1454-
\d+ test.hash_rel_extern
1455-
Table "test.hash_rel_extern"
1456-
Column | Type | Modifiers | Storage | Stats target | Description
1457-
--------+---------+------------------------------------------------------------+---------+--------------+-------------
1458-
id | integer | not null default nextval('test.hash_rel_id_seq'::regclass) | plain | |
1459-
value | integer | not null | plain | |
1460-
abc | integer | | plain | |
1461-
Indexes:
1462-
"hash_rel_extern_pkey" PRIMARY KEY, btree (id)
1463-
Check constraints:
1464-
"pathman_hash_rel_extern_check" CHECK (pathman.get_hash_part_idx(hashint4(value), 3) = 0)
1465-
Inherits: test.hash_rel
1444+
/* Check the consistency of test.hash_rel_0 and test.hash_rel_extern relations */
1445+
EXPLAIN(COSTS OFF) SELECT * FROM test.hash_rel;
1446+
QUERY PLAN
1447+
-----------------------------------
1448+
Append
1449+
-> Seq Scan on hash_rel_extern
1450+
-> Seq Scan on hash_rel_1
1451+
-> Seq Scan on hash_rel_2
1452+
(4 rows)
1453+
1454+
SELECT parent, partition, parttype
1455+
FROM pathman.pathman_partition_list
1456+
WHERE parent='test.hash_rel'::regclass
1457+
ORDER BY 2;
1458+
parent | partition | parttype
1459+
---------------+----------------------+----------
1460+
test.hash_rel | test.hash_rel_1 | 1
1461+
test.hash_rel | test.hash_rel_2 | 1
1462+
test.hash_rel | test.hash_rel_extern | 1
1463+
(3 rows)
1464+
1465+
SELECT c.oid::regclass::text,
1466+
array_agg(pg_get_indexdef(i.indexrelid)) AS indexes,
1467+
array_agg(pg_get_triggerdef(t.oid)) AS triggers
1468+
FROM pg_class c
1469+
LEFT JOIN pg_index i ON c.oid=i.indrelid
1470+
LEFT JOIN pg_trigger t ON c.oid=t.tgrelid
1471+
WHERE c.oid IN ('test.hash_rel_0'::regclass, 'test.hash_rel_extern'::regclass)
1472+
GROUP BY 1 ORDER BY 1;
1473+
oid | indexes | triggers
1474+
----------------------+---------------------------------------------------------------------------------------+----------
1475+
test.hash_rel_0 | {"CREATE UNIQUE INDEX hash_rel_0_pkey ON test.hash_rel_0 USING btree (id)"} | {NULL}
1476+
test.hash_rel_extern | {"CREATE UNIQUE INDEX hash_rel_extern_pkey ON test.hash_rel_extern USING btree (id)"} | {NULL}
1477+
(2 rows)
1478+
1479+
SELECT pathman.is_tuple_convertible('test.hash_rel_0', 'test.hash_rel_extern');
1480+
is_tuple_convertible
1481+
----------------------
1482+
t
1483+
(1 row)
14661484

14671485
INSERT INTO test.hash_rel SELECT * FROM test.hash_rel_0;
14681486
DROP TABLE test.hash_rel_0;

sql/pathman_basic.sql

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -382,8 +382,23 @@ SELECT * FROM test.hash_rel WHERE id = 123;
382382
/* Test replacing hash partition */
383383
CREATE TABLE test.hash_rel_extern (LIKE test.hash_rel INCLUDING ALL);
384384
SELECT pathman.replace_hash_partition('test.hash_rel_0', 'test.hash_rel_extern');
385-
\d+ test.hash_rel_0
386-
\d+ test.hash_rel_extern
385+
386+
/* Check the consistency of test.hash_rel_0 and test.hash_rel_extern relations */
387+
EXPLAIN(COSTS OFF) SELECT * FROM test.hash_rel;
388+
SELECT parent, partition, parttype
389+
FROM pathman.pathman_partition_list
390+
WHERE parent='test.hash_rel'::regclass
391+
ORDER BY 2;
392+
SELECT c.oid::regclass::text,
393+
array_agg(pg_get_indexdef(i.indexrelid)) AS indexes,
394+
array_agg(pg_get_triggerdef(t.oid)) AS triggers
395+
FROM pg_class c
396+
LEFT JOIN pg_index i ON c.oid=i.indrelid
397+
LEFT JOIN pg_trigger t ON c.oid=t.tgrelid
398+
WHERE c.oid IN ('test.hash_rel_0'::regclass, 'test.hash_rel_extern'::regclass)
399+
GROUP BY 1 ORDER BY 1;
400+
SELECT pathman.is_tuple_convertible('test.hash_rel_0', 'test.hash_rel_extern');
401+
387402
INSERT INTO test.hash_rel SELECT * FROM test.hash_rel_0;
388403
DROP TABLE test.hash_rel_0;
389404
/* Table with which we are replacing partition must have exact same structure */

0 commit comments

Comments
 (0)