Skip to content

Commit 862874b

Browse files
committed
tests for hash_replace_partition() added
1 parent 6c863e3 commit 862874b

File tree

2 files changed

+20
-9
lines changed

2 files changed

+20
-9
lines changed

expected/pathman_basic.out

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -920,13 +920,19 @@ Inherits: test.hash_rel
920920

921921
INSERT INTO test.hash_rel SELECT * FROM test.hash_rel_0;
922922
DROP TABLE test.hash_rel_0;
923-
EXPLAIN SELECT * FROM test.hash_rel;
924-
QUERY PLAN
925-
---------------------------------------------------------------------------------------------
926-
Append (cost=10000000000.00..30000000032.44 rows=2044 width=12)
927-
-> Seq Scan on hash_rel_extern (cost=10000000000.00..10000000030.40 rows=2040 width=12)
928-
-> Seq Scan on hash_rel_1 (cost=10000000000.00..10000000001.02 rows=2 width=12)
929-
-> Seq Scan on hash_rel_2 (cost=10000000000.00..10000000001.02 rows=2 width=12)
923+
/* Table with which we are replacing partition must have exact same structure */
924+
CREATE TABLE test.hash_rel_wrong(
925+
id INTEGER NOT NULL,
926+
value INTEGER);
927+
SELECT pathman.replace_hash_partition('test.hash_rel_1', 'test.hash_rel_wrong');
928+
ERROR: partition must have the exact same structure as parent
929+
EXPLAIN (COSTS OFF) SELECT * FROM test.hash_rel;
930+
QUERY PLAN
931+
-----------------------------------
932+
Append
933+
-> Seq Scan on hash_rel_extern
934+
-> Seq Scan on hash_rel_1
935+
-> Seq Scan on hash_rel_2
930936
(4 rows)
931937

932938
/*
@@ -1508,7 +1514,7 @@ SELECT count(*) FROM bool_test WHERE b = false;
15081514
DROP TABLE bool_test CASCADE;
15091515
NOTICE: drop cascades to 3 other objects
15101516
DROP SCHEMA test CASCADE;
1511-
NOTICE: drop cascades to 13 other objects
1517+
NOTICE: drop cascades to 14 other objects
15121518
DROP EXTENSION pg_pathman CASCADE;
15131519
NOTICE: drop cascades to 3 other objects
15141520
DROP SCHEMA pathman CASCADE;

sql/pathman_basic.sql

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,12 @@ SELECT pathman.replace_hash_partition('test.hash_rel_0', 'test.hash_rel_extern')
243243
\d+ test.hash_rel_extern
244244
INSERT INTO test.hash_rel SELECT * FROM test.hash_rel_0;
245245
DROP TABLE test.hash_rel_0;
246-
EXPLAIN SELECT * FROM test.hash_rel;
246+
/* Table with which we are replacing partition must have exact same structure */
247+
CREATE TABLE test.hash_rel_wrong(
248+
id INTEGER NOT NULL,
249+
value INTEGER);
250+
SELECT pathman.replace_hash_partition('test.hash_rel_1', 'test.hash_rel_wrong');
251+
EXPLAIN (COSTS OFF) SELECT * FROM test.hash_rel;
247252

248253
/*
249254
* Clean up

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