Skip to content

Commit a8c78ff

Browse files
committed
Merge branch 'rel_future_beta' of github.com:postgrespro/pg_pathman into rel_future_beta
2 parents f6651a5 + ddbae9d commit a8c78ff

16 files changed

+609
-220
lines changed

Makefile

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,22 +25,24 @@ DATA = pg_pathman--1.0--1.1.sql \
2525
PGFILEDESC = "pg_pathman - partitioning tool for PostgreSQL"
2626

2727
REGRESS = pathman_basic \
28-
pathman_only \
29-
pathman_cte \
3028
pathman_bgw \
31-
pathman_inserts \
32-
pathman_updates \
33-
pathman_domains \
34-
pathman_interval \
29+
pathman_calamity \
3530
pathman_callbacks \
31+
pathman_column_type \
32+
pathman_cte \
33+
pathman_domains \
3634
pathman_foreign_keys \
35+
pathman_inserts \
36+
pathman_interval \
37+
pathman_join_clause \
38+
pathman_only \
3739
pathman_permissions \
3840
pathman_rowmarks \
3941
pathman_runtime_nodes \
40-
pathman_utility_stmt \
41-
pathman_column_type \
4242
pathman_update_trigger \
43-
pathman_calamity
43+
pathman_updates \
44+
pathman_utility_stmt
45+
4446

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

