@@ -92,8 +92,13 @@ static void postprocess_child_table_and_atts(Oid parent_relid, Oid partition_rel
9292static Oid text_to_regprocedure (text * proname_args );
9393
9494static Constraint * make_constraint_common (char * name , Node * raw_expr );
95- static Value make_string_value_struct (char * str );
95+ #if PG_VERSION_NUM >= 150000 /* reason: commit 639a86e36aae */
96+ static String make_string_value_struct (char * str );
97+ static Integer make_int_value_struct (int int_val );
98+ #else
99+ static Value make_string_value_struct (char * str );
96100static Value make_int_value_struct (int int_val );
101+ #endif
97102
98103static Node * build_partitioning_expression (Oid parent_relid ,
99104 Oid * expr_type ,
@@ -1356,12 +1361,21 @@ build_raw_range_check_tree(Node *raw_expression,
13561361 const Bound * end_value ,
13571362 Oid value_type )
13581363{
1364+ #if PG_VERSION_NUM >= 150000 /* reason: commit 639a86e36aae */
1365+ #define BuildConstExpr (node , value , value_type ) \
1366+ do { \
1367+ (node)->val.sval = make_string_value_struct( \
1368+ datum_to_cstring((value), (value_type))); \
1369+ (node)->location = -1; \
1370+ } while (0)
1371+ #else
13591372#define BuildConstExpr (node , value , value_type ) \
13601373 do { \
13611374 (node)->val = make_string_value_struct( \
13621375 datum_to_cstring((value), (value_type))); \
13631376 (node)->location = -1; \
13641377 } while (0)
1378+ #endif
13651379
13661380#define BuildCmpExpr (node , opname , expr , c ) \
13671381 do { \
@@ -1554,11 +1568,19 @@ build_raw_hash_check_tree(Node *raw_expression,
15541568 hash_proc = tce -> hash_proc ;
15551569
15561570 /* Total amount of partitions */
1571+ #if PG_VERSION_NUM >= 150000 /* reason: commit 639a86e36aae */
1572+ part_count_c -> val .ival = make_int_value_struct (part_count );
1573+ #else
15571574 part_count_c -> val = make_int_value_struct (part_count );
1575+ #endif
15581576 part_count_c -> location = -1 ;
15591577
15601578 /* Index of this partition (hash % total amount) */
1579+ #if PG_VERSION_NUM >= 150000 /* reason: commit 639a86e36aae */
1580+ part_idx_c -> val .ival = make_int_value_struct (part_idx );
1581+ #else
15611582 part_idx_c -> val = make_int_value_struct (part_idx );
1583+ #endif
15621584 part_idx_c -> location = -1 ;
15631585
15641586 /* Call hash_proc() */
@@ -1649,6 +1671,29 @@ make_constraint_common(char *name, Node *raw_expr)
16491671 return constraint ;
16501672}
16511673
1674+ #if PG_VERSION_NUM >= 150000 /* reason: commit 639a86e36aae */
1675+ static String
1676+ make_string_value_struct (char * str )
1677+ {
1678+ String val ;
1679+
1680+ val .type = T_String ;
1681+ val .val = str ;
1682+
1683+ return val ;
1684+ }
1685+
1686+ static Integer
1687+ make_int_value_struct (int int_val )
1688+ {
1689+ Integer val ;
1690+
1691+ val .type = T_Integer ;
1692+ val .val = int_val ;
1693+
1694+ return val ;
1695+ }
1696+ #else
16521697static Value
16531698make_string_value_struct (char * str )
16541699{
@@ -1670,7 +1715,7 @@ make_int_value_struct(int int_val)
16701715
16711716 return val ;
16721717}
1673-
1718+ #endif /* PG_VERSION_NUM >= 150000 */
16741719
16751720/*
16761721 * ---------------------
0 commit comments