Re: new stored procedure with OUT parameters

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Anton Shen <4175george(at)gmail(dot)com>
Cc: pgsql-general <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: new stored procedure with OUT parameters
Date: 2018-12-15 18:02:55
Message-ID: CAFj8pRB1M=dVqT283=p2=0K3dfYxPP5s9=z5fW3iescZW1M+8w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi

út 11. 12. 2018 v 7:20 odesílatel Anton Shen <4175george(at)gmail(dot)com> napsal:

> Hi all,
>
> I was playing around with the stored procedure support in v11 and found
> that pure OUT parameters are not supported. Is there any reason we only
> support INOUT but not OUT parameters?
>

The procedure implementation in v11 is initial stage - only functionality
with some simple implementation or without design issues was implemented.

If I remember there was not clean what is correct and expected behave of
usage of OUT variable when it is called from SQL environment, and when it
is called from plpgsql.

On Oracle - the OUT variables are part of procedure signature - you can
write procedures P1(OUT a int), P1(OUT a text). Currently we have not a
variables in SQL environment. So if Peter implemented OUT variables now then

a) only IN parameters will be part of signature - like functions - but it
is different than on Oracle, and we lost a possibility to use interesting
feature
b) the procedures with OUT variables will not be callable from SQL
environment - that be messy for users.
c) disallow it.

I hope so PostgreSQL 12 will have schema variables, and then we can
implement OUT variables. Now, it is not possible (do it most correct) due
missing some other feature. INOUT parameters are good enough, and we have
opened door for future correct design.

Regards

Pavel

>
> psql (11.0 (Homebrew petere/postgresql))
> dev=# CREATE PROCEDURE test_sp(a OUT int) LANGUAGE plpgsql AS $$
> dev$# BEGIN
> dev$# a = 5;
> dev$# END; $$;
> ERROR: procedures cannot have OUT arguments
> HINT: INOUT arguments are permitted.
>
> Thanks,
> Anton
>

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Vijaykumar Jain 2018-12-15 20:13:56 simple query on why a merge join plan got selected
Previous Message Rob Sargent 2018-12-14 21:04:28 Re: loading jdbc Driver in servlet