@@ -92,9 +92,9 @@ get_chunk_dispatch_state(PlanState *substate)
9292 * the ModifyTableState node whenever it inserts into a new chunk.
9393 */
9494static void
95- hypertable_modify_begin (CustomScanState * node , EState * estate , int eflags )
95+ modify_hypertable_begin (CustomScanState * node , EState * estate , int eflags )
9696{
97- HypertableModifyState * state = (HypertableModifyState * ) node ;
97+ ModifyHypertableState * state = (ModifyHypertableState * ) node ;
9898 ModifyTableState * mtstate ;
9999 PlanState * ps ;
100100
@@ -116,7 +116,7 @@ hypertable_modify_begin(CustomScanState *node, EState *estate, int eflags)
116116 * Unfortunately that strips off the HypertableInsert node leading to
117117 * tuple routing not working in INSERTs inside CTEs. To make INSERTs
118118 * inside CTEs work we have to fix es_auxmodifytables and add back the
119- * HypertableModifyState .
119+ * ModifyHypertableState .
120120 */
121121 if (estate -> es_auxmodifytables && linitial (estate -> es_auxmodifytables ) == mtstate )
122122 linitial (estate -> es_auxmodifytables ) = node ;
@@ -140,28 +140,28 @@ hypertable_modify_begin(CustomScanState *node, EState *estate, int eflags)
140140}
141141
142142static TupleTableSlot *
143- hypertable_modify_exec (CustomScanState * node )
143+ modify_hypertable_exec (CustomScanState * node )
144144{
145145 ModifyTableState * mtstate = linitial_node (ModifyTableState , node -> custom_ps );
146146 return ExecModifyTable (node , & mtstate -> ps );
147147}
148148
149149static void
150- hypertable_modify_end (CustomScanState * node )
150+ modify_hypertable_end (CustomScanState * node )
151151{
152152 ExecEndNode (linitial (node -> custom_ps ));
153153}
154154
155155static void
156- hypertable_modify_rescan (CustomScanState * node )
156+ modify_hypertable_rescan (CustomScanState * node )
157157{
158158 ExecReScan (linitial (node -> custom_ps ));
159159}
160160
161161static void
162- hypertable_modify_explain (CustomScanState * node , List * ancestors , ExplainState * es )
162+ modify_hypertable_explain (CustomScanState * node , List * ancestors , ExplainState * es )
163163{
164- HypertableModifyState * state = (HypertableModifyState * ) node ;
164+ ModifyHypertableState * state = (ModifyHypertableState * ) node ;
165165 ModifyTableState * mtstate = linitial_node (ModifyTableState , node -> custom_ps );
166166
167167 /*
@@ -183,13 +183,13 @@ hypertable_modify_explain(CustomScanState *node, List *ancestors, ExplainState *
183183 }
184184 /*
185185 * Since we hijack the ModifyTable node, instrumentation on ModifyTable will
186- * be missing so we set it to instrumentation of HypertableModify node.
186+ * be missing so we set it to instrumentation of ModifyHypertable node.
187187 */
188188 if (mtstate -> ps .instrument )
189189 {
190190 /*
191191 * INSERT .. ON CONFLICT statements record few metrics in the ModifyTable node.
192- * So, copy them into HypertableModify node before replacing them.
192+ * So, copy them into ModifyHypertable node before replacing them.
193193 */
194194 node -> ss .ps .instrument -> ntuples2 = mtstate -> ps .instrument -> ntuples2 ;
195195 node -> ss .ps .instrument -> nfiltered1 = mtstate -> ps .instrument -> nfiltered1 ;
@@ -220,32 +220,32 @@ hypertable_modify_explain(CustomScanState *node, List *ancestors, ExplainState *
220220 ExplainPropertyInteger ("Batches deleted" , NULL , state -> batches_deleted , es );
221221}
222222
223- static CustomExecMethods hypertable_modify_state_methods = {
224- .CustomName = "HypertableModifyState " ,
225- .BeginCustomScan = hypertable_modify_begin ,
226- .EndCustomScan = hypertable_modify_end ,
227- .ExecCustomScan = hypertable_modify_exec ,
228- .ReScanCustomScan = hypertable_modify_rescan ,
229- .ExplainCustomScan = hypertable_modify_explain ,
223+ static CustomExecMethods modify_hypertable_state_methods = {
224+ .CustomName = "ModifyHypertableState " ,
225+ .BeginCustomScan = modify_hypertable_begin ,
226+ .EndCustomScan = modify_hypertable_end ,
227+ .ExecCustomScan = modify_hypertable_exec ,
228+ .ReScanCustomScan = modify_hypertable_rescan ,
229+ .ExplainCustomScan = modify_hypertable_explain ,
230230};
231231
232232static Node *
233- hypertable_modify_state_create (CustomScan * cscan )
233+ modify_hypertable_state_create (CustomScan * cscan )
234234{
235- HypertableModifyState * state ;
235+ ModifyHypertableState * state ;
236236 ModifyTable * mt = castNode (ModifyTable , linitial (cscan -> custom_plans ));
237237
238- state = (HypertableModifyState * ) newNode (sizeof (HypertableModifyState ), T_CustomScanState );
239- state -> cscan_state .methods = & hypertable_modify_state_methods ;
238+ state = (ModifyHypertableState * ) newNode (sizeof (ModifyHypertableState ), T_CustomScanState );
239+ state -> cscan_state .methods = & modify_hypertable_state_methods ;
240240 state -> mt = mt ;
241241 state -> mt -> arbiterIndexes = linitial (cscan -> custom_private );
242242
243243 return (Node * ) state ;
244244}
245245
246- static CustomScanMethods hypertable_modify_plan_methods = {
247- .CustomName = "HypertableModify " ,
248- .CreateCustomScanState = hypertable_modify_state_create ,
246+ static CustomScanMethods modify_hypertable_plan_methods = {
247+ .CustomName = "ModifyHypertable " ,
248+ .CreateCustomScanState = modify_hypertable_state_create ,
249249};
250250
251251/*
@@ -290,13 +290,13 @@ make_var_targetlist(const List *tlist)
290290 * set_plan_references().
291291 */
292292void
293- ts_hypertable_modify_fixup_tlist (Plan * plan )
293+ ts_modify_hypertable_fixup_tlist (Plan * plan )
294294{
295295 if (IsA (plan , CustomScan ))
296296 {
297297 CustomScan * cscan = (CustomScan * ) plan ;
298298
299- if (cscan -> methods == & hypertable_modify_plan_methods )
299+ if (cscan -> methods == & modify_hypertable_plan_methods )
300300 {
301301 ModifyTable * mt = linitial_node (ModifyTable , cscan -> custom_plans );
302302
@@ -344,13 +344,13 @@ ts_replace_rowid_vars(PlannerInfo *root, List *tlist, int varno)
344344}
345345
346346static Plan *
347- hypertable_modify_plan_create (PlannerInfo * root , RelOptInfo * rel , CustomPath * best_path ,
347+ modify_hypertable_plan_create (PlannerInfo * root , RelOptInfo * rel , CustomPath * best_path ,
348348 List * tlist , List * clauses , List * custom_plans )
349349{
350350 CustomScan * cscan = makeNode (CustomScan );
351351 ModifyTable * mt = linitial_node (ModifyTable , custom_plans );
352352
353- cscan -> methods = & hypertable_modify_plan_methods ;
353+ cscan -> methods = & modify_hypertable_plan_methods ;
354354 cscan -> custom_plans = custom_plans ;
355355 cscan -> scan .scanrelid = 0 ;
356356
@@ -427,19 +427,19 @@ hypertable_modify_plan_create(PlannerInfo *root, RelOptInfo *rel, CustomPath *be
427427 return & cscan -> scan .plan ;
428428}
429429
430- static CustomPathMethods hypertable_modify_path_methods = {
431- .CustomName = "HypertableModifyPath " ,
432- .PlanCustomPath = hypertable_modify_plan_create ,
430+ static CustomPathMethods modify_hypertable_path_methods = {
431+ .CustomName = "ModifyHypertablePath " ,
432+ .PlanCustomPath = modify_hypertable_plan_create ,
433433};
434434
435435Path *
436- ts_hypertable_modify_path_create (PlannerInfo * root , ModifyTablePath * mtpath , Hypertable * ht ,
436+ ts_modify_hypertable_path_create (PlannerInfo * root , ModifyTablePath * mtpath , Hypertable * ht ,
437437 RelOptInfo * rel )
438438{
439439 Path * path = & mtpath -> path ;
440440 Path * subpath = NULL ;
441441 Cache * hcache = ts_hypertable_cache_pin ();
442- HypertableModifyPath * hmpath ;
442+ ModifyHypertablePath * hmpath ;
443443 int i = 0 ;
444444
445445 /* PG14 only copies child rows and width if returningLists is not
@@ -459,14 +459,14 @@ ts_hypertable_modify_path_create(PlannerInfo *root, ModifyTablePath *mtpath, Hyp
459459 subpath = ts_chunk_dispatch_path_create (root , mtpath , rti , i );
460460 }
461461
462- hmpath = palloc0 (sizeof (HypertableModifyPath ));
462+ hmpath = palloc0 (sizeof (ModifyHypertablePath ));
463463
464464 /* Copy costs, etc. */
465465 memcpy (& hmpath -> cpath .path , path , sizeof (Path ));
466466 hmpath -> cpath .path .type = T_CustomPath ;
467467 hmpath -> cpath .path .pathtype = T_CustomScan ;
468468 hmpath -> cpath .custom_paths = list_make1 (mtpath );
469- hmpath -> cpath .methods = & hypertable_modify_path_methods ;
469+ hmpath -> cpath .methods = & modify_hypertable_path_methods ;
470470 path = & hmpath -> cpath .path ;
471471 if (subpath )
472472 mtpath -> subpath = subpath ;
@@ -476,22 +476,6 @@ ts_hypertable_modify_path_create(PlannerInfo *root, ModifyTablePath *mtpath, Hyp
476476 return path ;
477477}
478478
479- /*
480- * Callback for ModifyTableState->GetUpdateNewTuple for use by regular UPDATE.
481- */
482- static TupleTableSlot *
483- internalGetUpdateNewTuple (ResultRelInfo * relinfo , TupleTableSlot * planSlot , TupleTableSlot * oldSlot ,
484- MergeActionState * relaction )
485- {
486- ProjectionInfo * newProj = relinfo -> ri_projectNew ;
487- ExprContext * econtext ;
488-
489- econtext = newProj -> pi_exprContext ;
490- econtext -> ecxt_outertuple = planSlot ;
491- econtext -> ecxt_scantuple = oldSlot ;
492- return ExecProject (newProj );
493- }
494-
495479/* ----------------------------------------------------------------
496480 * ExecModifyTable
497481 *
@@ -504,7 +488,7 @@ internalGetUpdateNewTuple(ResultRelInfo *relinfo, TupleTableSlot *planSlot, Tupl
504488static TupleTableSlot *
505489ExecModifyTable (CustomScanState * cs_node , PlanState * pstate )
506490{
507- HypertableModifyState * ht_state = (HypertableModifyState * ) cs_node ;
491+ ModifyHypertableState * ht_state = (ModifyHypertableState * ) cs_node ;
508492 ModifyTableState * node = castNode (ModifyTableState , pstate );
509493 ModifyTableContext context ;
510494 EState * estate = node -> ps .state ;
@@ -893,8 +877,7 @@ ExecModifyTable(CustomScanState *cs_node, PlanState *pstate)
893877 if (!table_tuple_fetch_row_version (relation , tupleid , SnapshotAny , oldSlot ))
894878 elog (ERROR , "failed to fetch tuple being updated" );
895879 }
896- slot = internalGetUpdateNewTuple (resultRelInfo , context .planSlot , oldSlot , NULL );
897- context .GetUpdateNewTuple = internalGetUpdateNewTuple ;
880+ slot = ExecGetUpdateNewTuple (resultRelInfo , context .planSlot , oldSlot );
898881 context .relaction = NULL ;
899882 /* Now apply the update. */
900883 slot =
@@ -1320,26 +1303,6 @@ ExecGetInsertNewTuple(ResultRelInfo *relinfo, TupleTableSlot *planSlot)
13201303 return ExecProject (newProj );
13211304}
13221305
1323- /*
1324- * ExecGetUpdateNewTuple
1325- * This prepares a "new" tuple by combining an UPDATE subplan's output
1326- * tuple (which contains values of changed columns) with unchanged
1327- * columns taken from the old tuple.
1328- *
1329- * The subplan tuple might also contain junk columns, which are ignored.
1330- * Note that the projection also ensures we have a slot of the right type.
1331- */
1332- TupleTableSlot *
1333- ExecGetUpdateNewTuple (ResultRelInfo * relinfo , TupleTableSlot * planSlot , TupleTableSlot * oldSlot )
1334- {
1335- /* Use a few extra Asserts to protect against outside callers */
1336- Assert (relinfo -> ri_projectNewInfoValid );
1337- Assert (planSlot != NULL && !TTS_EMPTY (planSlot ));
1338- Assert (oldSlot != NULL && !TTS_EMPTY (oldSlot ));
1339-
1340- return internalGetUpdateNewTuple (relinfo , planSlot , oldSlot , NULL );
1341- }
1342-
13431306/* ----------------------------------------------------------------
13441307 * ExecInsert
13451308 *
0 commit comments