1
1
diff --git a/contrib/Makefile b/contrib/Makefile
2
- index bbf220407b..9a82a2db04 100644
2
+ index bbf220407b0..9a82a2db046 100644
3
3
--- a/contrib/Makefile
4
4
+++ b/contrib/Makefile
5
5
@@ -34,6 +34,7 @@ SUBDIRS = \
@@ -11,7 +11,7 @@ index bbf220407b..9a82a2db04 100644
11
11
pg_stat_statements \
12
12
pg_surgery \
13
13
diff --git a/src/backend/access/transam/xact.c b/src/backend/access/transam/xact.c
14
- index 47d80b0d25..6689776769 100644
14
+ index 594d8da2cdc..a2049e70e95 100644
15
15
--- a/src/backend/access/transam/xact.c
16
16
+++ b/src/backend/access/transam/xact.c
17
17
@@ -78,7 +78,7 @@ int DefaultXactIsoLevel = XACT_READ_COMMITTED;
@@ -24,10 +24,10 @@ index 47d80b0d25..6689776769 100644
24
24
bool DefaultXactDeferrable = false;
25
25
bool XactDeferrable;
26
26
diff --git a/src/backend/executor/execExprInterp.c b/src/backend/executor/execExprInterp.c
27
- index e44ad68cda..b9ba79e756 100644
27
+ index ef0f9577ab1..95858960d50 100644
28
28
--- a/src/backend/executor/execExprInterp.c
29
29
+++ b/src/backend/executor/execExprInterp.c
30
- @@ -1831 ,6 +1831 ,16 @@ ExecInterpExpr(ExprState *state, ExprContext *econtext, bool *isnull)
30
+ @@ -1801 ,6 +1801 ,16 @@ ExecInterpExpr(ExprState *state, ExprContext *econtext, bool *isnull)
31
31
}
32
32
33
33
out:
@@ -45,7 +45,7 @@ index e44ad68cda..b9ba79e756 100644
45
45
return state->resvalue;
46
46
}
47
47
diff --git a/src/backend/executor/execMain.c b/src/backend/executor/execMain.c
48
- index ef2fd46092..8551733c55 100644
48
+ index ef2fd46092e..8551733c55d 100644
49
49
--- a/src/backend/executor/execMain.c
50
50
+++ b/src/backend/executor/execMain.c
51
51
@@ -826,6 +826,13 @@ InitPlan(QueryDesc *queryDesc, int eflags)
@@ -77,27 +77,32 @@ index ef2fd46092..8551733c55 100644
77
77
* ResultRelInfos needed by subplans are initialized from scratch when the
78
78
* subplans themselves are initialized.
79
79
diff --git a/src/backend/executor/nodeModifyTable.c b/src/backend/executor/nodeModifyTable.c
80
- index a49c3da5b6..2c0b32e2df 100644
80
+ index 04454ad6e60..6a52e86b782 100644
81
81
--- a/src/backend/executor/nodeModifyTable.c
82
82
+++ b/src/backend/executor/nodeModifyTable.c
83
- @@ -551,7 +551,7 @@ ExecInitInsertProjection(ModifyTableState *mtstate,
84
- * This is also a convenient place to verify that the output of an UPDATE
85
- * matches the target table (ExecBuildUpdateProjection does that).
86
- */
87
- - static void
83
+ @@ -603,6 +603,13 @@ ExecInitUpdateProjection(ModifyTableState *mtstate,
84
+ resultRelInfo->ri_projectNewInfoValid = true;
85
+ }
86
+
88
87
+ void
89
- ExecInitUpdateProjection(ModifyTableState *mtstate,
90
- ResultRelInfo *resultRelInfo)
91
- {
92
- @@ -3460,6 +3460,7 @@ ExecModifyTable(PlanState *pstate)
88
+ + PgproExecInitUpdateProjection(ModifyTableState *mtstate,
89
+ + ResultRelInfo *resultRelInfo)
90
+ + {
91
+ + ExecInitUpdateProjection(mtstate, resultRelInfo);
92
+ + }
93
+ +
94
+ /*
95
+ * ExecGetInsertNewTuple
96
+ * This prepares a "new" tuple ready to be inserted into given result
97
+ @@ -3461,6 +3468,7 @@ ExecModifyTable(PlanState *pstate)
93
98
PartitionTupleRouting *proute = node->mt_partition_tuple_routing;
94
99
List *relinfos = NIL;
95
100
ListCell *lc;
96
101
+ ResultRelInfo *saved_resultRelInfo;
97
102
98
103
CHECK_FOR_INTERRUPTS();
99
104
100
- @@ -3501 ,6 +3502 ,8 @@ ExecModifyTable(PlanState *pstate)
105
+ @@ -3502 ,6 +3510 ,8 @@ ExecModifyTable(PlanState *pstate)
101
106
context.mtstate = node;
102
107
context.epqstate = &node->mt_epqstate;
103
108
context.estate = estate;
@@ -106,7 +111,7 @@ index a49c3da5b6..2c0b32e2df 100644
106
111
107
112
/*
108
113
* Fetch rows from subplan, and execute the required table modification
109
- @@ -3508 ,6 +3511 ,14 @@ ExecModifyTable(PlanState *pstate)
114
+ @@ -3509 ,6 +3519 ,14 @@ ExecModifyTable(PlanState *pstate)
110
115
*/
111
116
for (;;)
112
117
{
@@ -121,7 +126,7 @@ index a49c3da5b6..2c0b32e2df 100644
121
126
/*
122
127
* Reset the per-output-tuple exprcontext. This is needed because
123
128
* triggers expect to use that context as workspace. It's a bit ugly
124
- @@ -3541 ,7 +3552 ,9 @@ ExecModifyTable(PlanState *pstate)
129
+ @@ -3542 ,7 +3560 ,9 @@ ExecModifyTable(PlanState *pstate)
125
130
bool isNull;
126
131
Oid resultoid;
127
132
@@ -132,7 +137,7 @@ index a49c3da5b6..2c0b32e2df 100644
132
137
&isNull);
133
138
if (isNull)
134
139
{
135
- @@ -3578 ,6 +3591 ,8 @@ ExecModifyTable(PlanState *pstate)
140
+ @@ -3579 ,6 +3599 ,8 @@ ExecModifyTable(PlanState *pstate)
136
141
if (resultRelInfo->ri_usesFdwDirectModify)
137
142
{
138
143
Assert(resultRelInfo->ri_projectReturning);
@@ -141,15 +146,15 @@ index a49c3da5b6..2c0b32e2df 100644
141
146
142
147
/*
143
148
* A scan slot containing the data that was actually inserted,
144
- @@ -3587 ,6 +3602 ,7 @@ ExecModifyTable(PlanState *pstate)
149
+ @@ -3588 ,6 +3610 ,7 @@ ExecModifyTable(PlanState *pstate)
145
150
*/
146
151
slot = ExecProcessReturning(resultRelInfo, NULL, context.planSlot);
147
152
148
153
+ estate->es_result_relation_info = saved_resultRelInfo;
149
154
return slot;
150
155
}
151
156
152
- @@ -3617 ,7 +3633 ,8 @@ ExecModifyTable(PlanState *pstate)
157
+ @@ -3618 ,7 +3641 ,8 @@ ExecModifyTable(PlanState *pstate)
153
158
{
154
159
/* ri_RowIdAttNo refers to a ctid attribute */
155
160
Assert(AttributeNumberIsValid(resultRelInfo->ri_RowIdAttNo));
@@ -159,7 +164,7 @@ index a49c3da5b6..2c0b32e2df 100644
159
164
resultRelInfo->ri_RowIdAttNo,
160
165
&isNull);
161
166
162
- @@ -3665 ,7 +3682 ,8 @@ ExecModifyTable(PlanState *pstate)
167
+ @@ -3666 ,7 +3690 ,8 @@ ExecModifyTable(PlanState *pstate)
163
168
*/
164
169
else if (AttributeNumberIsValid(resultRelInfo->ri_RowIdAttNo))
165
170
{
@@ -169,7 +174,7 @@ index a49c3da5b6..2c0b32e2df 100644
169
174
resultRelInfo->ri_RowIdAttNo,
170
175
&isNull);
171
176
/* shouldn't ever get a null result... */
172
- @@ -3696 ,9 +3714 ,12 @@ ExecModifyTable(PlanState *pstate)
177
+ @@ -3697 ,9 +3722 ,12 @@ ExecModifyTable(PlanState *pstate)
173
178
/* Initialize projection info if first time for this table */
174
179
if (unlikely(!resultRelInfo->ri_projectNewInfoValid))
175
180
ExecInitInsertProjection(node, resultRelInfo);
@@ -185,7 +190,7 @@ index a49c3da5b6..2c0b32e2df 100644
185
190
break;
186
191
187
192
case CMD_UPDATE:
188
- @@ -3706 ,38 +3727 ,46 @@ ExecModifyTable(PlanState *pstate)
193
+ @@ -3707 ,38 +3735 ,46 @@ ExecModifyTable(PlanState *pstate)
189
194
if (unlikely(!resultRelInfo->ri_projectNewInfoValid))
190
195
ExecInitUpdateProjection(node, resultRelInfo);
191
196
@@ -255,7 +260,7 @@ index a49c3da5b6..2c0b32e2df 100644
255
260
true, false, node->canSetTag, NULL, NULL);
256
261
break;
257
262
258
- @@ -3755 ,7 +3784 ,10 @@ ExecModifyTable(PlanState *pstate)
263
+ @@ -3756 ,7 +3792 ,10 @@ ExecModifyTable(PlanState *pstate)
259
264
* the work on next call.
260
265
*/
261
266
if (slot)
@@ -266,23 +271,23 @@ index a49c3da5b6..2c0b32e2df 100644
266
271
}
267
272
268
273
/*
269
- @@ -3784 ,6 +3816 ,7 @@ ExecModifyTable(PlanState *pstate)
274
+ @@ -3785 ,6 +3824 ,7 @@ ExecModifyTable(PlanState *pstate)
270
275
271
276
node->mt_done = true;
272
277
273
278
+ estate->es_result_relation_info = saved_resultRelInfo;
274
279
return NULL;
275
280
}
276
281
277
- @@ -3858 ,6 +3891 ,7 @@ ExecInitModifyTable(ModifyTable *node, EState *estate, int eflags)
282
+ @@ -3859 ,6 +3899 ,7 @@ ExecInitModifyTable(ModifyTable *node, EState *estate, int eflags)
278
283
ListCell *l;
279
284
int i;
280
285
Relation rel;
281
286
+ ResultRelInfo *saved_resultRelInfo;
282
287
283
288
/* check for unsupported flags */
284
289
Assert(!(eflags & (EXEC_FLAG_BACKWARD | EXEC_FLAG_MARK)));
285
- @@ -3958 ,6 +3992 ,13 @@ ExecInitModifyTable(ModifyTable *node, EState *estate, int eflags)
290
+ @@ -3959 ,6 +4000 ,13 @@ ExecInitModifyTable(ModifyTable *node, EState *estate, int eflags)
286
291
i++;
287
292
}
288
293
@@ -296,7 +301,7 @@ index a49c3da5b6..2c0b32e2df 100644
296
301
/*
297
302
* Now we may initialize the subplan.
298
303
*/
299
- @@ -4040 ,6 +4081 ,8 @@ ExecInitModifyTable(ModifyTable *node, EState *estate, int eflags)
304
+ @@ -4041 ,6 +4089 ,8 @@ ExecInitModifyTable(ModifyTable *node, EState *estate, int eflags)
300
305
}
301
306
}
302
307
@@ -306,7 +311,7 @@ index a49c3da5b6..2c0b32e2df 100644
306
311
* If this is an inherited update/delete/merge, there will be a junk
307
312
* attribute named "tableoid" present in the subplan's targetlist. It
308
313
diff --git a/src/backend/utils/init/globals.c b/src/backend/utils/init/globals.c
309
- index 1a5d29ac9b..c70e3ff8b8 100644
314
+ index 1a5d29ac9ba..aadca8ea474 100644
310
315
--- a/src/backend/utils/init/globals.c
311
316
+++ b/src/backend/utils/init/globals.c
312
317
@@ -25,7 +25,7 @@
@@ -319,7 +324,7 @@ index 1a5d29ac9b..c70e3ff8b8 100644
319
324
volatile sig_atomic_t InterruptPending = false;
320
325
volatile sig_atomic_t QueryCancelPending = false;
321
326
diff --git a/src/include/access/xact.h b/src/include/access/xact.h
322
- index 4794941df3..483050268e 100644
327
+ index 65616ca2f79..965eb544217 100644
323
328
--- a/src/include/access/xact.h
324
329
+++ b/src/include/access/xact.h
325
330
@@ -53,6 +53,8 @@ extern PGDLLIMPORT int XactIsoLevel;
@@ -332,19 +337,29 @@ index 4794941df3..483050268e 100644
332
337
333
338
/* flag for logging statements in this transaction */
334
339
diff --git a/src/include/executor/executor.h b/src/include/executor/executor.h
335
- index d68a6b9d28..a96eb93316 100644
340
+ index 82925b4b633..de23622ca24 100644
336
341
--- a/src/include/executor/executor.h
337
342
+++ b/src/include/executor/executor.h
338
- @@ -661 ,5 +661,7 @@ extern ResultRelInfo *ExecLookupResultRelByOid(ModifyTableState *node,
343
+ @@ -659 ,5 +659,17 @@ extern ResultRelInfo *ExecLookupResultRelByOid(ModifyTableState *node,
339
344
Oid resultoid,
340
345
bool missing_ok,
341
346
bool update_cache);
342
- + extern void ExecInitUpdateProjection(ModifyTableState *mtstate,
343
- + ResultRelInfo *resultRelInfo);
347
+ + #define PG_HAVE_PGPRO_EXEC_INIT_UPDATE_PROJECTION
348
+ + /*
349
+ + * This function is static in vanilla, but pg_pathman wants it exported.
350
+ + * We cannot make it extern with the same name to avoid compilation errors
351
+ + * in timescaledb, which ships it's own static copy of the same function.
352
+ + * So, export ExecInitUpdateProjection with Pgpro prefix.
353
+ + *
354
+ + * The define above helps pg_pathman to expect proper exported symbol
355
+ + * from various versions of pgpro.
356
+ + */
357
+ + extern void PgproExecInitUpdateProjection(ModifyTableState *mtstate,
358
+ + ResultRelInfo *resultRelInfo);
344
359
345
360
#endif /* EXECUTOR_H */
346
361
diff --git a/src/include/nodes/execnodes.h b/src/include/nodes/execnodes.h
347
- index 5728801379..ec5496afff 100644
362
+ index 57288013795..ec5496afffa 100644
348
363
--- a/src/include/nodes/execnodes.h
349
364
+++ b/src/include/nodes/execnodes.h
350
365
@@ -611,6 +611,12 @@ typedef struct EState
@@ -361,7 +376,7 @@ index 5728801379..ec5496afff 100644
361
376
362
377
/*
363
378
diff --git a/src/tools/msvc/Install.pm b/src/tools/msvc/Install.pm
364
- index 8de79c618c..c9226ba5ad 100644
379
+ index 8de79c618cb..c9226ba5ad4 100644
365
380
--- a/src/tools/msvc/Install.pm
366
381
+++ b/src/tools/msvc/Install.pm
367
382
@@ -30,6 +30,18 @@ my @client_program_files = (
@@ -393,7 +408,7 @@ index 8de79c618c..c9226ba5ad 100644
393
408
394
409
sub CopyIncludeFiles
395
410
diff --git a/src/tools/msvc/Mkvcbuild.pm b/src/tools/msvc/Mkvcbuild.pm
396
- index e4feda10fd..74a0a0a062 100644
411
+ index e4feda10fd8..74a0a0a062b 100644
397
412
--- a/src/tools/msvc/Mkvcbuild.pm
398
413
+++ b/src/tools/msvc/Mkvcbuild.pm
399
414
@@ -39,8 +39,8 @@ my $contrib_defines = {};
0 commit comments