@@ -102,23 +102,26 @@ SELECT count(*) FROM calamity.part_test;
102
102
(1 row)
103
103
104
104
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
105
108
/* 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 */
107
110
ERROR: 'parent_relid' should not be NULL
108
111
SELECT create_range_partitions_internal('calamity.part_test',
109
- NULL::INT[], NULL, NULL); /* not ok */
112
+ NULL::INT[], NULL, NULL); /* not ok */
110
113
ERROR: 'bounds' should not be NULL
111
114
SELECT create_range_partitions_internal('calamity.part_test', '{1}'::INT[],
112
- '{part_1}'::TEXT[], NULL); /* not ok */
115
+ '{part_1}'::TEXT[], NULL); /* not ok */
113
116
ERROR: wrong length of 'partition_names' array
114
117
SELECT create_range_partitions_internal('calamity.part_test', '{1}'::INT[],
115
- NULL, '{tblspc_1}'::TEXT[]); /* not ok */
118
+ NULL, '{tblspc_1}'::TEXT[]); /* not ok */
116
119
ERROR: wrong length of 'tablespaces' array
117
120
SELECT create_range_partitions_internal('calamity.part_test',
118
- '{1, NULL}'::INT[], NULL, NULL); /* not ok */
121
+ '{1, NULL}'::INT[], NULL, NULL); /* not ok */
119
122
ERROR: only first bound can be NULL
120
123
SELECT create_range_partitions_internal('calamity.part_test',
121
- '{2, 1}'::INT[], NULL, NULL); /* not ok */
124
+ '{2, 1}'::INT[], NULL, NULL); /* not ok */
122
125
ERROR: 'bounds' array must be ascending
123
126
/* test function create_hash_partitions() */
124
127
SELECT create_hash_partitions('calamity.part_test', 'val', 2,
@@ -348,12 +351,16 @@ SELECT get_partition_key_type(NULL) IS NULL;
348
351
(1 row)
349
352
350
353
/* check function build_check_constraint_name_attnum() */
351
- SELECT build_check_constraint_name('calamity.part_test', 1::int2);
354
+ SELECT build_check_constraint_name('calamity.part_test', 1::int2); /* OK */
352
355
build_check_constraint_name
353
356
-----------------------------
354
357
pathman_part_test_1_check
355
358
(1 row)
356
359
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
357
364
SELECT build_check_constraint_name('calamity.part_test', NULL::int2) IS NULL;
358
365
?column?
359
366
----------
@@ -373,12 +380,16 @@ SELECT build_check_constraint_name(NULL, NULL::int2) IS NULL;
373
380
(1 row)
374
381
375
382
/* check function build_check_constraint_name_attname() */
376
- SELECT build_check_constraint_name('calamity.part_test', 'val');
383
+ SELECT build_check_constraint_name('calamity.part_test', 'val'); /* OK */
377
384
build_check_constraint_name
378
385
-----------------------------
379
386
pathman_part_test_1_check
380
387
(1 row)
381
388
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"
382
393
SELECT build_check_constraint_name('calamity.part_test', NULL::text) IS NULL;
383
394
?column?
384
395
----------
@@ -398,51 +409,64 @@ SELECT build_check_constraint_name(NULL, NULL::text) IS NULL;
398
409
(1 row)
399
410
400
411
/* check function build_update_trigger_name() */
401
- SELECT build_update_trigger_name('calamity.part_test');
412
+ SELECT build_update_trigger_name('calamity.part_test'); /* OK */
402
413
build_update_trigger_name
403
414
---------------------------
404
415
part_test_upd_trig
405
416
(1 row)
406
417
418
+ SELECT build_update_trigger_name(0::REGCLASS); /* not ok */
419
+ ERROR: relation "0" does not exist
407
420
SELECT build_update_trigger_name(NULL) IS NULL;
408
421
?column?
409
422
----------
410
423
t
411
424
(1 row)
412
425
413
426
/* check function build_update_trigger_func_name() */
414
- SELECT build_update_trigger_func_name('calamity.part_test');
427
+ SELECT build_update_trigger_func_name('calamity.part_test'); /* OK */
415
428
build_update_trigger_func_name
416
429
----------------------------------
417
430
calamity.part_test_upd_trig_func
418
431
(1 row)
419
432
433
+ SELECT build_update_trigger_func_name(0::REGCLASS); /* not ok */
434
+ ERROR: relation "0" does not exist
420
435
SELECT build_update_trigger_func_name(NULL) IS NULL;
421
436
?column?
422
437
----------
423
438
t
424
439
(1 row)
425
440
426
441
/* check function build_sequence_name() */
427
- SELECT build_sequence_name('calamity.part_test'); /* ok */
442
+ SELECT build_sequence_name('calamity.part_test'); /* OK */
428
443
build_sequence_name
429
444
------------------------
430
445
calamity.part_test_seq
431
446
(1 row)
432
447
433
- SELECT build_sequence_name(1::REGCLASS); /* not ok */
448
+ SELECT build_sequence_name(1::REGCLASS); /* not ok */
434
449
ERROR: relation "1" does not exist
435
450
SELECT build_sequence_name(NULL) IS NULL;
436
451
?column?
437
452
----------
438
453
t
439
454
(1 row)
440
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
441
465
/* check function stop_concurrent_part_task() */
442
- SELECT stop_concurrent_part_task(1::regclass);
466
+ SELECT stop_concurrent_part_task(1::REGCLASS); /* not ok */
443
467
ERROR: cannot find worker for relation "1"
444
468
/* check function drop_range_partition_expand_next() */
445
- SELECT drop_range_partition_expand_next('pg_class');
469
+ SELECT drop_range_partition_expand_next('pg_class'); /* not ok */
446
470
ERROR: relation "pg_class" is not a partition
447
471
SELECT drop_range_partition_expand_next(NULL) IS NULL;
448
472
?column?
@@ -572,6 +596,8 @@ DROP FUNCTION calamity.dummy_cb(arg jsonb);
572
596
/* check function add_to_pathman_config() -- PHASE #1 */
573
597
SELECT add_to_pathman_config(NULL, 'val'); /* no table */
574
598
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
575
601
SELECT add_to_pathman_config('calamity.part_test', NULL); /* no column */
576
602
ERROR: 'attname' should not be NULL
577
603
SELECT add_to_pathman_config('calamity.part_test', 'V_A_L'); /* wrong column */
0 commit comments