Call rpc function with multiple unnamed parameters? #3886
-
I am using PostgREST as a front end to a PostGIS database that has several functions that take multiple positional/unnamed parameters, along with named parameters, in the form of: create or replace function hello_world(integer, integer) returns text as $$
select 'Hello world ' || $1 || ' ' || $2 ;
$$ language sql; that can be called in psql with:
here's an actual example: CREATE OR REPLACE FUNCTION public.pgr_findcloseedges(
text,
geometry,
double precision,
cap integer DEFAULT 1,
partial boolean DEFAULT true,
dryrun boolean DEFAULT false,
OUT edge_id bigint,
OUT fraction double precision,
OUT side character,
OUT distance double precision,
OUT geom geometry,
OUT edge geometry)
RETURNS SETOF record
LANGUAGE 'plpgsql' This is actually a two-part question:
|
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
https://stackoverflow.com/questions/48788771/convert-json-containing-geometry-to-postgresql Does this answer you question? |
Beta Was this translation helpful? Give feedback.
-
Sort of, but these functions are provided by a Postgres extension, so I'd need to write my own wrappers to handle multiple unnamed parameters that in turns calls the function from the extension. RE: Point geometry as a function parameter, same thing applies, I guess I'd need to write my own wrappers around the PostGIS functions to process the inputs properly. |
Beta Was this translation helpful? Give feedback.
-
This is not possible by design. PostgREST only allows functions with a single unnamed parameters to send raw data. Otherwise, you need to name all parameters to make it work.
You can use string representation to work with different data types, including PostGIS ones. There's a how-to in the docs that can help you. |
Beta Was this translation helpful? Give feedback.
This is not possible by design. PostgREST only allows functions with a single unnamed parameters to send raw data. Otherwise, you need to name all parameters to make it work.
You can use string representation to work with different data types, including PostGIS ones. There's a how-to in the docs that can help you.