Skip to content

Commit 8a347d6

Browse files
authored
Merge pull request #268 from postgrespro/PGPRO-7963
Pgpro 7963
2 parents e568aa6 + b1f19b7 commit 8a347d6

File tree

4 files changed

+73
-133
lines changed

4 files changed

+73
-133
lines changed

.travis.yml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,3 @@ env:
3030
- PG_VERSION=12
3131
- PG_VERSION=11 LEVEL=hardcore
3232
- PG_VERSION=11
33-
- PG_VERSION=10 LEVEL=hardcore
34-
- PG_VERSION=10
35-
36-
jobs:
37-
allow_failures:
38-
- env: PG_VERSION=10 LEVEL=nightmare

Dockerfile.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ RUN apk add --no-cache \
99
coreutils linux-headers \
1010
make musl-dev gcc bison flex \
1111
zlib-dev libedit-dev \
12-
clang clang-analyzer;
12+
clang clang15 clang-analyzer;
1313

1414
# Install fresh valgrind
1515
RUN apk add valgrind \

patches/REL_14_STABLE-pg_pathman-core.diff

Lines changed: 41 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ index bf551b0395..10d2044ae6 100644
2424
bool DefaultXactDeferrable = false;
2525
bool XactDeferrable;
2626
diff --git a/src/backend/executor/execExprInterp.c b/src/backend/executor/execExprInterp.c
27-
index 6b63f93e6d..060146d127 100644
27+
index bdf59a10fc..972453d9a5 100644
2828
--- a/src/backend/executor/execExprInterp.c
2929
+++ b/src/backend/executor/execExprInterp.c
3030
@@ -1799,6 +1799,16 @@ ExecInterpExpr(ExprState *state, ExprContext *econtext, bool *isnull)
@@ -77,7 +77,7 @@ index b3ce4bae53..8f2bb12542 100644
7777
* ResultRelInfos needed by subplans are initialized from scratch when the
7878
* subplans themselves are initialized.
7979
diff --git a/src/backend/executor/nodeModifyTable.c b/src/backend/executor/nodeModifyTable.c
80-
index 0780554246..a90f3a495d 100644
80+
index 55c430c9ec..21d9e6304a 100644
8181
--- a/src/backend/executor/nodeModifyTable.c
8282
+++ b/src/backend/executor/nodeModifyTable.c
8383
@@ -510,7 +510,7 @@ ExecInitInsertProjection(ModifyTableState *mtstate,
@@ -89,15 +89,15 @@ index 0780554246..a90f3a495d 100644
8989
ExecInitUpdateProjection(ModifyTableState *mtstate,
9090
ResultRelInfo *resultRelInfo)
9191
{
92-
@@ -2487,6 +2487,7 @@ ExecModifyTable(PlanState *pstate)
92+
@@ -2486,6 +2486,7 @@ ExecModifyTable(PlanState *pstate)
9393
ItemPointerData tuple_ctid;
9494
HeapTupleData oldtupdata;
9595
HeapTuple oldtuple;
9696
+ ResultRelInfo *saved_resultRelInfo;
9797

9898
CHECK_FOR_INTERRUPTS();
9999

100-
@@ -2524,12 +2525,23 @@ ExecModifyTable(PlanState *pstate)
100+
@@ -2523,12 +2524,23 @@ ExecModifyTable(PlanState *pstate)
101101
resultRelInfo = node->resultRelInfo + node->mt_lastResultIndex;
102102
subplanstate = outerPlanState(node);
103103

@@ -121,7 +121,7 @@ index 0780554246..a90f3a495d 100644
121121
/*
122122
* Reset the per-output-tuple exprcontext. This is needed because
123123
* triggers expect to use that context as workspace. It's a bit ugly
124-
@@ -2563,7 +2575,9 @@ ExecModifyTable(PlanState *pstate)
124+
@@ -2562,7 +2574,9 @@ ExecModifyTable(PlanState *pstate)
125125
bool isNull;
126126
Oid resultoid;
127127

@@ -132,7 +132,7 @@ index 0780554246..a90f3a495d 100644
132132
&isNull);
133133
if (isNull)
134134
elog(ERROR, "tableoid is NULL");
135-
@@ -2582,6 +2596,8 @@ ExecModifyTable(PlanState *pstate)
135+
@@ -2581,6 +2595,8 @@ ExecModifyTable(PlanState *pstate)
136136
if (resultRelInfo->ri_usesFdwDirectModify)
137137
{
138138
Assert(resultRelInfo->ri_projectReturning);
@@ -141,15 +141,15 @@ index 0780554246..a90f3a495d 100644
141141

142142
/*
143143
* A scan slot containing the data that was actually inserted,
144-
@@ -2591,6 +2607,7 @@ ExecModifyTable(PlanState *pstate)
144+
@@ -2590,6 +2606,7 @@ ExecModifyTable(PlanState *pstate)
145145
*/
146146
slot = ExecProcessReturning(resultRelInfo, NULL, planSlot);
147147

148148
+ estate->es_result_relation_info = saved_resultRelInfo;
149149
return slot;
150150
}
151151

152-
@@ -2620,7 +2637,8 @@ ExecModifyTable(PlanState *pstate)
152+
@@ -2619,7 +2636,8 @@ ExecModifyTable(PlanState *pstate)
153153
{
154154
/* ri_RowIdAttNo refers to a ctid attribute */
155155
Assert(AttributeNumberIsValid(resultRelInfo->ri_RowIdAttNo));
@@ -159,7 +159,7 @@ index 0780554246..a90f3a495d 100644
159159
resultRelInfo->ri_RowIdAttNo,
160160
&isNull);
161161
/* shouldn't ever get a null result... */
162-
@@ -2650,7 +2668,8 @@ ExecModifyTable(PlanState *pstate)
162+
@@ -2649,7 +2667,8 @@ ExecModifyTable(PlanState *pstate)
163163
*/
164164
else if (AttributeNumberIsValid(resultRelInfo->ri_RowIdAttNo))
165165
{
@@ -169,7 +169,7 @@ index 0780554246..a90f3a495d 100644
169169
resultRelInfo->ri_RowIdAttNo,
170170
&isNull);
171171
/* shouldn't ever get a null result... */
172-
@@ -2681,8 +2700,12 @@ ExecModifyTable(PlanState *pstate)
172+
@@ -2680,8 +2699,12 @@ ExecModifyTable(PlanState *pstate)
173173
/* Initialize projection info if first time for this table */
174174
if (unlikely(!resultRelInfo->ri_projectNewInfoValid))
175175
ExecInitInsertProjection(node, resultRelInfo);
@@ -184,58 +184,25 @@ index 0780554246..a90f3a495d 100644
184184
estate, node->canSetTag);
185185
break;
186186
case CMD_UPDATE:
187-
@@ -2690,37 +2713,45 @@ ExecModifyTable(PlanState *pstate)
187+
@@ -2689,6 +2712,13 @@ ExecModifyTable(PlanState *pstate)
188188
if (unlikely(!resultRelInfo->ri_projectNewInfoValid))
189189
ExecInitUpdateProjection(node, resultRelInfo);
190190