README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -671,7 +671,8 @@ All sections and data will remain unchanged and will be handled by the standard
671671
Do not hesitate to post your issues, questions and new ideas at the [issues](https://github.com/postgrespro/pg_pathman/issues) page.
672672

673673
## Authors
674-
Ildar Musin <i.musin@postgrespro.ru> Postgres Professional Ltd., Russia
675-
Alexander Korotkov <a.korotkov@postgrespro.ru> Postgres Professional Ltd., Russia
676-
Dmitry Ivanov <d.ivanov@postgrespro.ru> Postgres Professional Ltd., Russia
674+
Ildar Musin <i.musin(at)postgrespro.ru> Postgres Professional Ltd., Russia
675+
Alexander Korotkov <a.korotkov(at)postgrespro.ru> Postgres Professional Ltd., Russia
676+
Dmitry Ivanov <d.ivanov(at)postgrespro.ru> Postgres Professional Ltd., Russia
677+
Maksim Milyutin <m.milyutin(at)postgrespro.ru> Postgres Professional Ltd., Russia
677678

expected/pathman_calamity.out

Lines changed: 95 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -102,23 +102,26 @@ SELECT count(*) FROM calamity.part_test;
102102
(1 row)
103103

104104
DELETE FROM calamity.part_test;
105+
/* test function create_single_range_partition() */
106+
SELECT create_single_range_partition(NULL, NULL::INT4, NULL); /* not ok */
107+
ERROR: 'parent_relid' should not be NULL
105108
/* test function create_range_partitions_internal() */
106-
SELECT create_range_partitions_internal(NULL, '{}'::INT[], NULL, NULL); /* not ok */
109+
SELECT create_range_partitions_internal(NULL, '{}'::INT[], NULL, NULL); /* not ok */
107110
ERROR: 'parent_relid' should not be NULL
108111
SELECT create_range_partitions_internal('calamity.part_test',
109-
NULL::INT[], NULL, NULL); /* not ok */
112+
NULL::INT[], NULL, NULL); /* not ok */
110113
ERROR: 'bounds' should not be NULL
111114
SELECT create_range_partitions_internal('calamity.part_test', '{1}'::INT[],
112-
'{part_1}'::TEXT[], NULL); /* not ok */
115+
'{part_1}'::TEXT[], NULL); /* not ok */
113116
ERROR: wrong length of 'partition_names' array
114117
SELECT create_range_partitions_internal('calamity.part_test', '{1}'::INT[],
115-
NULL, '{tblspc_1}'::TEXT[]); /* not ok */
118+
NULL, '{tblspc_1}'::TEXT[]); /* not ok */
116119
ERROR: wrong length of 'tablespaces' array
117120
SELECT create_range_partitions_internal('calamity.part_test',
118-
'{1, NULL}'::INT[], NULL, NULL); /* not ok */
121+
'{1, NULL}'::INT[], NULL, NULL); /* not ok */
119122
ERROR: only first bound can be NULL
120123
SELECT create_range_partitions_internal('calamity.part_test',
121-
'{2, 1}'::INT[], NULL, NULL); /* not ok */
124+
'{2, 1}'::INT[], NULL, NULL); /* not ok */
122125
ERROR: 'bounds' array must be ascending
123126
/* test function create_hash_partitions() */
124127
SELECT create_hash_partitions('calamity.part_test', 'val', 2,
@@ -244,24 +247,45 @@ SELECT build_hash_condition('text', 'val', 10, NULL) IS NULL;
244247
SELECT build_hash_condition('calamity.part_test', 'val', 10, 1);
245248
ERROR: no hash function for type calamity.part_test
246249
/* check function build_range_condition() */
247-
SELECT build_range_condition('calamity.part_test', 'val', 10, 20);
250+
SELECT build_range_condition(NULL, 'val', 10, 20); /* not ok */
251+
ERROR: 'partition_relid' should not be NULL
252+
SELECT build_range_condition('calamity.part_test', NULL, 10, 20); /* not ok */
253+
ERROR: 'attribute' should not be NULL
254+
SELECT build_range_condition('calamity.part_test', 'val', 10, 20); /* OK */
248255
build_range_condition
249256
------------------------------
250257
((val >= 10) AND (val < 20))
251258
(1 row)
252259

253-
SELECT build_range_condition('calamity.part_test', 'val', 10, NULL);
260+
SELECT build_range_condition('calamity.part_test', 'val', 10, NULL); /* OK */
254261
build_range_condition
255262
-----------------------
256263
((val >= 10))
257264
(1 row)
258265

259-
SELECT build_range_condition('calamity.part_test', 'val', NULL, 10);
266+
SELECT build_range_condition('calamity.part_test', 'val', NULL, 10); /* OK */
260267
build_range_condition
261268
-----------------------
262269
((val < 10))
263270
(1 row)
264271

272+
/* check function validate_interval_value() */
273+
SELECT validate_interval_value(NULL, 'val', 2, '1 mon'); /* not ok */
274+
ERROR: 'partrel' should not be NULL
275+
SELECT validate_interval_value('calamity.part_test', NULL, 2, '1 mon'); /* not ok */
276+
ERROR: 'attname' should not be NULL
277+
SELECT validate_interval_value('calamity.part_test', 'val', NULL, '1 mon'); /* not ok */
278+
ERROR: 'parttype' should not be NULL
279+
SELECT validate_interval_value('calamity.part_test', 'val', 2, '1 mon'); /* not ok */
280+
ERROR: invalid input syntax for integer: "1 mon"
281+
SELECT validate_interval_value('calamity.part_test', 'val', 1, '1 mon'); /* not ok */
282+
ERROR: interval should be NULL for HASH partitioned table
283+
SELECT validate_interval_value('calamity.part_test', 'val', 2, NULL); /* OK */
284+
validate_interval_value
285+
-------------------------
286+
t
287+
(1 row)
288+
265289
/* check function validate_relname() */
266290
SELECT validate_relname('calamity.part_test');
267291
validate_relname
@@ -327,12 +351,16 @@ SELECT get_partition_key_type(NULL) IS NULL;
327351
(1 row)
328352

329353
/* check function build_check_constraint_name_attnum() */
330-
SELECT build_check_constraint_name('calamity.part_test', 1::int2);
354+
SELECT build_check_constraint_name('calamity.part_test', 1::int2); /* OK */
331355
build_check_constraint_name
332356
-----------------------------
333357
pathman_part_test_1_check
334358
(1 row)
335359

360+
SELECT build_check_constraint_name(0::REGCLASS, 1::int2); /* not ok */
361+
ERROR: relation "0" does not exist
362+
SELECT build_check_constraint_name('calamity.part_test', -1::int2); /* not ok */
363+
ERROR: invalid attribute number -1
336364
SELECT build_check_constraint_name('calamity.part_test', NULL::int2) IS NULL;
337365
?column?
338366
----------
@@ -352,12 +380,16 @@ SELECT build_check_constraint_name(NULL, NULL::int2) IS NULL;
352380
(1 row)
353381

354382
/* check function build_check_constraint_name_attname() */
355-
SELECT build_check_constraint_name('calamity.part_test', 'val');
383+
SELECT build_check_constraint_name('calamity.part_test', 'val'); /* OK */
356384
build_check_constraint_name
357385
-----------------------------
358386
pathman_part_test_1_check
359387
(1 row)
360388

389+
SELECT build_check_constraint_name(0::REGCLASS, 'val'); /* not ok */
390+
ERROR: relation "0" does not exist
391+
SELECT build_check_constraint_name('calamity.part_test', 'nocol'); /* not ok */
392+
ERROR: relation "part_test" has no column "nocol"
361393
SELECT build_check_constraint_name('calamity.part_test', NULL::text) IS NULL;
362394
?column?
363395
----------
@@ -377,36 +409,64 @@ SELECT build_check_constraint_name(NULL, NULL::text) IS NULL;
377409
(1 row)
378410

379411
/* check function build_update_trigger_name() */
380-
SELECT build_update_trigger_name('calamity.part_test');
412+
SELECT build_update_trigger_name('calamity.part_test'); /* OK */
381413
build_update_trigger_name
382414
---------------------------
383415
part_test_upd_trig
384416
(1 row)
385417

418+
SELECT build_update_trigger_name(0::REGCLASS); /* not ok */
419+
ERROR: relation "0" does not exist
386420
SELECT build_update_trigger_name(NULL) IS NULL;
387421
?column?
388422
----------
389423
t
390424
(1 row)
391425

392426
/* check function build_update_trigger_func_name() */
393-
SELECT build_update_trigger_func_name('calamity.part_test');
427+
SELECT build_update_trigger_func_name('calamity.part_test'); /* OK */
394428
build_update_trigger_func_name
395429
----------------------------------
396430
calamity.part_test_upd_trig_func
397431
(1 row)
398432

433+
SELECT build_update_trigger_func_name(0::REGCLASS); /* not ok */
434+
ERROR: relation "0" does not exist
399435
SELECT build_update_trigger_func_name(NULL) IS NULL;
400436
?column?
401437
----------
402438
t
403439
(1 row)
404440

441+
/* check function build_sequence_name() */
442+
SELECT build_sequence_name('calamity.part_test'); /* OK */
443+
build_sequence_name
444+
------------------------
445+
calamity.part_test_seq
446+
(1 row)
447+
448+
SELECT build_sequence_name(1::REGCLASS); /* not ok */
449+
ERROR: relation "1" does not exist
450+
SELECT build_sequence_name(NULL) IS NULL;
451+
?column?
452+
----------
453+
t
454+
(1 row)
455+
456+
/* check function partition_table_concurrently() */
457+
SELECT partition_table_concurrently(1::REGCLASS); /* not ok */
458+
ERROR: relation "1" has no partitions
459+
SELECT partition_table_concurrently('pg_class', 0); /* not ok */
460+
ERROR: 'batch_size' should not be less than 1 or greater than 10000
461+
SELECT partition_table_concurrently('pg_class', 1, 1E-5); /* not ok */
462+
ERROR: 'sleep_time' should not be less than 0.5
463+
SELECT partition_table_concurrently('pg_class'); /* not ok */
464+
ERROR: relation "pg_class" has no partitions
405465
/* check function stop_concurrent_part_task() */
406-
SELECT stop_concurrent_part_task(1::regclass);
466+
SELECT stop_concurrent_part_task(1::REGCLASS); /* not ok */
407467
ERROR: cannot find worker for relation "1"
408468
/* check function drop_range_partition_expand_next() */
409-
SELECT drop_range_partition_expand_next('pg_class');
469+
SELECT drop_range_partition_expand_next('pg_class'); /* not ok */
410470
ERROR: relation "pg_class" is not a partition
411471
SELECT drop_range_partition_expand_next(NULL) IS NULL;
412472
?column?
@@ -453,6 +513,23 @@ SELECT generate_range_bounds('1-jan-2017'::DATE,
453513
{01-01-2017,01-02-2017,01-03-2017,01-04-2017,01-05-2017}
454514
(1 row)
455515

516+
SELECT check_range_available(NULL, NULL::INT4, NULL); /* not ok */
517+
ERROR: 'parent_relid' should not be NULL
518+
SELECT check_range_available('pg_class', 1, 10); /* OK (not partitioned) */
519+
WARNING: relation "pg_class" is not partitioned
520+
check_range_available
521+
-----------------------
522+
523+
(1 row)
524+
525+
SELECT has_update_trigger(NULL);
526+
has_update_trigger
527+
--------------------
528+
529+
(1 row)
530+
531+
SELECT has_update_trigger(0::REGCLASS); /* not ok */
532+
ERROR: relation "0" does not exist
456533
/* check invoke_on_partition_created_callback() */
457534
CREATE FUNCTION calamity.dummy_cb(arg jsonb) RETURNS void AS $$
458535
begin
@@ -463,7 +540,7 @@ $$ LANGUAGE plpgsql;
463540
SELECT invoke_on_partition_created_callback(NULL, 'calamity.part_test', 1);
464541
ERROR: 'parent_relid' should not be NULL
465542
SELECT invoke_on_partition_created_callback('calamity.part_test', NULL, 1);
466-
ERROR: 'partition' should not be NULL
543+
ERROR: 'partition_relid' should not be NULL
467544
SELECT invoke_on_partition_created_callback('calamity.part_test', 'calamity.part_test', 0);
468545
invoke_on_partition_created_callback
469546
--------------------------------------
@@ -519,6 +596,8 @@ DROP FUNCTION calamity.dummy_cb(arg jsonb);
519596
/* check function add_to_pathman_config() -- PHASE #1 */
520597
SELECT add_to_pathman_config(NULL, 'val'); /* no table */
521598
ERROR: 'parent_relid' should not be NULL
599+
SELECT add_to_pathman_config(0::REGCLASS, 'val'); /* no table (oid) */
600+
ERROR: relation "0" does not exist
522601
SELECT add_to_pathman_config('calamity.part_test', NULL); /* no column */
523602
ERROR: 'attname' should not be NULL
524603
SELECT add_to_pathman_config('calamity.part_test', 'V_A_L'); /* wrong column */

expected/pathman_interval.out

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,14 @@ INSERT INTO test_interval.abc VALUES (250);
2121
ERROR: cannot find appropriate partition for key '250'
2222
/* Set a trivial interval */
2323
SELECT set_interval('test_interval.abc', 0);
24-
ERROR: interval must not be trivial
24+
ERROR: interval should not be trivial
2525
/* Set a negative interval */
2626
SELECT set_interval('test_interval.abc', -100);
27-
ERROR: interval must not be negative
27+
ERROR: interval should not be negative
2828
/* We also shouldn't be able to set a trivial interval directly */
2929
UPDATE pathman_config SET range_interval = '0'
3030
WHERE partrel = 'test_interval.abc'::REGCLASS;
31-
ERROR: interval must not be trivial
31+
ERROR: interval should not be trivial
3232
/* Set a normal interval */
3333
SELECT set_interval('test_interval.abc', 1000);
3434
set_interval
@@ -64,14 +64,14 @@ INSERT INTO test_interval.abc VALUES (250);
6464
ERROR: cannot find appropriate partition for key '250'
6565
/* Set a trivial interval */
6666
SELECT set_interval('test_interval.abc', 0);
67-
ERROR: interval must not be trivial
67+
ERROR: interval should not be trivial
6868
/* Set a negative interval */
6969
SELECT set_interval('test_interval.abc', -100);
70-
ERROR: interval must not be negative
70+
ERROR: interval should not be negative
7171
/* We also shouldn't be able to set a trivial interval directly */
7272
UPDATE pathman_config SET range_interval = '0'
7373
WHERE partrel = 'test_interval.abc'::REGCLASS;
74-
ERROR: interval must not be trivial
74+
ERROR: interval should not be trivial
7575
/* Set a normal interval */
7676
SELECT set_interval('test_interval.abc', 1000);
7777
set_interval
@@ -107,14 +107,14 @@ INSERT INTO test_interval.abc VALUES (250);
107107
ERROR: cannot find appropriate partition for key '250'
108108
/* Set a trivial interval */
109109
SELECT set_interval('test_interval.abc', 0);
110-
ERROR: interval must not be trivial
110+
ERROR: interval should not be trivial
111111
/* Set a negative interval */
112112
SELECT set_interval('test_interval.abc', -100);
113-
ERROR: interval must not be negative
113+
ERROR: interval should not be negative
114114
/* We also shouldn't be able to set a trivial interval directly */
115115
UPDATE pathman_config SET range_interval = '0'
116116
WHERE partrel = 'test_interval.abc'::REGCLASS;
117-
ERROR: interval must not be trivial
117+
ERROR: interval should not be trivial
118118
/* Set a normal interval */
119119
SELECT set_interval('test_interval.abc', 1000);
120120
set_interval
@@ -148,7 +148,7 @@ SELECT set_interval('test_interval.abc', NULL::INTERVAL);
148148

149149
/* Set a trivial interval */
150150
SELECT set_interval('test_interval.abc', '1 second'::INTERVAL);
151-
ERROR: interval must not be trivial
151+
ERROR: interval should not be trivial
152152
/* Set a normal interval */
153153
SELECT set_interval('test_interval.abc', '1 month'::INTERVAL);
154154
set_interval
@@ -180,7 +180,7 @@ SELECT set_interval('test_interval.abc', NULL::FLOAT4);
180180

181181
/* Set a trivial interval */
182182
SELECT set_interval('test_interval.abc', 0);
183-
ERROR: interval must not be trivial
183+
ERROR: interval should not be trivial
184184
/* Set NaN float as interval */
185185
SELECT set_interval('test_interval.abc', 'NaN'::FLOAT4);
186186
ERROR: invalid floating point interval
@@ -212,7 +212,7 @@ SELECT set_interval('test_interval.abc', NULL::FLOAT8);
212212

213213
/* Set a trivial interval */
214214
SELECT set_interval('test_interval.abc', 0);
215-
ERROR: interval must not be trivial
215+
ERROR: interval should not be trivial
216216
/* Set NaN float as interval */
217217
SELECT set_interval('test_interval.abc', 'NaN'::FLOAT8);
218218
ERROR: invalid floating point interval
@@ -244,7 +244,7 @@ SELECT set_interval('test_interval.abc', NULL::NUMERIC);
244244

245245
/* Set a trivial interval */
246246
SELECT set_interval('test_interval.abc', 0);
247-
ERROR: interval must not be trivial
247+
ERROR: interval should not be trivial
248248
/* Set NaN numeric as interval */
249249
SELECT set_interval('test_interval.abc', 'NaN'::NUMERIC);
250250
ERROR: invalid numeric interval

0 commit comments

Comments
 (0)