Re: procedures and plpgsql PERFORM

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Ashutosh Bapat <ashutosh(dot)bapat(at)enterprisedb(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: procedures and plpgsql PERFORM
Date: 2017-12-14 08:01:06
Message-ID: CAFj8pRBz8XAwaT0a-hyRDtfzQn0Mfmh3z7kww-iYWdMoUTPFug@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

2017-12-14 8:21 GMT+01:00 Ashutosh Bapat <ashutosh(dot)bapat(at)enterprisedb(dot)com>:

> 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.
>

Why? The CALL is four chars more. It is keyword, and it reduce parser
complexity - we should not to different between routine name and variable
name.

So -1 from my for this proposal.

Regards

Pavel

>
> [1] https://www.postgresql.org/docs/devel/static/plpgsql-
> statements.html#PLPGSQL-STATEMENTS-SQL-NORESULT
> --
> Best Wishes,
> Ashutosh Bapat
> EnterpriseDB Corporation
> The Postgres Database Company
>
>

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Thomas Munro 2017-12-14 08:06:34 Re: [HACKERS] Parallel Hash take II
Previous Message Ashutosh Bapat 2017-12-14 07:21:59 procedures and plpgsql PERFORM