mirror of
https://github.com/postgres/postgres.git
synced 2025-07-14 08:21:07 +03:00
Pull in tableoid for inheiritance with rowMarks
As noted by Etsuro Fujita [1] and Dean Rasheed[2],
cb1ca4d800
changed ExecBuildAuxRowMark()
to always look for the tableoid in the target list, but didn't also
change preprocess_targetlist() to always include the tableoid. This
resulted in errors with soon-to-be-added RLS with inheritance tests,
and errors when using inheritance with foreign tables.
Authors: Etsuro Fujita and Dean Rasheed (independently)
Minor word-smithing on the comments by me.
[1] 552CF0B6.8010006@lab.ntt.co.jp
[2] CAEZATCVmFUfUOwwhnBTcgi6AquyjQ0-1fyKd0T3xBWJvn+xsFA@mail.gmail.com
This commit is contained in:
@ -107,23 +107,6 @@ preprocess_targetlist(PlannerInfo *root, List *tlist)
|
||||
pstrdup(resname),
|
||||
true);
|
||||
tlist = lappend(tlist, tle);
|
||||
|
||||
/* if parent of inheritance tree, need the tableoid too */
|
||||
if (rc->isParent)
|
||||
{
|
||||
var = makeVar(rc->rti,
|
||||
TableOidAttributeNumber,
|
||||
OIDOID,
|
||||
-1,
|
||||
InvalidOid,
|
||||
0);
|
||||
snprintf(resname, sizeof(resname), "tableoid%u", rc->rowmarkId);
|
||||
tle = makeTargetEntry((Expr *) var,
|
||||
list_length(tlist) + 1,
|
||||
pstrdup(resname),
|
||||
true);
|
||||
tlist = lappend(tlist, tle);
|
||||
}
|
||||
}
|
||||
if (rc->allMarkTypes & (1 << ROW_MARK_COPY))
|
||||
{
|
||||
@ -139,6 +122,23 @@ preprocess_targetlist(PlannerInfo *root, List *tlist)
|
||||
true);
|
||||
tlist = lappend(tlist, tle);
|
||||
}
|
||||
|
||||
/* If parent of inheritance tree, always fetch the tableoid too. */
|
||||
if (rc->isParent)
|
||||
{
|
||||
var = makeVar(rc->rti,
|
||||
TableOidAttributeNumber,
|
||||
OIDOID,
|
||||
-1,
|
||||
InvalidOid,
|
||||
0);
|
||||
snprintf(resname, sizeof(resname), "tableoid%u", rc->rowmarkId);
|
||||
tle = makeTargetEntry((Expr *) var,
|
||||
list_length(tlist) + 1,
|
||||
pstrdup(resname),
|
||||
true);
|
||||
tlist = lappend(tlist, tle);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
Reference in New Issue
Block a user