Hi Vik, The patch seems quite ready, I have just two comments.
1) Shouldn't this add another <indexterm> for DISTINCT, somewhere in the documentation? Now the index points just to the SELECT DISTINCT part. 2) The part in gram.y that wraps/unwraps the boolean flag as an integer, in order to stash it in the group lists is rather ugly, IMHO. It forces all the places handling the list to be aware of this (there are not many, but still ...). And there are no other places doing (bool) intVal so it's not like there's a precedent for this. I think the clean solution is to make group_clause produce a struct with two fields, and just use that. Not sure how invasive that will be outside gram.y, though. Also, the all_or_distinct vs. distinct_or_all seems a bit error-prone. I wonder if we can come up with some clearer names, describing the context of those types. regards -- Tomas Vondra EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company