Skip to content

Commit e41c5b0

Browse files
committed
Merge branch 'rel_future_beta' into rel_future_expressions
2 parents 085c33f + a8c78ff commit e41c5b0

17 files changed

+554
-190
lines changed

Makefile

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,24 +25,26 @@ 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 \
4445
pathman_expressions
4546

47+
4648
EXTRA_REGRESS_OPTS=--temp-config=$(top_srcdir)/$(subdir)/conf.add
4749

4850
EXTRA_CLEAN = pg_pathman--$(EXTVERSION).sql ./isolation_output

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: 86 additions & 15 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,
@@ -219,24 +222,43 @@ SELECT drop_partitions('calamity.part_test', true);
219222

220223
DELETE FROM calamity.part_test;
221224
/* check function build_range_condition() */
222-
SELECT build_range_condition('calamity.part_test', 'val', 10, 20);
225+
SELECT build_range_condition(NULL, 'val', 10, 20); /* not ok */
226+
ERROR: 'partition_relid' should not be NULL
227+
SELECT build_range_condition('calamity.part_test', NULL, 10, 20); /* not ok */
228+
ERROR: 'expression' should not be NULL
229+
SELECT build_range_condition('calamity.part_test', 'val', 10, 20); /* OK */
223230
build_range_condition
224231
------------------------------
225232
((val >= 10) AND (val < 20))
226233
(1 row)
227234

228-
SELECT build_range_condition('calamity.part_test', 'val', 10, NULL);
235+
SELECT build_range_condition('calamity.part_test', 'val', 10, NULL); /* OK */
229236
build_range_condition
230237
-----------------------
231238
((val >= 10))
232239
(1 row)
233240

234-
SELECT build_range_condition('calamity.part_test', 'val', NULL, 10);
241+
SELECT build_range_condition('calamity.part_test', 'val', NULL, 10); /* OK */
235242
build_range_condition
236243
-----------------------
237244
((val < 10))
238245
(1 row)
239246

247+
/* check function validate_interval_value() */
248+
SELECT validate_interval_value(NULL, 2, '1 mon'); /* not ok */
249+
ERROR: 'atttype' should not be NULL
250+
SELECT validate_interval_value(1186, NULL, '1 mon'); /* not ok */
251+
ERROR: 'parttype' should not be NULL
252+
SELECT validate_interval_value(23, 2, '1 mon'); /* not ok */
253+
ERROR: invalid input syntax for integer: "1 mon"
254+
SELECT validate_interval_value(1186, 1, '1 mon'); /* not ok */
255+
ERROR: interval should be NULL for HASH partitioned table
256+
SELECT validate_interval_value(1186, 2, NULL); /* OK */
257+
validate_interval_value
258+
-------------------------
259+
t
260+
(1 row)
261+
240262
/* check function validate_relname() */
241263
SELECT validate_relname('calamity.part_test');
242264
validate_relname
@@ -302,49 +324,79 @@ SELECT get_partition_key_type(NULL) IS NULL;
302324
(1 row)
303325

304326
/* check function build_check_constraint_name() */
305-
SELECT build_check_constraint_name('calamity.part_test');
327+
SELECT build_check_constraint_name('calamity.part_test'); /* OK */
306328
build_check_constraint_name
307329
-----------------------------
308330
pathman_part_test_check
309331
(1 row)
310332

333+
SELECT build_check_constraint_name(0::REGCLASS); /* not ok */
334+
ERROR: relation "0" does not exist
311335
SELECT build_check_constraint_name(NULL) IS NULL;
312336
?column?
313337
----------
314338
t
315339
(1 row)
316340

317341
/* check function build_update_trigger_name() */
318-
SELECT build_update_trigger_name('calamity.part_test');
342+
SELECT build_update_trigger_name('calamity.part_test'); /* OK */
319343
build_update_trigger_name
320344
---------------------------
321345
part_test_upd_trig
322346
(1 row)
323347

348+
SELECT build_update_trigger_name(0::REGCLASS); /* not ok */
349+
ERROR: relation "0" does not exist
324350
SELECT build_update_trigger_name(NULL) IS NULL;
325351
?column?
326352
----------
327353
t
328354
(1 row)
329355

330356
/* check function build_update_trigger_func_name() */
331-
SELECT build_update_trigger_func_name('calamity.part_test');
357+
SELECT build_update_trigger_func_name('calamity.part_test'); /* OK */
332358
build_update_trigger_func_name
333359
----------------------------------
334360
calamity.part_test_upd_trig_func
335361
(1 row)
336362

