Re: [HACKERS] [sqlsmith] Failed assertion inadjust_appendrel_attrs_mutator

Поиск
Список
Период
Сортировка
От Amit Langote
Тема Re: [HACKERS] [sqlsmith] Failed assertion inadjust_appendrel_attrs_mutator
Дата
Msg-id 6c4c8cbc-1ff5-2b6c-18a8-9d961efe998d@lab.ntt.co.jp
обсуждение исходный текст
Ответ на Re: [HACKERS] [sqlsmith] Failed assertion in adjust_appendrel_attrs_mutator  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: [HACKERS] [sqlsmith] Failed assertion in adjust_appendrel_attrs_mutator  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
On 2017/10/23 2:07, Tom Lane wrote:
> Andreas Seltenreich <seltenreich@gmx.de> writes:
>> testing master as of 7c981590c2, sqlsmith just triggered the following
>> assertion:
>> TRAP: FailedAssertion("!(!((((const Node*)(node))->type) == T_SubLink))", File: "prepunion.c", Line: 2231)
> 
> Hmm.  adjust_appendrel_attrs() thinks it's only used after conversion
> of sublinks to subplans, but this is a counterexample.  I wonder if
> that assumption was ever correct?  Or maybe we need to rethink what
> it does when recursing into RTE subqueries.

Looking at the backtrace, the crashing SubLink seems to have been
referenced from a PlaceHolderVar that is in turn referenced by
joinaliasvars of a JOIN rte in query->rtable.

I wonder if we shouldn't just ignore those (joinaliasvars in JOIN rtes)
while adjust_appendrel_attrs() is doing its job on a Query, just like we
ask to ignore subqueries by passing QTW_IGNORE_RC_SUBQUERIES to
query_tree_mutator()?  IOW, it doesn't look like anything critically
depends on the Vars referenced from joinaliasvars being translated at that
point in inheritance_planner(), but I may be missing something.

The attached patch to do the same, while didn't break any existing tests,
fixed the crash reported by OP.

Thoughts?

Thanks,
Amit

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Вложения

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

Предыдущее
От: Andres Freund
Дата:
Сообщение: Re: [HACKERS] legitimacy of using PG_TRY , PG_CATCH , PG_END_TRY inC function
Следующее
От: Ivan Kartyshov
Дата:
Сообщение: Re: [HACKERS] make async slave to wait for lsn to be replayed