Alvaro Herrera <alvherre@2ndquadrant.com> writes:
> FWIW I can reproduce the crash in 9.3 HEAD with these scripts, so that's
> probably helpful enough. Table "Article" (not sent) is referenced in an
> FK, but I just commented out that clause. Backtrace is:
> #0 0x00007fd34d9ca1a5 in *__GI_raise (sig=<optimized out>) at ../nptl/sysdeps/unix/sysv/linux/raise.c:64
> #1 0x00007fd34d9cd420 in *__GI_abort () at abort.c:92
> #2 0x0000000000768c27 in ExceptionalCondition (conditionName=conditionName@entry=0x8c76b0
"!(!bms_overlap(appendrel->relids,required_outer))",
> errorType=errorType@entry=0x7a080c "FailedAssertion",
> fileName=fileName@entry=0x8c7470
"../../../../../../../../../../pgsql/source/REL9_3_STABLE/src/backend/optimizer/util/relnode.c",
> lineNumber=lineNumber@entry=953) at
../../../../../../../../../../pgsql/source/REL9_3_STABLE/src/backend/utils/error/assert.c:54
Hm, probably the same thing then as
http://www.postgresql.org/message-id/2326379.AOuSqtNClj@klinga.prans.org
I was poking at that one earlier this evening. The immediate fix is clear
enough (generate_implied_equalities_for_column should be considering
"grandparent" appendrels), but I'm not sure yet whether we need to change
the logic in generate_join_implied_equalities.
In the meantime, the OP could probably dodge the problem by not nesting
the UNION ALLs like that ...
regards, tom lane