Allow to push down clauses from HAVING to WHERE when grouping sets are used.
Allow to push down clauses from HAVING to WHERE when grouping sets are used.

Previously we disallowed pushing down quals to WHERE in the presence of
grouping sets. That's overly restrictive.

We now instead copy quals to WHERE if applicable, leaving the
one in HAVING in place. That's because, at that stage of the planning
process, it's nontrivial to determine if it's safe to remove the one in
HAVING.

Author: Andrew Gierth
Discussion: 5ba7acece1b6bcb1179d3320a3f2d8447d0743b7@news-spur.riddles.org.uk
Backpatch: 9.5, where grouping sets were introduced. This isn't exactly
    a bugfix, but it seems better to keep the branches in sync at this point.

zeroae/postgres-xl,zeroae/postgres-xl,zeroae/postgres-xl,zeroae/postgres-xl,zeroae/postgres-xl