@@ -10,7 +10,7 @@ INSERT INTO test.hash_rel VALUES (1, 1);
10
10
INSERT INTO test.hash_rel VALUES (2, 2);
11
11
INSERT INTO test.hash_rel VALUES (3, 3);
12
12
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 be marked NOT NULL
14
14
ALTER TABLE test.hash_rel ALTER COLUMN value SET NOT NULL;
15
15
SELECT pathman.create_hash_partitions('test.hash_rel', 'value', 3, partition_data:=false);
16
16
create_hash_partitions
@@ -81,7 +81,6 @@ SELECT * FROM test.hash_rel;
81
81
(3 rows)
82
82
83
83
SELECT pathman.drop_partitions('test.hash_rel');
84
- NOTICE: function test.hash_rel_upd_trig_func() does not exist, skipping
85
84
NOTICE: 0 rows copied from test.hash_rel_0
86
85
NOTICE: 0 rows copied from test.hash_rel_1
87
86
NOTICE: 0 rows copied from test.hash_rel_2
@@ -131,7 +130,7 @@ CREATE INDEX ON test.range_rel (dt);
131
130
INSERT INTO test.range_rel (dt, txt)
132
131
SELECT g, md5(g::TEXT) FROM generate_series('2015-01-01', '2015-04-30', '1 day'::interval) as g;
133
132
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 be marked NOT NULL
135
134
ALTER TABLE test.range_rel ALTER COLUMN dt SET NOT NULL;
136
135
SELECT pathman.create_range_partitions('test.range_rel', 'dt', '2015-01-01'::DATE, '1 month'::INTERVAL, 2);
137
136
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
262
261
263
262
DROP TABLE test.improved_dummy CASCADE;
264
263
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
265
335
/* Test pathman_rel_pathlist_hook() with INSERT query */
266
336
CREATE TABLE test.insert_into_select(val int NOT NULL);
267
337
INSERT INTO test.insert_into_select SELECT generate_series(1, 100);
@@ -368,49 +438,6 @@ NOTICE: drop cascades to 8 other objects
368
438
SET pg_pathman.enable_runtimeappend = OFF;
369
439
SET pg_pathman.enable_runtimemergeappend = OFF;
370
440
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
-
414
441
SET enable_indexscan = OFF;
415
442
SET enable_bitmapscan = OFF;
416
443
SET enable_seqscan = ON;
@@ -1121,6 +1148,7 @@ EXPLAIN (COSTS OFF) SELECT * FROM test.range_rel WHERE dt BETWEEN '2014-11-15' A
1121
1148
(6 rows)
1122
1149
1123
1150
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
1124
1152
detach_range_partition
1125
1153
------------------------
1126
1154
test.range_rel_archive
@@ -1141,12 +1169,12 @@ CREATE TABLE test.range_rel_test1 (
1141
1169
txt TEXT,
1142
1170
abc INTEGER);
1143
1171
SELECT pathman.attach_range_partition('test.range_rel', 'test.range_rel_test1', '2013-01-01'::DATE, '2014-01-01'::DATE);
1144
- ERROR: partition must have the exact same structure as parent
1172
+ ERROR: partition must have a compatible tuple format
1145
1173
CREATE TABLE test.range_rel_test2 (
1146
1174
id SERIAL PRIMARY KEY,
1147
1175
dt TIMESTAMP);
1148
1176
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
1150
1178
/* Half open ranges */
1151
1179
SELECT pathman.add_range_partition('test.range_rel', NULL, '2014-12-01'::DATE, 'test.range_rel_minus_infinity');
1152
1180
add_range_partition
@@ -1275,8 +1303,6 @@ SELECT pathman.replace_hash_partition('test.hash_rel_0', 'test.hash_rel_extern')
1275
1303
abc | integer | | plain | |
1276
1304
Indexes:
1277
1305
"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()
1280
1306
1281
1307
\d+ test.hash_rel_extern
1282
1308
Table "test.hash_rel_extern"
@@ -1298,7 +1324,7 @@ CREATE TABLE test.hash_rel_wrong(
1298
1324
id INTEGER NOT NULL,
1299
1325
value INTEGER);
1300
1326
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
1302
1328
EXPLAIN (COSTS OFF) SELECT * FROM test.hash_rel;
1303
1329
QUERY PLAN
1304
1330
-----------------------------------
@@ -1312,7 +1338,6 @@ EXPLAIN (COSTS OFF) SELECT * FROM test.hash_rel;
1312
1338
* Clean up
1313
1339
*/
1314
1340
SELECT pathman.drop_partitions('test.hash_rel');
1315
- NOTICE: drop cascades to 2 other objects
1316
1341
NOTICE: 3 rows copied from test.hash_rel_1
1317
1342
NOTICE: 2 rows copied from test.hash_rel_2
1318
1343
NOTICE: 2 rows copied from test.hash_rel_extern
@@ -1334,7 +1359,6 @@ SELECT pathman.create_hash_partitions('test.hash_rel', 'value', 3);
1334
1359
(1 row)
1335
1360
1336
1361
SELECT pathman.drop_partitions('test.hash_rel', TRUE);
1337
- NOTICE: function test.hash_rel_upd_trig_func() does not exist, skipping
1338
1362
drop_partitions
1339
1363
-----------------
1340
1364
3
@@ -1348,8 +1372,7 @@ SELECT COUNT(*) FROM ONLY test.hash_rel;
1348
1372
1349
1373
DROP TABLE test.hash_rel CASCADE;
1350
1374
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
1353
1376
NOTICE: 1000 rows copied from test.num_range_rel_2
1354
1377
NOTICE: 1000 rows copied from test.num_range_rel_3
1355
1378
drop_partitions
@@ -1489,10 +1512,10 @@ SELECT * FROM test."TeSt";
1489
1512
1 | 1
1490
1513
(3 rows)
1491
1514
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
+
1496
1519
(1 row)
1497
1520
1498
1521
UPDATE test."TeSt" SET a = 1;
@@ -1521,7 +1544,6 @@ EXPLAIN (COSTS OFF) SELECT * FROM test."TeSt" WHERE a = 1;
1521
1544
(3 rows)
1522
1545
1523
1546
SELECT pathman.drop_partitions('test."TeSt"');
1524
- NOTICE: drop cascades to 3 other objects
1525
1547
NOTICE: 0 rows copied from test."TeSt_0"
1526
1548
NOTICE: 0 rows copied from test."TeSt_1"
1527
1549
NOTICE: 3 rows copied from test."TeSt_2"
@@ -1538,6 +1560,7 @@ SELECT * FROM test."TeSt";
1538
1560
1 | 1
1539
1561
(3 rows)
1540
1562
1563
+ DROP TABLE test."TeSt" CASCADE;
1541
1564
CREATE TABLE test."RangeRel" (
1542
1565
id SERIAL PRIMARY KEY,
1543
1566
dt TIMESTAMP NOT NULL,
@@ -1576,7 +1599,6 @@ SELECT pathman.split_range_partition('test."RangeRel_1"', '2015-01-01'::DATE);
1576
1599
(1 row)
1577
1600
1578
1601
SELECT pathman.drop_partitions('test."RangeRel"');
1579
- NOTICE: function test.RangeRel_upd_trig_func() does not exist, skipping
1580
1602
NOTICE: 0 rows copied from test."RangeRel_1"
1581
1603
NOTICE: 1 rows copied from test."RangeRel_2"
1582
1604
NOTICE: 1 rows copied from test."RangeRel_3"
@@ -1612,7 +1634,6 @@ SELECT pathman.create_range_partitions('test."RangeRel"', 'id', 1, 100, 3);
1612
1634
(1 row)
1613
1635
1614
1636
SELECT pathman.drop_partitions('test."RangeRel"');
1615
- NOTICE: function test.RangeRel_upd_trig_func() does not exist, skipping
1616
1637
NOTICE: 0 rows copied from test."RangeRel_1"
1617
1638
NOTICE: 0 rows copied from test."RangeRel_2"
1618
1639
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 = '
1770
1791
DELETE FROM test.range_rel r USING test.tmp t WHERE r.dt = '2010-01-02' AND r.id = t.id;
1771
1792
/* Create range partitions from whole range */
1772
1793
SELECT drop_partitions('test.range_rel');
1773
- NOTICE: function test.range_rel_upd_trig_func() does not exist, skipping
1774
1794
NOTICE: 44 rows copied from test.range_rel_1
1775
1795
NOTICE: 31 rows copied from test.range_rel_3
1776
1796
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);
1797
1817
(1 row)
1798
1818
1799
1819
SELECT drop_partitions('test.range_rel', TRUE);
1800
- NOTICE: function test.range_rel_upd_trig_func() does not exist, skipping
1801
1820
drop_partitions
1802
1821
-----------------
1803
1822
10
@@ -1997,6 +2016,6 @@ ORDER BY partition;
1997
2016
DROP TABLE test.provided_part_names CASCADE;
1998
2017
NOTICE: drop cascades to 2 other objects
1999
2018
DROP SCHEMA test CASCADE;
2000
- NOTICE: drop cascades to 48 other objects
2019
+ NOTICE: drop cascades to 47 other objects
2001
2020
DROP EXTENSION pg_pathman CASCADE;
2002
2021
DROP SCHEMA pathman CASCADE;
0 commit comments