@@ -102,23 +102,26 @@ SELECT count(*) FROM calamity.part_test;
102102(1 row)
103103
104104DELETE 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 */
107110ERROR: 'parent_relid' should not be NULL
108111SELECT create_range_partitions_internal('calamity.part_test',
109- NULL::INT[], NULL, NULL); /* not ok */
112+ NULL::INT[], NULL, NULL); /* not ok */
110113ERROR: 'bounds' should not be NULL
111114SELECT create_range_partitions_internal('calamity.part_test', '{1}'::INT[],
112- '{part_1}'::TEXT[], NULL); /* not ok */
115+ '{part_1}'::TEXT[], NULL); /* not ok */
113116ERROR: wrong length of 'partition_names' array
114117SELECT create_range_partitions_internal('calamity.part_test', '{1}'::INT[],
115- NULL, '{tblspc_1}'::TEXT[]); /* not ok */
118+ NULL, '{tblspc_1}'::TEXT[]); /* not ok */
116119ERROR: wrong length of 'tablespaces' array
117120SELECT create_range_partitions_internal('calamity.part_test',
118- '{1, NULL}'::INT[], NULL, NULL); /* not ok */
121+ '{1, NULL}'::INT[], NULL, NULL); /* not ok */
119122ERROR: only first bound can be NULL
120123SELECT create_range_partitions_internal('calamity.part_test',
121- '{2, 1}'::INT[], NULL, NULL); /* not ok */
124+ '{2, 1}'::INT[], NULL, NULL); /* not ok */
122125ERROR: 'bounds' array must be ascending
123126/* test function create_hash_partitions() */
124127SELECT create_hash_partitions('calamity.part_test', 'val', 2,
@@ -348,12 +351,16 @@ SELECT get_partition_key_type(NULL) IS NULL;
348351(1 row)
349352
350353/* 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 */
352355 build_check_constraint_name
353356-----------------------------
354357 pathman_part_test_1_check
355358(1 row)
356359
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
357364SELECT build_check_constraint_name('calamity.part_test', NULL::int2) IS NULL;
358365 ?column?
359366----------
@@ -373,12 +380,16 @@ SELECT build_check_constraint_name(NULL, NULL::int2) IS NULL;
373380(1 row)
374381
375382/* 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 */
377384 build_check_constraint_name
378385-----------------------------
379386 pathman_part_test_1_check
380387(1 row)
381388
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"
382393SELECT build_check_constraint_name('calamity.part_test', NULL::text) IS NULL;
383394 ?column?
384395----------
@@ -398,51 +409,64 @@ SELECT build_check_constraint_name(NULL, NULL::text) IS NULL;
398409(1 row)
399410
400411/* 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 */
402413 build_update_trigger_name
403414---------------------------
404415 part_test_upd_trig
405416(1 row)
406417
418+ SELECT build_update_trigger_name(0::REGCLASS); /* not ok */
419+ ERROR: relation "0" does not exist
407420SELECT build_update_trigger_name(NULL) IS NULL;
408421 ?column?
409422----------
410423 t
411424(1 row)
412425
413426/* 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 */
415428 build_update_trigger_func_name
416429----------------------------------
417430 calamity.part_test_upd_trig_func
418431(1 row)
419432
433+ SELECT build_update_trigger_func_name(0::REGCLASS); /* not ok */
434+ ERROR: relation "0" does not exist
420435SELECT build_update_trigger_func_name(NULL) IS NULL;
421436 ?column?
422437----------
423438 t
424439(1 row)
425440
426441/* check function build_sequence_name() */
427- SELECT build_sequence_name('calamity.part_test'); /* ok */
442+ SELECT build_sequence_name('calamity.part_test'); /* OK */
428443 build_sequence_name
429444------------------------
430445 calamity.part_test_seq
431446(1 row)
432447
433- SELECT build_sequence_name(1::REGCLASS); /* not ok */
448+ SELECT build_sequence_name(1::REGCLASS); /* not ok */
434449ERROR: relation "1" does not exist
435450SELECT build_sequence_name(NULL) IS NULL;
436451 ?column?
437452----------
438453 t
439454(1 row)
440455
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
441465/* check function stop_concurrent_part_task() */
442- SELECT stop_concurrent_part_task(1::regclass);
466+ SELECT stop_concurrent_part_task(1::REGCLASS); /* not ok */
443467ERROR: cannot find worker for relation "1"
444468/* 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 */
446470ERROR: relation "pg_class" is not a partition
447471SELECT drop_range_partition_expand_next(NULL) IS NULL;
448472 ?column?
@@ -572,6 +596,8 @@ DROP FUNCTION calamity.dummy_cb(arg jsonb);
572596/* check function add_to_pathman_config() -- PHASE #1 */
573597SELECT add_to_pathman_config(NULL, 'val'); /* no table */
574598ERROR: '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
575601SELECT add_to_pathman_config('calamity.part_test', NULL); /* no column */
576602ERROR: 'attname' should not be NULL
577603SELECT add_to_pathman_config('calamity.part_test', 'V_A_L'); /* wrong column */
0 commit comments