This was performed on Ubuntu 14.04 with a fresh install of PostgreSQL 9.3.14 directly from the official Postgres apt repo. It only works if the query planner chooses the attached plan (with HashAggregate).
Create and populate a new database:
psql -U postgres -c "create database test;"
psql -U postgres test < populate.sqlOpen a connection to the database and execute query.sql. The Postgres worker memory usage will rise approximately 50MB and won't be released until the connection is closed.
That seems to be jumping to conclusions. Maybe there was a user report, but you just didn't see it? The message that was quoted above mentions that a fix was done in
https://git.postgresql.org/gitweb/?p=postgresql.git;a=commitdiff;h=b419865a814abbca12bdd6eef6a3d5ed67f432e1
(which was part of Postgres 9.5.0 and onwards) and in that commit message Jeff cites this 2013 report: https://postgr.es/m/3839201.Nfa2RvcheX@techfox.foxi