363+
SELECT build_update_trigger_func_name(0::REGCLASS); /* not ok */
364+
ERROR: relation "0" does not exist
337365
SELECT build_update_trigger_func_name(NULL) IS NULL;
338366
?column?
339367
----------
340368
t
341369
(1 row)
342370

371+
/* check function build_sequence_name() */
372+
SELECT build_sequence_name('calamity.part_test'); /* OK */
373+
build_sequence_name
374+
------------------------
375+
calamity.part_test_seq
376+
(1 row)
377+
378+
SELECT build_sequence_name(1::REGCLASS); /* not ok */
379+
ERROR: relation "1" does not exist
380+
SELECT build_sequence_name(NULL) IS NULL;
381+
?column?
382+
----------
383+
t
384+
(1 row)
385+
386+
/* check function partition_table_concurrently() */
387+
SELECT partition_table_concurrently(1::REGCLASS); /* not ok */
388+
ERROR: relation "1" has no partitions
389+
SELECT partition_table_concurrently('pg_class', 0); /* not ok */
390+
ERROR: 'batch_size' should not be less than 1 or greater than 10000
391+
SELECT partition_table_concurrently('pg_class', 1, 1E-5); /* not ok */
392+
ERROR: 'sleep_time' should not be less than 0.5
393+
SELECT partition_table_concurrently('pg_class'); /* not ok */
394+
ERROR: relation "pg_class" has no partitions
343395
/* check function stop_concurrent_part_task() */
344-
SELECT stop_concurrent_part_task(1::regclass);
396+
SELECT stop_concurrent_part_task(1::REGCLASS); /* not ok */
345397
ERROR: cannot find worker for relation "1"
346398
/* check function drop_range_partition_expand_next() */
347-
SELECT drop_range_partition_expand_next('pg_class');
399+
SELECT drop_range_partition_expand_next('pg_class'); /* not ok */
348400
ERROR: relation "pg_class" is not a partition
349401
SELECT drop_range_partition_expand_next(NULL) IS NULL;
350402
?column?
@@ -391,6 +443,23 @@ SELECT generate_range_bounds('1-jan-2017'::DATE,
391443
{01-01-2017,01-02-2017,01-03-2017,01-04-2017,01-05-2017}
392444
(1 row)
393445

446+
SELECT check_range_available(NULL, NULL::INT4, NULL); /* not ok */
447+
ERROR: 'parent_relid' should not be NULL
448+
SELECT check_range_available('pg_class', 1, 10); /* OK (not partitioned) */
449+
WARNING: relation "pg_class" is not partitioned
450+
check_range_available
451+
-----------------------
452+
453+
(1 row)
454+
455+
SELECT has_update_trigger(NULL);
456+
has_update_trigger
457+
--------------------
458+
459+
(1 row)
460+
461+
SELECT has_update_trigger(0::REGCLASS); /* not ok */
462+
ERROR: relation "0" does not exist
394463
/* check invoke_on_partition_created_callback() */
395464
CREATE FUNCTION calamity.dummy_cb(arg jsonb) RETURNS void AS $$
396465
begin
@@ -401,7 +470,7 @@ $$ LANGUAGE plpgsql;
401470
SELECT invoke_on_partition_created_callback(NULL, 'calamity.part_test', 1);
402471
ERROR: 'parent_relid' should not be NULL
403472
SELECT invoke_on_partition_created_callback('calamity.part_test', NULL, 1);
404-
ERROR: 'partition' should not be NULL
473+
ERROR: 'partition_relid' should not be NULL
405474
SELECT invoke_on_partition_created_callback('calamity.part_test', 'calamity.part_test', 0);
406475
invoke_on_partition_created_callback
407476
--------------------------------------
@@ -457,6 +526,8 @@ DROP FUNCTION calamity.dummy_cb(arg jsonb);
457526
/* check function add_to_pathman_config() -- PHASE #1 */
458527
SELECT add_to_pathman_config(NULL, 'val'); /* no table */
459528
ERROR: 'parent_relid' should not be NULL
529+
SELECT add_to_pathman_config(0::REGCLASS, 'val'); /* no table (oid) */
530+
ERROR: relation "0" does not exist
460531
SELECT add_to_pathman_config('calamity.part_test', NULL); /* no column */
461532
ERROR: 'expression' should not be NULL
462533
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)