@@ -92,8 +92,13 @@ static void postprocess_child_table_and_atts(Oid parent_relid, Oid partition_rel
92
92
static Oid text_to_regprocedure (text * proname_args );
93
93
94
94
static 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 );
96
100
static Value make_int_value_struct (int int_val );
101
+ #endif
97
102
98
103
static Node * build_partitioning_expression (Oid parent_relid ,
99
104
Oid * expr_type ,
@@ -1356,12 +1361,21 @@ build_raw_range_check_tree(Node *raw_expression,
1356
1361
const Bound * end_value ,
1357
1362
Oid value_type )
1358
1363
{
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
1359
1372
#define BuildConstExpr (node , value , value_type ) \
1360
1373
do { \
1361
1374
(node)->val = make_string_value_struct( \
1362
1375
datum_to_cstring((value), (value_type))); \
1363
1376
(node)->location = -1; \
1364
1377
} while (0)
1378
+ #endif
1365
1379
1366
1380
#define BuildCmpExpr (node , opname , expr , c ) \
1367
1381
do { \
@@ -1554,11 +1568,19 @@ build_raw_hash_check_tree(Node *raw_expression,
1554
1568
hash_proc = tce -> hash_proc ;
1555
1569
1556
1570
/* 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
1557
1574
part_count_c -> val = make_int_value_struct (part_count );
1575
+ #endif
1558
1576
part_count_c -> location = -1 ;
1559
1577
1560
1578
/* 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
1561
1582
part_idx_c -> val = make_int_value_struct (part_idx );
1583
+ #endif
1562
1584
part_idx_c -> location = -1 ;
1563
1585
1564
1586
/* Call hash_proc() */
@@ -1649,6 +1671,29 @@ make_constraint_common(char *name, Node *raw_expr)
1649
1671
return constraint ;
1650
1672
}
1651
1673
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
1652
1697
static Value
1653
1698
make_string_value_struct (char * str )
1654
1699
{
@@ -1670,7 +1715,7 @@ make_int_value_struct(int int_val)
1670
1715
1671
1716
return val ;
1672
1717
}
1673
-
1718
+ #endif /* PG_VERSION_NUM >= 150000 */
1674
1719
1675
1720
/*
1676
1721
* ---------------------
0 commit comments