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

Commit5bdf3cf

Browse files
committed
Ensure tableoid reads correctly in EvalPlanQual-manufactured tuples.
The ROW_MARK_COPY path in EvalPlanQualFetchRowMarks() was just settingtableoid to InvalidOid, I think on the assumption that the referencedRTE must be a subquery or other case without a meaningful OID. However,foreign tables also use this code path, and they do have meaningfultable OIDs; so failure to set the tuple field can lead to user-visiblemisbehavior. Fix that by fetching the appropriate OID from the rangetable.There's still an issue about whether CTID can ever have a meaningfulvalue in this case; at least with postgres_fdw foreign tables, it does.But that is a different problem that seems to require a significantlydifferent patch --- it's debatable whether postgres_fdw really wants touse this code path at all.Simplified version of a patch by Etsuro Fujita, who also noted theproblem to begin with. The issue can be demonstrated in all versionshaving FDWs, so back-patch to 9.1.
1 parentd16d821 commit5bdf3cf

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

‎src/backend/executor/execMain.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2335,7 +2335,9 @@ EvalPlanQualFetchRowMarks(EPQState *epqstate)
23352335
/* build a temporary HeapTuple control structure */
23362336
tuple.t_len=HeapTupleHeaderGetDatumLength(td);
23372337
ItemPointerSetInvalid(&(tuple.t_self));
2338-
tuple.t_tableOid=InvalidOid;
2338+
/* relation might be a foreign table, if so provide tableoid */
2339+
tuple.t_tableOid=getrelid(erm->rti,
2340+
epqstate->estate->es_range_table);
23392341
tuple.t_data=td;
23402342

23412343
/* copy and store tuple */

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp