0

我在 PostGIS 前面有 PostgREST,我想调用st_geomfromgeojson函数,如https://postgrest.org/en/stable/api.html#stored-procedures中所述。

curl -X 'POST' \
  'http://postgrest-host:port/rpc/st_geomfromgeojson' \
  -H 'accept: application/json' \
  -H 'Content-Type: application/json' \
  -d '{"type":"Point","coordinates":[-48.23456,20.12345]}'

得到错误:

{"hint":"Try renaming the parameters or the function itself in the database so function overloading can be resolved","message":"Could not choose the best candidate function between: public.st_geomfromgeojson( => json), public.st_geomfromgeojson( => jsonb)"}

有没有办法可以在 HTTP 请求中提供 PostGIS 函数参数以便public.st_geomfromgeojson( => json)选择?

4

1 回答 1

0

PostgREST 无法区分这两个重载函数,因为它们具有相同数量的具有相同名称但数据类型不同的参数。

一种解决方案是创建一个具有不同名称的包装函数并在其中调用该st_geomfromgeojson函数。然后你会调用包装函数来避免冲突。

于 2022-02-02T22:48:02.087 回答