Re: [Bug] Inconsistent result for inheritance and FOR UPDATE.
От | Etsuro Fujita |
---|---|
Тема | Re: [Bug] Inconsistent result for inheritance and FOR UPDATE. |
Дата | |
Msg-id | 548A4D79.3050502@lab.ntt.co.jp обсуждение исходный текст |
Ответ на | Re: [Bug] Inconsistent result for inheritance and FOR UPDATE. (Tom Lane <tgl@sss.pgh.pa.us>) |
Ответы |
Re: [Bug] Inconsistent result for inheritance and FOR UPDATE.
|
Список | pgsql-hackers |
(2014/12/12 10:37), Tom Lane wrote: > Yeah, this is clearly a thinko: really, nothing in the planner should > be using get_parse_rowmark(). I looked around for other errors of the > same type and found that postgresGetForeignPlan() is also using > get_parse_rowmark(). While that's harmless at the moment because we > don't support foreign tables as children, it's still wrong. Will > fix that too. I don't think we need to fix that too. In order to support that, I'm proposing to modify postgresGetForeignPlan() in the following way [1] (see fdw-inh-5.patch). *** a/contrib/postgres_fdw/postgres_fdw.c --- b/contrib/postgres_fdw/postgres_fdw.c *************** *** 824,834 **** postgresGetForeignPlan(PlannerInfo *root, { RowMarkClause *rc = get_parse_rowmark(root->parse,baserel->relid); if (rc) { /* ! * Relation is specified as a FOR UPDATE/SHARE target, so handle ! * that. * * For now, just ignore any [NO] KEY specification, since (a) it's * not clear what that means for a remote table that we don't have --- 824,847 ---- { RowMarkClause *rc = get_parse_rowmark(root->parse, baserel->relid); + /* + * It's possible that relation is contained in an inheritance set and + * that parent relation is selected FOR UPDATE/SHARE. If so, get the + * RowMarkClause for parent relation. + */ + if (rc == NULL) + { + PlanRowMark *prm = get_plan_rowmark(root->rowMarks, baserel->relid); + + if (prm && prm->rti != prm->prti) + rc = get_parse_rowmark(root->parse, prm->prti); + } + if (rc) { /* ! * Relation or parent relation is specified as a FOR UPDATE/SHARE ! * target, so handle that. * * For now, just ignore any [NO] KEY specification, since(a) it's * not clear what that means for a remote table that we don't have [1] http://www.postgresql.org/message-id/5487BB9D.7070605@lab.ntt.co.jp Thanks, Best regards, Etsuro Fujita
В списке pgsql-hackers по дате отправления: