Re: Minor ON CONFLICT related fixes

Поиск
Список
Период
Сортировка
От Peter Geoghegan
Тема Re: Minor ON CONFLICT related fixes
Дата
Msg-id CAM3SWZT4qk3gAnCp-ZK0B=-tuG5g+q8_Ew+ZsxDBiNaQ4ESmZQ@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Minor ON CONFLICT related fixes  (Andres Freund <andres@anarazel.de>)
Ответы Re: Minor ON CONFLICT related fixes  (Andres Freund <andres@anarazel.de>)
Список pgsql-hackers
On Mon, May 11, 2015 at 7:34 PM, Andres Freund <andres@anarazel.de> wrote:
> You should try to understand why it's failing. Just prohibiting the
> rules, without understanding what's actually going on, could very well
> hide a real bug.

It's not as if I have no idea. ReplaceVarsFromTargetList() is probably
quite confused by all this, because the passed nomatch_varno argument
is often rt_index -- but what about EXCLUDED.*? adjustJoinTreeList()
does not know anything about EXCLUDED.* either. I see little practical
reason to make the rewriter do any better.

When I debugged the problem of the optimizer raising that "target
lists" error with a rule with an action with EXCLUDED.* (within
setrefs.c's fix_join_expr_mutator()), it looked like an off-by-one
issue here:

/* If it's for acceptable_rel, adjust and return it */
if (var->varno == context->acceptable_rel)
{   var = copyVar(var);   var->varno += context->rtoffset;   if (var->varnoold > 0)       var->varnoold +=
context->rtoffset;  return (Node *) var;
 
}

-- 
Peter Geoghegan



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Amit Kapila
Дата:
Сообщение: Re: pg_basebackup vs. Windows and tablespaces
Следующее
От: Andres Freund
Дата:
Сообщение: Re: Final Patch for GROUPING SETS