postgis 可以使用 geom returns table 正常运行,但未被 pg_featureserv 接收

postgis function correctly returns table with geom but not picked up by pg_featureserv

使用 pg_featureserv

写了一个函数 returns a table + geometry

CREATE OR REPLACE FUNCTION public.nearest_retail(lon float, lat float)
RETURNS table(id int,
              dba_name varchar,
              entity_name varchar,
              category varchar,
              address varchar,
              notes varchar,
              distance float,
              geom geometry
              ) 
AS $$
    select t.uid,dba_name,entity_name,md2.category,address,notes,distance,st_union(shape,geom) geom
        from
            (   select distinct on(category) category,uid,
                st_distance(st_transform(geom,2263),st_transform(st_setsrid(st_makepoint(lon, lat),4326),2263)) distance,
                st_shortestline(geom,st_setsrid(st_makepoint(lon, lat),4326)) shape
                from merged_datasets md 
                where st_dwithin(st_transform(st_setsrid(st_makepoint(lon, lat),4326),2263),st_transform(geom,2263),5280) 
                and category is not null 
            )t join merged_datasets md2 using(uid);
$$  LANGUAGE sql;

调用数据库本身的函数它按预期工作,但是我无法让它显示在 pg_featureserv

doc

Because there are usually many functions in a Postgres database, the service only publishes functions defined in the postgisftw schema.