I wrote:
> Also, I think this is outright *wrong* for phrase search --- dropping some
> of the child nodes without any other adjustment isn't valid is it?
After further digging, it seems there's no bug because the tree is
originally binary and QTNTernary won't try to flatten OP_PHRASE nodes.
So we can't actually get to this logic for such nodes. But seems like
an Assert for that wouldn't be a bad thing.
regards, tom lane