anonymous block returning like a function - Mailing list pgsql-hackers

From PegoraroF10
Subject anonymous block returning like a function
Date
Msg-id 1607713600899-0.post@n3.nabble.com
Whole thread Raw
Responses Re: anonymous block returning like a function
List pgsql-hackers
I would like to have an anonymous block, like DO, but having resuts, like an
usual function does.

I know any user can do ...

create function pg_temp.run_time_bigger(numeric,numeric) returns numeric
language plpgsql as $$ 
begin if $1 > $2 then return $1; else return $2; end if; end;$$;
select * from pg_temp.run_time_bigger(5,3);
drop function pg_temp.run_time_bigger(numeric,numeric);

but would be better if he could ...
execute block(numeric,numeric) returns numeric language plpgsql as $$ 
begin if $1 > $2 then return $1; else return $2; end if; end;$$ 
USING(5,3); 

That USING would be params, but if it complicates it could be easily be
replaced by real values because that block is entirely created in run time,
so its optional.

What do you think about ? 
What part of postgres code do I have to carefully understand to write
something to do that ?



--
Sent from: https://www.postgresql-archive.org/PostgreSQL-hackers-f1928748.html



pgsql-hackers by date:

Previous
From: "Bossart, Nathan"
Date:
Subject: Re: please update ps display for recovery checkpoint
Next
From: "Bossart, Nathan"
Date:
Subject: Re: pg_waldump error message fix