How to call a stored procedure with mixed parameters: parameter list contains int and bytea #2722
Answered
by
steve-chavez
wuruilongll
asked this question in
Q&A
-
Environment
Description of issueI have written a function as follows: create or replace function public.img_cache_server(x int, y int,img bytea)
returns void
language plpgsql
as
$$
begin
insert into img_base_cache values(x,y,img);
end;
$$ when i call it by set the 'Content-Type': 'application/octet-stream' as follows, it can not call normally, how to set the request headers or body parameters? let parameters = {}
parameters['x'] = 0
parameters['y'] = 0
//data is the img bytes get from remote address
parameters['img'] = data
fetch('http://localhost:3000/rpc/img_cache_server',
{
headers: {
'Content-Type': 'application/octet-stream',
//'Content-Type': 'application/json'
},
method: 'post',
body: parameters
}
).then(function(response) {
}); |
Beta Was this translation helpful? Give feedback.
Answered by
steve-chavez
Mar 27, 2023
Replies: 1 comment
-
As a workaround, you could send To support this use case cleanly, we would need #922 |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
wolfgangwalther
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
As a workaround, you could send
x
andy
on headers and get them through https://postgrest.org/en/stable/api.html#accessing-request-headers-cookies-and-jwt-claims.To support this use case cleanly, we would need #922