@@ -28,7 +28,6 @@ CustomScanMethods partition_update_plan_methods;
28
28
CustomExecMethods partition_update_exec_methods ;
29
29
30
30
static TupleTableSlot * ExecDeleteInternal (ItemPointer tupleid ,
31
- HeapTuple oldtuple ,
32
31
TupleTableSlot * planSlot ,
33
32
EPQState * epqstate ,
34
33
EState * estate );
@@ -138,15 +137,12 @@ partition_update_exec(CustomScanState *node)
138
137
if (!TupIsNull (slot ))
139
138
{
140
139
Datum datum ;
141
- bool isNull ;
142
140
char relkind ;
143
141
ResultRelInfo * resultRelInfo ,
144
142
* sourceRelInfo ;
145
143
ItemPointer tupleid = NULL ;
146
144
ItemPointerData tuple_ctid ;
147
145
EPQState epqstate ;
148
- HeapTupleData oldtupdata ;
149
- HeapTuple oldtuple = NULL ;
150
146
PartitionFilterState * child_state ;
151
147
JunkFilter * junkfilter ;
152
148
@@ -178,28 +174,9 @@ partition_update_exec(CustomScanState *node)
178
174
tupleid = & tuple_ctid ;
179
175
}
180
176
else if (relkind == RELKIND_FOREIGN_TABLE )
181
- {
182
- if (AttributeNumberIsValid (junkfilter -> jf_junkAttNo ))
183
- {
184
- datum = ExecGetJunkAttribute (child_state -> subplan_slot ,
185
- junkfilter -> jf_junkAttNo ,
186
- & isNull );
187
- /* shouldn't ever get a null result... */
188
- if (isNull )
189
- elog (ERROR , "wholerow is NULL" );
190
-
191
- oldtupdata .t_data = DatumGetHeapTupleHeader (datum );
192
- oldtupdata .t_len =
193
- HeapTupleHeaderGetDatumLength (oldtupdata .t_data );
194
- ItemPointerSetInvalid (& (oldtupdata .t_self ));
195
-
196
- /* Historically, view triggers see invalid t_tableOid. */
197
- oldtupdata .t_tableOid = RelationGetRelid (resultRelInfo -> ri_RelationDesc );
198
- oldtuple = & oldtupdata ;
199
- }
200
- }
177
+ elog (ERROR , "update node is not supported for foreign tables" );
201
178
else
202
- elog (ERROR , "got unexpected type of relation" );
179
+ elog (ERROR , "got unexpected type of relation for update " );
203
180
204
181
/*
205
182
* Clean from junk attributes before INSERT,
@@ -209,14 +186,9 @@ partition_update_exec(CustomScanState *node)
209
186
slot = ExecFilterJunk (junkfilter , slot );
210
187
}
211
188
212
- /*
213
- * Delete old tuple. We have two cases here:
214
- * 1) local tables - tupleid points to actual tuple
215
- * 2) foreign tables - tupleid is invalid, slot is required
216
- */
189
+ /* Delete old tuple */
217
190
estate -> es_result_relation_info = sourceRelInfo ;
218
- ExecDeleteInternal (tupleid , oldtuple , child_state -> subplan_slot ,
219
- & epqstate , estate );
191
+ ExecDeleteInternal (tupleid , child_state -> subplan_slot , & epqstate , estate );
220
192
221
193
/* we've got the slot that can be inserted to child partition */
222
194
estate -> es_result_relation_info = resultRelInfo ;
@@ -254,15 +226,14 @@ partition_update_explain(CustomScanState *node, List *ancestors, ExplainState *e
254
226
*/
255
227
static TupleTableSlot *
256
228
ExecDeleteInternal (ItemPointer tupleid ,
257
- HeapTuple oldtuple ,
258
229
TupleTableSlot * planSlot ,
259
230
EPQState * epqstate ,
260
231
EState * estate )
261
232
{
262
- ResultRelInfo * resultRelInfo ;
263
- Relation resultRelationDesc ;
264
- HTSU_Result result ;
265
- HeapUpdateFailureData hufd ;
233
+ ResultRelInfo * resultRelInfo ;
234
+ Relation resultRelationDesc ;
235
+ HTSU_Result result ;
236
+ HeapUpdateFailureData hufd ;
266
237
267
238
/*
268
239
* get information on the (current) result relation
@@ -277,29 +248,13 @@ ExecDeleteInternal(ItemPointer tupleid,
277
248
bool dodelete ;
278
249
279
250
dodelete = ExecBRDeleteTriggers (estate , epqstate , resultRelInfo ,
280
- tupleid , oldtuple );
251
+ tupleid , NULL );
281
252
282
253
if (!dodelete )
283
254
elog (ERROR , "the old row always should be deleted from child table" );
284
255
}
285
256
286
- if (resultRelInfo -> ri_FdwRoutine )
287
- {
288
- TupleTableSlot * slot = MakeSingleTupleTableSlot (RelationGetDescr (resultRelationDesc ));
289
-
290
- /*
291
- * delete from foreign table: let the FDW do it
292
- */
293
- ExecSetSlotDescriptor (slot , RelationGetDescr (resultRelationDesc ));
294
- resultRelInfo -> ri_FdwRoutine -> ExecForeignDelete (estate ,
295
- resultRelInfo ,
296
- slot ,
297
- planSlot );
298
-
299
- /* we don't need slot anymore */
300
- ExecDropSingleTupleTableSlot (slot );
301
- }
302
- else if (tupleid != NULL )
257
+ if (tupleid != NULL )
303
258
{
304
259
/* delete the tuple */
305
260
ldelete :;
@@ -358,7 +313,7 @@ ldelete:;
358
313
elog (ERROR , "tupleid should be specified for deletion" );
359
314
360
315
/* AFTER ROW DELETE Triggers */
361
- ExecARDeleteTriggers (estate , resultRelInfo , tupleid , oldtuple );
316
+ ExecARDeleteTriggers (estate , resultRelInfo , tupleid , NULL );
362
317
363
318
return NULL ;
364
319
}
0 commit comments