The following select statement is part of the body of a function (returns void):
create or replace
function api.register(
auth_agent text,
auth_id text,
email text
)
returns void as $$
begin
select v1, v2
from auth.register(
auth_agent::core.auth_agent,
auth_id::text,
email::core.domain_email
) as ( v1 text, v2 text);
perform api.login(
auth_agent := v1,
auth_id := v2
);
end;
$$ security definer language plpgsql;
Calling the function generates the following error:
ERROR: query has no destination for result data
HINT: If you want to discard the results of a SELECT, use PERFORM instead.
CONTEXT: PL/pgSQL function auth.register(auth_agent,text,domain_email) line 12 at SQL statement
SQL statement "select v1, v2
from auth.register(
auth_agent::core.auth_agent,
auth_id::text,
email::core.domain_email
) as ( v1 text, v2 text)"
PL/pgSQL function api.register(text,text,text) line 7 at SQL statement
I'm confused. What's wrong here?
postgresql version: PostgreSQL 13.5 on x86_64-pc-linux-gnu, compiled by gcc, a ea47e69d19 p 313746c5ab, 64-bit