191-
- /*
192-
- * Make the new tuple by combining plan's output tuple with
193-
- * the old tuple being updated.
194-
- */
195-
- oldSlot = resultRelInfo->ri_oldTupleSlot;
196-
- if (oldtuple != NULL)
197-
- {
198-
- /* Use the wholerow junk attr as the old tuple. */
199-
- ExecForceStoreHeapTuple(oldtuple, oldSlot, false);
200-
- }
201-
- else
191+
+ /*
192+
+ * Do not change the indentation for PostgreSQL code to make it
193+
+ * easier to merge new PostgreSQL changes.
194+
+ */
202195
+ /* Do nothing in case tuple was modified in pg_pathman: */
203196
+ if (!estate->es_original_tuple)
204-
{
205-
- /* Fetch the most recent version of old tuple. */
206-
- Relation relation = resultRelInfo->ri_RelationDesc;
207-
-
208-
- Assert(tupleid != NULL);
209-
- if (!table_tuple_fetch_row_version(relation, tupleid,
210-
- SnapshotAny,
211-
- oldSlot))
212-
- elog(ERROR, "failed to fetch tuple being updated");
213-
+ /*
214-
+ * Make the new tuple by combining plan's output tuple
215-
+ * with the old tuple being updated.
216-
+ */
217-
+ oldSlot = resultRelInfo->ri_oldTupleSlot;
218-
+ if (oldtuple != NULL)
219-
+ {
220-
+ /* Use the wholerow junk attr as the old tuple. */
221-
+ ExecForceStoreHeapTuple(oldtuple, oldSlot, false);
222-
+ }
223-
+ else
224-
+ {
225-
+ /* Fetch the most recent version of old tuple. */
226-
+ Relation relation = resultRelInfo->ri_RelationDesc;
227-
+
228-
+ Assert(tupleid != NULL);
229-
+ if (!table_tuple_fetch_row_version(relation, tupleid,
230-
+ SnapshotAny,
231-
+ oldSlot))
232-
+ elog(ERROR, "failed to fetch tuple being updated");
233-
+ }
234-
+ slot = ExecGetUpdateNewTuple(resultRelInfo, planSlot,
235-
+ oldSlot);
197+
+ {
198+
/*
199+
* Make the new tuple by combining plan's output tuple with
200+
* the old tuple being updated.
201+
@@ -2712,14 +2742,19 @@ ExecModifyTable(PlanState *pstate)
236202
}
237-
- slot = ExecGetUpdateNewTuple(resultRelInfo, planSlot,
238-
- oldSlot);
203+
slot = ExecGetUpdateNewTuple(resultRelInfo, planSlot,
204+
oldSlot);
205+
+ }
239206

240207
/* Now apply the update. */
241208
- slot = ExecUpdate(node, resultRelInfo, tupleid, oldtuple, slot,
@@ -253,7 +220,7 @@ index 0780554246..a90f3a495d 100644
253220
planSlot, &node->mt_epqstate, estate,
254221
true, /* processReturning */
255222
node->canSetTag,
256-
@@ -2737,7 +2768,10 @@ ExecModifyTable(PlanState *pstate)
223+
@@ -2736,7 +2771,10 @@ ExecModifyTable(PlanState *pstate)
257224
* the work on next call.
258225
*/
259226
if (slot)
@@ -264,23 +231,23 @@ index 0780554246..a90f3a495d 100644
264231
}
265232

266233
/*
267-
@@ -2753,6 +2787,7 @@ ExecModifyTable(PlanState *pstate)
234+
@@ -2752,6 +2790,7 @@ ExecModifyTable(PlanState *pstate)
268235

269236
node->mt_done = true;
270237

271238
+ estate->es_result_relation_info = saved_resultRelInfo;
272239
return NULL;
273240
}
274241

275-
@@ -2827,6 +2862,7 @@ ExecInitModifyTable(ModifyTable *node, EState *estate, int eflags)
242+
@@ -2826,6 +2865,7 @@ ExecInitModifyTable(ModifyTable *node, EState *estate, int eflags)
276243
ListCell *l;
277244
int i;
278245
Relation rel;
279246
+ ResultRelInfo *saved_resultRelInfo;
280247

281248
/* check for unsupported flags */
282249
Assert(!(eflags & (EXEC_FLAG_BACKWARD | EXEC_FLAG_MARK)));
283-
@@ -2923,6 +2959,13 @@ ExecInitModifyTable(ModifyTable *node, EState *estate, int eflags)
250+
@@ -2922,6 +2962,13 @@ ExecInitModifyTable(ModifyTable *node, EState *estate, int eflags)
284251
i++;
285252
}
286253

@@ -294,7 +261,7 @@ index 0780554246..a90f3a495d 100644
294261
/*
295262
* Now we may initialize the subplan.
296263
*/
297-
@@ -3004,6 +3047,8 @@ ExecInitModifyTable(ModifyTable *node, EState *estate, int eflags)
264+
@@ -3002,6 +3049,8 @@ ExecInitModifyTable(ModifyTable *node, EState *estate, int eflags)
298265
ExecInitStoredGenerated(resultRelInfo, estate, operation);
299266
}
300267

@@ -386,6 +353,19 @@ index ee5ad3c058..dc474819d7 100644
386353
PartitionDirectory es_partition_directory; /* for PartitionDesc lookup */
387354

388355
/*
356+
diff --git a/src/include/utils/snapmgr.h b/src/include/utils/snapmgr.h
357+
index 33e6c14e81..abd9bba23e 100644
358+
--- a/src/include/utils/snapmgr.h
359+
+++ b/src/include/utils/snapmgr.h
360+
@@ -53,7 +53,7 @@ extern TimestampTz GetSnapshotCurrentTimestamp(void);
361+
extern TimestampTz GetOldSnapshotThresholdTimestamp(void);
362+
extern void SnapshotTooOldMagicForTest(void);
363+
364+
-extern bool FirstSnapshotSet;
365+
+extern PGDLLIMPORT bool FirstSnapshotSet;
366+
367+
extern PGDLLIMPORT TransactionId TransactionXmin;
368+
extern PGDLLIMPORT TransactionId RecentXmin;
389369
diff --git a/src/tools/msvc/Install.pm b/src/tools/msvc/Install.pm
390370
index de22c9ba2c..c8be5323b8 100644
391371
--- a/src/tools/msvc/Install.pm

0 commit comments

Comments
 (0)