FILTER/WITHIN GROUP vs. expressions; is a HINT possible here? - Mailing list pgsql-hackers

From Josh Berkus
Subject FILTER/WITHIN GROUP vs. expressions; is a HINT possible here?
Date
Msg-id 55300BE6.5090409@agliodbs.com
Whole thread Raw
Responses Re: FILTER/WITHIN GROUP vs. expressions; is a HINT possible here?
Re: FILTER/WITHIN GROUP vs. expressions; is a HINT possible here?
List 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)
asmedian   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



pgsql-hackers by date:

Previous
From: Heikki Linnakangas
Date:
Subject: Re: Assertion failure when streaming logical changes
Next
From: Alvaro Herrera
Date:
Subject: Re: Supporting src/test/modules in MSVC builds