Processing of the special_functions is lost sometimes when used with -m
Closed this issue · 3 comments
borisz commented
Hi there,
Please look carefully at the two occurrences of extract(...).
>pgpp -v
pgpp 3.4, with PostgreSQL 13.3 parser
This block looks unexpected to me, since extract is transformed to date_part.
>pgpp -f -C -m 120 -S "select extract(hour from t1_modtime) as h, count(*) from t1 where t1_modtime::date = '2021-09-09' group by extract(hour from t1_modtime)"
SELECT pg_catalog.date_part('hour', t1_modtime) AS h, count(*)
FROM t1
WHERE CAST((t1_modtime) AS date) = '2021-09-09'
GROUP BY pg_catalog.date_part('hour', t1_modtime)
It works as expected without -m or with a smaller value.
>pgpp -f -C -m 40 -S "select extract(hour from t1_modtime) as h, count(*) from t1 where t1_modtime::date = '2021-09-09' group by extract(hour from t1_modtime)"
SELECT EXTRACT(HOUR FROM t1_modtime) AS h
, count(*)
FROM t1
WHERE CAST((t1_modtime) AS date) = '2021-09-09'
GROUP BY EXTRACT(HOUR FROM t1_modtime)
lelit commented
Thanks for the report, very strange indeed... will investigate asap.
lelit commented
This is fixed by referenced commit.
borisz commented
Thanks! This fixed my case. What a great project!