Test HAVING condition before computing targetlist of an Aggregate node.
authorTom Lane <tgl@sss.pgh.pa.us>
Sat, 10 Jul 2004 18:39:44 +0000 (18:39 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Sat, 10 Jul 2004 18:39:44 +0000 (18:39 +0000)
commit34559a9f2a99ee24b070aecb8f6f5e8e23aafd8c
tree94d3f2d3228806faaf4614442b956f7dbbac0222
parent373a1fbc5b788f66c225696e00305a8caf03638e
Test HAVING condition before computing targetlist of an Aggregate node.
This is required by SQL spec to avoid failures in cases like
  SELECT sum(win)/sum(lose) FROM ... GROUP BY ... HAVING sum(lose) > 0;
AFAICT we have gotten this wrong since day one.  Kudos to Holger Jakobs
for being the first to notice.
src/backend/executor/nodeAgg.c