У меня есть запрос, подобный следующему:
select
coalesce(s.import_date, r.import_date) as import_date,
coalesce(s.bedrooms, r.bedrooms) as bedrooms,
coalesce(s.ptype, r.ptype) as property_type,
s.s_price,
s.s_transactions,
....
r.r_rent,
....
from
(
select
sc.import_date,
sc.bedrooms,
sc.ptype,
percentile_cont(array[0.25,0.5,0.75,0.9]) within group (order by sc.asking_price) filter(where sc.price > 0) as s_price,
sum(1) filter(where sc.sold_price > 0) as s_transactions,
......
from prices sc
where sc.ptype = 'F' and sc.bedrooms = 2 and st_Intersects('010300002.....'::geometry,sc.geom)
and sc.import_date between '2012-01-01' and '2019-01-01'
group by sc.import_date, sc.bedrooms, sc.property_type
) s
full join
(
select
rc.import_date,
rc.bedrooms,
rc.ptype,
percentile_cont(array[0.25,0.5,0.75,0.9]) within group (order by rc.rent) filter(where rc.rent > 0) as r_rent,
.....
from rents rc
where rc.ptype = 'F' and rc.bedrooms = 2 and st_Intersects('010300002....'::geometry,rc.geom)
and rc.import_date between '2012-01-01' and '2019-01-01'
group by rc.import_date, rc.bedrooms, rc.property_type
) r
on r.import_date = s.import_date;
Когда я запускаю его для своих распределенных таблиц на Citus / Postgres-11, я получаю:
ERROR: unsupported aggregate function percentile_cont
Есть ли способ обойти это ограничение?