0

I've PostgREST in front of PostGIS and I want to call the st_geomfromgeojson function as described at 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]}'

Getting error:

{"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)"}

Is there a way I can supply the PostGIS function parameter in HTTP request so that public.st_geomfromgeojson( => json) is chosen?

Moazzem Hossen
  • 2,276
  • 1
  • 19
  • 30

1 Answers1

0

PostgREST has no way to differentiate between those two overloaded functions due to them having the same quantity of parameters with the same name but different data type.

A solution would be to create a wrapper function with a different name and call the st_geomfromgeojson function inside of it. Then you'd call the wrapper function instead to avoid the conflict.

Laurence Isla
  • 343
  • 1
  • 5