@@ -12,6 +12,44 @@ SELECT debug_capture();
1212set client_min_messages = NOTICE;
1313/* create table to be partitioned */
1414CREATE TABLE calamity.part_test(val serial);
15+ /* check function build_hash_condition() */
16+ SELECT build_hash_condition('int4', 'val', 10, 1);
17+ build_hash_condition
18+ -------------------------------------------------
19+ public.get_hash_part_idx(hashint4(val), 10) = 1
20+ (1 row)
21+
22+ SELECT build_hash_condition('text', 'val', 10, 1);
23+ build_hash_condition
24+ -------------------------------------------------
25+ public.get_hash_part_idx(hashtext(val), 10) = 1
26+ (1 row)
27+
28+ SELECT build_hash_condition('int4', 'val', 1, 1);
29+ ERROR: 'partition_index' must be lower than 'partitions_count'
30+ SELECT build_hash_condition('int4', 'val', 10, 20);
31+ ERROR: 'partition_index' must be lower than 'partitions_count'
32+ SELECT build_hash_condition('text', 'val', 10, NULL) IS NULL;
33+ ?column?
34+ ----------
35+ t
36+ (1 row)
37+
38+ SELECT build_hash_condition('calamity.part_test', 'val', 10, 1);
39+ ERROR: no hash function for type calamity.part_test
40+ /* check function build_range_condition() */
41+ SELECT build_range_condition('val', 10, 20);
42+ build_range_condition
43+ ----------------------------
44+ val >= '10' AND val < '20'
45+ (1 row)
46+
47+ SELECT build_range_condition('val', 10, NULL) IS NULL;
48+ ?column?
49+ ----------
50+ t
51+ (1 row)
52+
1553/* check function validate_relname() */
1654SELECT validate_relname('calamity.part_test');
1755 validate_relname
0 commit comments