Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit26d3945

Browse files
committed
pathman: handle DELETE and UPDATE queries
1 parent1285042 commit26d3945

File tree

3 files changed

+12
-4
lines changed

3 files changed

+12
-4
lines changed

‎contrib/pg_pathman/pathman.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,7 @@ List *irange_list_union(List *a, List *b);
149149
List*irange_list_intersect(List*a,List*b);
150150
intirange_list_length(List*rangeset);
151151
boolirange_list_find(List*rangeset,intindex,bool*lossy);
152+
voidprint_irange(IndexRangeir);
152153

153154
/* Dynamic shared memory functions */
154155
voidinit_dsm_config(void);

‎contrib/pg_pathman/pg_pathman.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ static void pathman_set_rel_pathlist_hook(PlannerInfo *root, RelOptInfo *rel, In
6666
staticPlannedStmt*pathman_planner_hook(Query*parse,intcursorOptions,ParamListInfoboundParams);
6767

6868
/* Utility functions */
69+
staticvoidhandle_modification_query(Query*parse);
6970
staticvoidappend_child_relation(PlannerInfo*root,RelOptInfo*rel,Indexrti,
7071
RangeTblEntry*rte,intindex,OidchildOID,List*wrappers);
7172
staticNode*wrapper_make_expression(WrapperNode*wrap,intindex,bool*alwaysTrue);
@@ -89,7 +90,6 @@ static void set_append_rel_pathlist(PlannerInfo *root, RelOptInfo *rel, Index rt
8990
staticList*accumulate_append_subpath(List*subpaths,Path*path);
9091
staticvoidset_pathkeys(PlannerInfo*root,RelOptInfo*childrel,Path*path);
9192

92-
staticvoidhandle_delete_query(Query*parse);
9393

9494
/*
9595
* Compare two Datums with the given comarison function
@@ -204,8 +204,9 @@ pathman_planner_hook(Query *parse, int cursorOptions, ParamListInfo boundParams)
204204
caseCMD_SELECT:
205205
disable_inheritance(parse);
206206
break;
207+
caseCMD_UPDATE:
207208
caseCMD_DELETE:
208-
handle_delete_query(parse);
209+
handle_modification_query(parse);
209210
break;
210211
default:
211212
break;
@@ -269,7 +270,7 @@ disable_inheritance(Query *parse)
269270
* Checks if query is affects only one partition. If true then substitute
270271
*/
271272
staticvoid
272-
handle_delete_query(Query*parse)
273+
handle_modification_query(Query*parse)
273274
{
274275
PartRelationInfo*prel;
275276
List*ranges,
@@ -298,7 +299,7 @@ handle_delete_query(Query *parse)
298299
// }
299300

300301
/* If only one partition is affected then substitute parent table with partition */
301-
if (irange_list_length(ranges))
302+
if (irange_list_length(ranges)==1)
302303
{
303304
IndexRangeirange= (IndexRange)linitial_oid(ranges);
304305
elog(WARNING,"lower: %d, upper: %d, lossy: %d",irange_lower(irange),irange_upper(irange),irange_is_lossy(irange));

‎contrib/pg_pathman/rangeset.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,12 @@ print_irange(List *l)
6565
}
6666
#endif
6767

68+
void
69+
print_irange(IndexRangeir)
70+
{
71+
elog(WARNING,"[%d, %d], lossy: %d",irange_lower(ir),irange_upper(ir),irange_is_lossy(ir));
72+
}
73+
6874
/*
6975
* Make union of two index rage lists.
7076
*/

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp