FILTER/WITHIN GROUP vs. expressions; is a HINT possible here?

Поиск
Список
Период
Сортировка
От Josh Berkus
Тема FILTER/WITHIN GROUP vs. expressions; is a HINT possible here?
Дата
Msg-id 55300BE6.5090409@agliodbs.com
обсуждение исходный текст
Ответы Re: FILTER/WITHIN GROUP vs. expressions; is a HINT possible here?  ("David G. Johnston" <david.g.johnston@gmail.com>)
Re: FILTER/WITHIN GROUP vs. expressions; is a HINT possible here?  (Tom Lane <tgl@sss.pgh.pa.us>)
Список 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 по дате отправления:

Предыдущее
От: Heikki Linnakangas
Дата:
Сообщение: Re: Assertion failure when streaming logical changes
Следующее
От: Alvaro Herrera
Дата:
Сообщение: Re: Supporting src/test/modules in MSVC builds