Marti Raudsepp <marti@juffo.org> writes:
> Is this just a planner shortcoming or a bug? Or is there some
> justification for this behavior?
Per the comment in is_safe_append_member():
* It's only safe to pull up the child if its jointree contains exactly * one RTE, else the AppendRelInfo data
structurebreaks. The one base RTE * could be buried in several levels of FromExpr, however. * * Also, the
childcan't have any WHERE quals because there's no place to * put them in an appendrel. (This is a bit
annoying...)
This will probably get fixed someday, but I wouldn't recommend holding
your breath for it.
regards, tom lane