Test HAVING condition before computing targetlist of an Aggregate node.
authorTom Lane <tgl@sss.pgh.pa.us>
Sat, 10 Jul 2004 18:39:23 +0000 (18:39 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Sat, 10 Jul 2004 18:39:23 +0000 (18:39 +0000)
commit82f755ec800849d1c0092fc90c9eba0225b10139
tree7017e3e1a27894dd45bb3de766d5f3d05ed2480b
parentafa035c204d07bd783ee49f2eefbb6b42eb58b29
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