@@ -101,9 +101,9 @@ create_single_range_partition_internal(Oid parent_relid,
101
101
{
102
102
Oid partition_relid ;
103
103
Constraint * check_constr ;
104
- Node * part_expr ;
105
104
init_callback_params callback_params ;
106
- List * trigger_columns ;
105
+ List * trigger_columns = NIL ;
106
+ Node * expr ;
107
107
108
108
/* Generate a name if asked to */
109
109
if (!partition_rv )
@@ -118,7 +118,7 @@ create_single_range_partition_internal(Oid parent_relid,
118
118
}
119
119
120
120
/* Check pathman config anld fill variables */
121
- part_expr = build_partitioning_expression (parent_relid , NULL , & trigger_columns );
121
+ expr = build_partitioning_expression (parent_relid , NULL , & trigger_columns );
122
122
123
123
/* Create a partition & get 'partitioning expression' */
124
124
partition_relid = create_single_partition_internal (parent_relid ,
@@ -127,7 +127,7 @@ create_single_range_partition_internal(Oid parent_relid,
127
127
128
128
/* Build check constraint for RANGE partition */
129
129
check_constr = build_range_check_constraint (partition_relid ,
130
- part_expr ,
130
+ expr ,
131
131
start_value ,
132
132
end_value ,
133
133
value_type );
@@ -160,9 +160,9 @@ create_single_hash_partition_internal(Oid parent_relid,
160
160
Oid partition_relid ,
161
161
expr_type ;
162
162
Constraint * check_constr ;
163
- Node * expr ;
164
163
init_callback_params callback_params ;
165
- List * trigger_columns ;
164
+ List * trigger_columns = NIL ;
165
+ Node * expr ;
166
166
167
167
/* Generate a name if asked to */
168
168
if (!partition_rv )
@@ -1213,20 +1213,20 @@ build_range_check_constraint(Oid child_relid,
1213
1213
const Bound * end_value ,
1214
1214
Oid value_type )
1215
1215
{
1216
- Constraint * hash_constr ;
1216
+ Constraint * range_constr ;
1217
1217
char * range_constr_name ;
1218
1218
1219
1219
/* Build a correct name for this constraint */
1220
1220
range_constr_name = build_check_constraint_name_relid_internal (child_relid );
1221
1221
1222
1222
/* Initialize basic properties of a CHECK constraint */
1223
- hash_constr = make_constraint_common (range_constr_name ,
1224
- build_raw_range_check_tree (raw_expression ,
1225
- start_value ,
1226
- end_value ,
1227
- value_type ));
1223
+ range_constr = make_constraint_common (range_constr_name ,
1224
+ build_raw_range_check_tree (raw_expression ,
1225
+ start_value ,
1226
+ end_value ,
1227
+ value_type ));
1228
1228
/* Everything seems to be fine */
1229
- return hash_constr ;
1229
+ return range_constr ;
1230
1230
}
1231
1231
1232
1232
/* Check if range overlaps with any partitions */
@@ -1300,7 +1300,6 @@ build_raw_hash_check_tree(Node *raw_expression,
1300
1300
A_Expr * eq_oper = makeNode (A_Expr );
1301
1301
FuncCall * part_idx_call = makeNode (FuncCall ),
1302
1302
* hash_call = makeNode (FuncCall );
1303
- //ColumnRef *hashed_column = makeNode(ColumnRef);
1304
1303
A_Const * part_idx_c = makeNode (A_Const ),
1305
1304
* part_count_c = makeNode (A_Const );
1306
1305
@@ -1680,14 +1679,9 @@ text_to_regprocedure(text *proc_signature)
1680
1679
return DatumGetObjectId (result );
1681
1680
}
1682
1681
1683
- typedef struct
1684
- {
1685
- List * columns ;
1686
- } extract_column_names_cxt ;
1687
-
1688
1682
/* Extract column names from raw expression */
1689
1683
static bool
1690
- extract_column_names (Node * node , extract_column_names_cxt * cxt )
1684
+ extract_column_names (Node * node , List * * columns )
1691
1685
{
1692
1686
if (node == NULL )
1693
1687
return false;
@@ -1698,10 +1692,10 @@ extract_column_names(Node *node, extract_column_names_cxt *cxt)
1698
1692
1699
1693
foreach (lc , ((ColumnRef * ) node )-> fields )
1700
1694
if (IsA (lfirst (lc ), String ))
1701
- cxt -> columns = lappend (cxt -> columns , lfirst (lc ));
1695
+ * columns = lappend (* columns , lfirst (lc ));
1702
1696
}
1703
1697
1704
- return raw_expression_tree_walker (node , extract_column_names , cxt );
1698
+ return raw_expression_tree_walker (node , extract_column_names , columns );
1705
1699
}
1706
1700
1707
1701
/* Returns raw partitioning expression + expr_type + columns */
@@ -1732,9 +1726,9 @@ build_partitioning_expression(Oid parent_relid,
1732
1726
1733
1727
if (columns )
1734
1728
{
1735
- extract_column_names_cxt context = { NIL };
1736
- extract_column_names ( expr , & context );
1737
- * columns = context . columns ;
1729
+ /* Column list should be empty */
1730
+ Assert ( * columns == NIL );
1731
+ extract_column_names ( expr , columns ) ;
1738
1732
}
1739
1733
1740
1734
return expr ;
0 commit comments