Re: procedures and plpgsql PERFORM

Поиск
Список
Период
Сортировка
От Merlin Moncure
Тема Re: procedures and plpgsql PERFORM
Дата
Msg-id CAHyXU0ws=6fk=zfpQXMF4MZTKyJAi6wJ0J-yY7NNOESL8vgxtQ@mail.gmail.com
обсуждение исходный текст
Ответ на procedures and plpgsql PERFORM  (Ashutosh Bapat <ashutosh.bapat@enterprisedb.com>)
Список pgsql-hackers
On Thursday, December 14, 2017, Ashutosh Bapat <ashutosh.bapat@enterprisedb.com> wrote:
Hi,
We allow a function to be invoked as part of PERFORM statement in plpgsql
do $$
begin perform pg_relation_size('t1'); end; $$ language plpgsql;
DO

But we do not allow a procedure to be invoked this way
 create procedure dummy_proc(a int) as $$
begin null; end;
$$ language plpgsql;
CREATE PROCEDURE

do $$
begin perform dummy_proc(1); end; $$ language plpgsql;
ERROR:  dummy_proc(integer) is a procedure
LINE 1: SELECT dummy_proc(1)
               ^
HINT:  To call a procedure, use CALL.
QUERY:  SELECT dummy_proc(1)
CONTEXT:  PL/pgSQL function inline_code_block line 2 at PERFORM

The documentation of PERFORM [1] says
"For any SQL command that does not return rows, for example INSERT
without a RETURNING clause, you can execute the command within a
PL/pgSQL function just by writing the command."

Procedures fit that category and like functions, I think, we should
allow them be invoked directly without any quoting and CALL
decoration.

I disagree.  The SQL command is 'CALL'.  The documentation is really only clarifying when PERFORM is explicitly required.

merlin 

 

В списке pgsql-hackers по дате отправления:

Предыдущее
От: Andres Freund
Дата:
Сообщение: Re: [HACKERS] Parallel Hash take II
Следующее
От: Fabien COELHO
Дата:
Сообщение: Re: pgbench's expression parsing & negative numbers