Folks: SELECT device_id, count(*)::INT as present, count(*)::INT FILTER (WHERE valid) as valid_count, mode()::INT WITHIN GROUP (order by val) as mode, percentile_disc(0.5)::INT WITHIN GROUP (order by val) as median FROM dataflow_0913 GROUP BY device_id ORDER BY device_id;
ERROR: syntax error at or near "FILTER" LINE 4: count(*)::INT FILTER (WHERE valid) as valid_count, The error is right, that's invalid syntax. I can't insert a ::INT between the aggregate() and FILTER. However, the error message is also rather confusing to the user; they're likely to look for their mistake in the wrong place. The same goes for WITHIN GROUP (and OVER, too, I think). Is there some kind of possible HINT we could add to make this easier to debug? -- Josh Berkus PostgreSQL Experts Inc. http://pgexperts.com -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers