anonymous block returning like a function

Поиск
Список
Период
Сортировка
От PegoraroF10
Тема anonymous block returning like a function
Дата
Msg-id 1607713600899-0.post@n3.nabble.com
обсуждение исходный текст
Ответы Re: anonymous block returning like a function  (Heikki Linnakangas <hlinnaka@iki.fi>)
Список 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 по дате отправления:

Предыдущее
От: "Bossart, Nathan"
Дата:
Сообщение: Re: please update ps display for recovery checkpoint
Следующее
От: "Bossart, Nathan"
Дата:
Сообщение: Re: pg_waldump error message fix