From: | Josh Berkus <josh(at)agliodbs(dot)com> |
---|---|
To: | PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | FILTER/WITHIN GROUP vs. expressions; is a HINT possible here? |
Date: | 2015-04-16 19:22:14 |
Message-ID: | 55300BE6.5090409@agliodbs.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
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
From | Date | Subject | |
---|---|---|---|
Next Message | Alvaro Herrera | 2015-04-16 19:47:17 | Re: Supporting src/test/modules in MSVC builds |
Previous Message | Heikki Linnakangas | 2015-04-16 18:52:08 | Re: Assertion failure when streaming logical changes |