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

Commit10838a1

Browse files
committed
Rewrite \d+ in regression tests
1 parentf69e676 commit10838a1

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
CREATETABLEtest.hash_rel_extern (LIKEtest.hash_rel INCLUDING ALL);
384384
SELECTpathman.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*FROMtest.hash_rel;
388+
SELECT parent, partition, parttype
389+
FROMpathman.pathman_partition_list
390+
WHERE parent='test.hash_rel'::regclass
391+
ORDER BY2;
392+
SELECTc.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 iONc.oid=i.indrelid
397+
LEFT JOIN pg_trigger tONc.oid=t.tgrelid
398+
WHEREc.oidIN ('test.hash_rel_0'::regclass,'test.hash_rel_extern'::regclass)
399+
GROUP BY1ORDER BY1;
400+
SELECTpathman.is_tuple_convertible('test.hash_rel_0','test.hash_rel_extern');
401+
387402
INSERT INTOtest.hash_relSELECT*FROMtest.hash_rel_0;
388403
DROPTABLEtest.hash_rel_0;
389404
/* Table with which we are replacing partition must have exact same structure*/

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp