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

Commitf6651a5

Browse files
committed
Merge branch 'rel_future_beta' of github.com:postgrespro/pg_pathman into rel_future_beta
2 parentsd464d97 +af7128d commitf6651a5

32 files changed

+1815
-754
lines changed

‎Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ DATA = pg_pathman--1.0--1.1.sql \
2222
pg_pathman--1.1--1.2.sql\
2323
pg_pathman--1.2--1.3.sql
2424

25-
PGFILEDESC = "pg_pathman - partitioning tool"
25+
PGFILEDESC = "pg_pathman - partitioning tool for PostgreSQL"
2626

2727
REGRESS = pathman_basic\
2828
pathman_only\
@@ -39,6 +39,7 @@ REGRESS = pathman_basic \
3939
pathman_runtime_nodes\
4040
pathman_utility_stmt\
4141
pathman_column_type\
42+
pathman_update_trigger\
4243
pathman_calamity
4344

4445
EXTRA_REGRESS_OPTS=--temp-config=$(top_srcdir)/$(subdir)/conf.add

‎expected/pathman_basic.out

Lines changed: 84 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ INSERT INTO test.hash_rel VALUES (1, 1);
1010
INSERT INTO test.hash_rel VALUES (2, 2);
1111
INSERT INTO test.hash_rel VALUES (3, 3);
1212
SELECT pathman.create_hash_partitions('test.hash_rel', 'value', 3);
13-
ERROR: partitioning key "value" must be NOT NULL
13+
ERROR: partitioning key "value" must bemarkedNOT NULL
1414
ALTER TABLE test.hash_rel ALTER COLUMN value SET NOT NULL;
1515
SELECT pathman.create_hash_partitions('test.hash_rel', 'value', 3, partition_data:=false);
1616
create_hash_partitions
@@ -81,7 +81,6 @@ SELECT * FROM test.hash_rel;
8181
(3 rows)
8282

8383
SELECT pathman.drop_partitions('test.hash_rel');
84-
NOTICE: function test.hash_rel_upd_trig_func() does not exist, skipping
8584
NOTICE: 0 rows copied from test.hash_rel_0
8685
NOTICE: 0 rows copied from test.hash_rel_1
8786
NOTICE: 0 rows copied from test.hash_rel_2
@@ -131,7 +130,7 @@ CREATE INDEX ON test.range_rel (dt);
131130
INSERT INTO test.range_rel (dt, txt)
132131
SELECT g, md5(g::TEXT) FROM generate_series('2015-01-01', '2015-04-30', '1 day'::interval) as g;
133132
SELECT pathman.create_range_partitions('test.range_rel', 'dt', '2015-01-01'::DATE, '1 month'::INTERVAL, 2);
134-
ERROR: partitioning key "dt" must be NOT NULL
133+
ERROR: partitioning key "dt" must bemarkedNOT NULL
135134
ALTER TABLE test.range_rel ALTER COLUMN dt SET NOT NULL;
136135
SELECT pathman.create_range_partitions('test.range_rel', 'dt', '2015-01-01'::DATE, '1 month'::INTERVAL, 2);
137136
ERROR: not enough partitions to fit all values of "dt"
@@ -262,6 +261,77 @@ EXPLAIN (COSTS OFF) SELECT * FROM test.improved_dummy WHERE id = 101 OR id = 5 A
262261

263262
DROP TABLE test.improved_dummy CASCADE;
264263
NOTICE: drop cascades to 11 other objects
264+
/* since rel_1_4_beta: check create_range_partitions(bounds array) */
265+
CREATE TABLE test.improved_dummy (val INT NOT NULL);
266+
SELECT pathman.create_range_partitions('test.improved_dummy', 'val',
267+
pathman.generate_range_bounds(1, 1, 2));
268+
create_range_partitions
269+
-------------------------
270+
2
271+
(1 row)
272+
273+
SELECT * FROM pathman.pathman_partition_list
274+
WHERE parent = 'test.improved_dummy'::REGCLASS
275+
ORDER BY partition;
276+
parent | partition | parttype | partattr | range_min | range_max
277+
---------------------+-----------------------+----------+----------+-----------+-----------
278+
test.improved_dummy | test.improved_dummy_1 | 2 | val | 1 | 2
279+
test.improved_dummy | test.improved_dummy_2 | 2 | val | 2 | 3
280+
(2 rows)
281+
282+
SELECT pathman.drop_partitions('test.improved_dummy');
283+
NOTICE: 0 rows copied from test.improved_dummy_1
284+
NOTICE: 0 rows copied from test.improved_dummy_2
285+
drop_partitions
286+
-----------------
287+
2
288+
(1 row)
289+
290+
SELECT pathman.create_range_partitions('test.improved_dummy', 'val',
291+
pathman.generate_range_bounds(1, 1, 2),
292+
partition_names := '{p1, p2}');
293+
create_range_partitions
294+
-------------------------
295+
2
296+
(1 row)
297+
298+
SELECT * FROM pathman.pathman_partition_list
299+
WHERE parent = 'test.improved_dummy'::REGCLASS
300+
ORDER BY partition;
301+
parent | partition | parttype | partattr | range_min | range_max
302+
---------------------+-----------+----------+----------+-----------+-----------
303+
test.improved_dummy | p1 | 2 | val | 1 | 2
304+
test.improved_dummy | p2 | 2 | val | 2 | 3
305+
(2 rows)
306+
307+
SELECT pathman.drop_partitions('test.improved_dummy');
308+
NOTICE: 0 rows copied from p1
309+
NOTICE: 0 rows copied from p2
310+
drop_partitions
311+
-----------------
312+
2
313+
(1 row)
314+
315+
SELECT pathman.create_range_partitions('test.improved_dummy', 'val',
316+
pathman.generate_range_bounds(1, 1, 2),
317+
partition_names := '{p1, p2}',
318+
tablespaces := '{pg_default, pg_default}');
319+
create_range_partitions
320+
-------------------------
321+
2
322+
(1 row)
323+
324+
SELECT * FROM pathman.pathman_partition_list
325+
WHERE parent = 'test.improved_dummy'::REGCLASS
326+
ORDER BY partition;
327+
parent | partition | parttype | partattr | range_min | range_max
328+
---------------------+-----------+----------+----------+-----------+-----------
329+
test.improved_dummy | p1 | 2 | val | 1 | 2
330+
test.improved_dummy | p2 | 2 | val | 2 | 3
331+
(2 rows)
332+
333+
DROP TABLE test.improved_dummy CASCADE;
334+
NOTICE: drop cascades to 2 other objects
265335
/* Test pathman_rel_pathlist_hook() with INSERT query */
266336
CREATE TABLE test.insert_into_select(val int NOT NULL);
267337
INSERT INTO test.insert_into_select SELECT generate_series(1, 100);
@@ -368,49 +438,6 @@ NOTICE: drop cascades to 8 other objects
368438
SET pg_pathman.enable_runtimeappend = OFF;
369439
SET pg_pathman.enable_runtimemergeappend = OFF;
370440
VACUUM;
371-
/* update triggers test */
372-
SELECT pathman.create_hash_update_trigger('test.hash_rel');
373-
create_hash_update_trigger
374-
-----------------------------
375-
test.hash_rel_upd_trig_func
376-
(1 row)
377-
378-
UPDATE test.hash_rel SET value = 7 WHERE value = 6;
379-
EXPLAIN (COSTS OFF) SELECT * FROM test.hash_rel WHERE value = 7;
380-
QUERY PLAN
381-
------------------------------
382-
Append
383-
-> Seq Scan on hash_rel_1
384-
Filter: (value = 7)
385-
(3 rows)
386-
387-
SELECT * FROM test.hash_rel WHERE value = 7;
388-
id | value
389-
----+-------
390-
6 | 7
391-
(1 row)
392-
393-
SELECT pathman.create_range_update_trigger('test.num_range_rel');
394-
create_range_update_trigger
395-
----------------------------------
396-
test.num_range_rel_upd_trig_func
397-
(1 row)
398-
399-
UPDATE test.num_range_rel SET id = 3001 WHERE id = 1;
400-
EXPLAIN (COSTS OFF) SELECT * FROM test.num_range_rel WHERE id = 3001;
401-
QUERY PLAN
402-
-----------------------------------
403-
Append
404-
-> Seq Scan on num_range_rel_4
405-
Filter: (id = 3001)
406-
(3 rows)
407-
408-
SELECT * FROM test.num_range_rel WHERE id = 3001;
409-
id | txt
410-
------+----------------------------------
411-
3001 | c4ca4238a0b923820dcc509a6f75849b
412-
(1 row)
413-
414441
SET enable_indexscan = OFF;
415442
SET enable_bitmapscan = OFF;
416443
SET enable_seqscan = ON;
@@ -1121,6 +1148,7 @@ EXPLAIN (COSTS OFF) SELECT * FROM test.range_rel WHERE dt BETWEEN '2014-11-15' A
11211148
(6 rows)
11221149

11231150
SELECT pathman.detach_range_partition('test.range_rel_archive');
1151+
NOTICE: trigger "range_rel_upd_trig" for relation "test.range_rel_archive" does not exist, skipping
11241152
detach_range_partition
11251153
------------------------
11261154
test.range_rel_archive
@@ -1141,12 +1169,12 @@ CREATE TABLE test.range_rel_test1 (
11411169
txt TEXT,
11421170
abc INTEGER);
11431171
SELECT pathman.attach_range_partition('test.range_rel', 'test.range_rel_test1', '2013-01-01'::DATE, '2014-01-01'::DATE);
1144-
ERROR: partition must havethe exact same structure as parent
1172+
ERROR: partition must havea compatible tuple format
11451173
CREATE TABLE test.range_rel_test2 (
11461174
id SERIAL PRIMARY KEY,
11471175
dt TIMESTAMP);
11481176
SELECT pathman.attach_range_partition('test.range_rel', 'test.range_rel_test2', '2013-01-01'::DATE, '2014-01-01'::DATE);
1149-
ERROR:partition must have the exact same structure as parent
1177+
ERROR:column "dt" in child table must be marked NOT NULL
11501178
/* Half open ranges */
11511179
SELECT pathman.add_range_partition('test.range_rel', NULL, '2014-12-01'::DATE, 'test.range_rel_minus_infinity');
11521180
add_range_partition
@@ -1275,8 +1303,6 @@ SELECT pathman.replace_hash_partition('test.hash_rel_0', 'test.hash_rel_extern')
12751303
abc | integer | | plain | |
12761304
Indexes:
12771305
"hash_rel_0_pkey" PRIMARY KEY, btree (id)
1278-
Triggers:
1279-
hash_rel_upd_trig BEFORE UPDATE ON test.hash_rel_0 FOR EACH ROW EXECUTE PROCEDURE test.hash_rel_upd_trig_func()
12801306

12811307
\d+ test.hash_rel_extern
12821308
Table "test.hash_rel_extern"
@@ -1298,7 +1324,7 @@ CREATE TABLE test.hash_rel_wrong(
12981324
idINTEGER NOT NULL,
12991325
valueINTEGER);
13001326
SELECT pathman.replace_hash_partition('test.hash_rel_1', 'test.hash_rel_wrong');
1301-
ERROR:partition must have the exact same structure as parent
1327+
ERROR:column "value" in child table must be marked NOT NULL
13021328
EXPLAIN (COSTS OFF) SELECT * FROM test.hash_rel;
13031329
QUERY PLAN
13041330
-----------------------------------
@@ -1312,7 +1338,6 @@ EXPLAIN (COSTS OFF) SELECT * FROM test.hash_rel;
13121338
* Clean up
13131339
*/
13141340
SELECT pathman.drop_partitions('test.hash_rel');
1315-
NOTICE: drop cascades to 2 other objects
13161341
NOTICE: 3 rows copied from test.hash_rel_1
13171342
NOTICE: 2 rows copied from test.hash_rel_2
13181343
NOTICE: 2 rows copied from test.hash_rel_extern
@@ -1334,7 +1359,6 @@ SELECT pathman.create_hash_partitions('test.hash_rel', 'value', 3);
13341359
(1 row)
13351360

13361361
SELECT pathman.drop_partitions('test.hash_rel', TRUE);
1337-
NOTICE: function test.hash_rel_upd_trig_func() does not exist, skipping
13381362
drop_partitions
13391363
-----------------
13401364
3
@@ -1348,8 +1372,7 @@ SELECT COUNT(*) FROM ONLY test.hash_rel;
13481372

13491373
DROP TABLE test.hash_rel CASCADE;
13501374
SELECT pathman.drop_partitions('test.num_range_rel');
1351-
NOTICE: drop cascades to 3 other objects
1352-
NOTICE: 998 rows copied from test.num_range_rel_1
1375+
NOTICE: 999 rows copied from test.num_range_rel_1
13531376
NOTICE: 1000 rows copied from test.num_range_rel_2
13541377
NOTICE: 1000 rows copied from test.num_range_rel_3
13551378
drop_partitions
@@ -1489,10 +1512,10 @@ SELECT * FROM test."TeSt";
14891512
1 | 1
14901513
(3 rows)
14911514

1492-
SELECT pathman.create_hash_update_trigger('test."TeSt"');
1493-
create_hash_update_trigger
1494-
----------------------------
1495-
test."TeSt_upd_trig_func"
1515+
SELECT pathman.create_update_triggers('test."TeSt"');
1516+
create_update_triggers
1517+
------------------------
1518+
14961519
(1 row)
14971520

14981521
UPDATE test."TeSt" SET a = 1;
@@ -1521,7 +1544,6 @@ EXPLAIN (COSTS OFF) SELECT * FROM test."TeSt" WHERE a = 1;
15211544
(3 rows)
15221545

15231546
SELECT pathman.drop_partitions('test."TeSt"');
1524-
NOTICE: drop cascades to 3 other objects
15251547
NOTICE: 0 rows copied from test."TeSt_0"
15261548
NOTICE: 0 rows copied from test."TeSt_1"
15271549
NOTICE: 3 rows copied from test."TeSt_2"
@@ -1538,6 +1560,7 @@ SELECT * FROM test."TeSt";
15381560
1 | 1
15391561
(3 rows)
15401562

1563+
DROP TABLE test."TeSt" CASCADE;
15411564
CREATE TABLE test."RangeRel" (
15421565
idSERIAL PRIMARY KEY,
15431566
dtTIMESTAMP NOT NULL,
@@ -1576,7 +1599,6 @@ SELECT pathman.split_range_partition('test."RangeRel_1"', '2015-01-01'::DATE);
15761599
(1 row)
15771600

15781601
SELECT pathman.drop_partitions('test."RangeRel"');
1579-
NOTICE: function test.RangeRel_upd_trig_func() does not exist, skipping
15801602
NOTICE: 0 rows copied from test."RangeRel_1"
15811603
NOTICE: 1 rows copied from test."RangeRel_2"
15821604
NOTICE: 1 rows copied from test."RangeRel_3"
@@ -1612,7 +1634,6 @@ SELECT pathman.create_range_partitions('test."RangeRel"', 'id', 1, 100, 3);
16121634
(1 row)
16131635

16141636
SELECT pathman.drop_partitions('test."RangeRel"');
1615-
NOTICE: function test.RangeRel_upd_trig_func() does not exist, skipping
16161637
NOTICE: 0 rows copied from test."RangeRel_1"
16171638
NOTICE: 0 rows copied from test."RangeRel_2"
16181639
NOTICE: 0 rows copied from test."RangeRel_3"
@@ -1770,7 +1791,6 @@ EXPLAIN (COSTS OFF) DELETE FROM test.range_rel r USING test.tmp t WHERE r.dt = '
17701791
DELETE FROM test.range_rel r USING test.tmp t WHERE r.dt = '2010-01-02' AND r.id = t.id;
17711792
/* Create range partitions from whole range */
17721793
SELECT drop_partitions('test.range_rel');
1773-
NOTICE: function test.range_rel_upd_trig_func() does not exist, skipping
17741794
NOTICE: 44 rows copied from test.range_rel_1
17751795
NOTICE: 31 rows copied from test.range_rel_3
17761796
NOTICE: 30 rows copied from test.range_rel_4
@@ -1797,7 +1817,6 @@ SELECT create_partitions_from_range('test.range_rel', 'id', 1, 1000, 100);
17971817
(1 row)
17981818

17991819
SELECT drop_partitions('test.range_rel', TRUE);
1800-
NOTICE: function test.range_rel_upd_trig_func() does not exist, skipping
18011820
drop_partitions
18021821
-----------------
18031822
10
@@ -1997,6 +2016,6 @@ ORDER BY partition;
19972016
DROP TABLE test.provided_part_names CASCADE;
19982017
NOTICE: drop cascades to 2 other objects
19992018
DROP SCHEMA test CASCADE;
2000-
NOTICE: drop cascades to48 other objects
2019+
NOTICE: drop cascades to47 other objects
20012020
DROP EXTENSION pg_pathman CASCADE;
20022021
DROP SCHEMA pathman CASCADE;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp