@@ -559,7 +559,7 @@ spawn_partitions_val(Oid parent_relid, /* parent's Oid */
559
559
bounds [1 ] = MakeBound (should_append ? cur_leading_bound : cur_following_bound );
560
560
561
561
last_partition = create_single_range_partition_internal (parent_relid ,
562
- value_type ,
562
+ range_bound_type ,
563
563
& bounds [0 ], & bounds [1 ],
564
564
NULL , NULL );
565
565
@@ -1713,7 +1713,7 @@ get_raw_expression(Oid relid, const char *expr, char **query_string_out,
1713
1713
SelectStmt * select_stmt ;
1714
1714
ResTarget * target ;
1715
1715
1716
- char * fmt = "SELECT (%s) FROM ONLY %s.%s " ;
1716
+ char * fmt = "SELECT (%s) FROM ONLY %s.\"%s\" " ;
1717
1717
char * relname = get_rel_name (relid ),
1718
1718
* namespace_name = get_namespace_name (get_rel_namespace (relid ));
1719
1719
List * parsetree_list ;
@@ -1727,14 +1727,14 @@ get_raw_expression(Oid relid, const char *expr, char **query_string_out,
1727
1727
* query_string_out = query_string ;
1728
1728
}
1729
1729
1730
- select_stmt = (SelectStmt * ) lfirst ( list_head ( parsetree_list ) );
1730
+ select_stmt = (SelectStmt * ) linitial ( parsetree_list );
1731
1731
1732
1732
if (parsetree )
1733
1733
{
1734
1734
* parsetree = (Node * ) select_stmt ;
1735
1735
}
1736
1736
1737
- target = (ResTarget * ) lfirst ( list_head ( select_stmt -> targetList ) );
1737
+ target = (ResTarget * ) linitial ( select_stmt -> targetList );
1738
1738
result = (Node * ) target -> val ;
1739
1739
return result ;
1740
1740
}
@@ -1810,10 +1810,10 @@ get_part_expression_info(Oid relid, const char *expr_string,
1810
1810
* with more or less understable text */
1811
1811
querytree_list = pg_analyze_and_rewrite (parsetree ,
1812
1812
query_string , NULL , 0 );
1813
- query = (Query * ) lfirst ( list_head ( querytree_list ) );
1813
+ query = (Query * ) linitial ( querytree_list );
1814
1814
1815
1815
/* expr_node is node that we need for further use */
1816
- target_entry = lfirst ( list_head ( query -> targetList ) );
1816
+ target_entry = linitial ( query -> targetList );
1817
1817
expr_node = (Node * ) target_entry -> expr ;
1818
1818
1819
1819
/* Now we have node and can determine type of that node */
@@ -1833,7 +1833,11 @@ get_part_expression_info(Oid relid, const char *expr_string,
1833
1833
1834
1834
/* Plan this query. We reuse 'expr_node' here */
1835
1835
plan = pg_plan_query (query , 0 , NULL );
1836
- target_entry = lfirst (list_head (plan -> planTree -> targetlist ));
1836
+ if (IsA (plan -> planTree , IndexOnlyScan ))
1837
+ target_entry = linitial (((IndexOnlyScan * ) plan -> planTree )-> indextlist );
1838
+ else
1839
+ target_entry = linitial (plan -> planTree -> targetlist );
1840
+
1837
1841
expr_node = (Node * ) target_entry -> expr ;
1838
1842
expr_node = eval_const_expressions (NULL , expr_node );
1839
1843
validate_part_expression (expr_node , NULL );
0 commit comments