GeoServer 查询sql视图
                        
                            时间:2021-07-01 10:21:17
                            帮助过:3人阅读
							                        
                     
                    
                    
                     OR REPLACE FUNCTION public.func_pipelength()
  RETURNS TABLE(pipetype 
integer, pipelength 
double precision) 
AS
$BODY$
BEGIN
RETURN QUERY 
select 1 as pipetype,
sum(st_length(geom)) 
as pipelength 
from t_pressureline tp 
left join t_pressureline_type tpt 
on tp.pressuratingcode 
= tpt.id 
where tpt.belong 
= 1
union 
select 2 as pipetype,
sum(st_length(geom)) 
as pipelength 
from t_pressureline tp 
left join t_pressureline_type tpt 
on tp.pressuratingcode 
= tpt.id 
where tpt.belong 
= 2 
union 
select 3 as pipetype,
sum(st_length(geom)) 
as pipelength 
from t_pressureline tp 
left join t_pressureline_type tpt 
on tp.pressuratingcode 
= tpt.id 
where tpt.belong 
= 3
union 
select 0 as pipetype,
sum(st_length(geom)) 
as pipelength 
from t_pressureline tp 
left join t_pressureline_type tpt 
on tp.pressuratingcode 
= tpt.id 
where tpt.belong 
is null;
END;
问题:
 在尝试过程中还是遇到不少问题的,在此记录一下,以后再用时可以继续深入研究
1、GeoServer发布后,常常遇到这个错,度娘说是返回数据的格式问题,但是不知道怎么查。
经测试,用到case whe、Group by的都会报这个错

 
GeoServer 查询sql视图
标签:交互   sql   int   view   ESS   HERE   UNC   数据库   视图