Re: Procedures

From: Robin Abbi <robin(dot)abbi(at)downley(dot)net>
To: Dave Cramer <davecramer(at)postgres(dot)rocks>
Cc: Bruce Momjian <bruce(at)momjian(dot)us>, pgsql-docs(at)lists(dot)postgresql(dot)org
Subject: Re: Procedures
Date: 2020-08-06 13:30:55
Message-ID: CAGmg_NX327KKVuJmbWZD=pGutYFxzZjX1rU+3ji8UuX=8ONn9Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-docs

PostgreSQL went as far as release 10 without procedures.
Some third party resources written before 11 loosely conflate procedures
with functions.
Some third party resources written before 11 accurately state PostgreSQL
has functions but not procedures.
Referring to the PostgreSQL docs for 11 on, procedures have been added.

For someone like me, coming to the subject without much of a hinterland
other than googling around, it seemed clear that there was a motivating
case that caused Procedures to be added to PostgreSQL, but I was not
sufficiently familiar with the domain to be able to readily intuit what it
might have been.

For example, Procedures say they have no return value, yet Functions can
return void. Not the same I agree, but I wouldn't be aware in which
circumstances it mattered.

For me, perhaps the most useful thing would have been a small example
highlighting the essential thing(s) that procedures can do that functions
could not.

Robin

On Thu, 6 Aug 2020 at 11:32, Dave Cramer <davecramer(at)postgres(dot)rocks> wrote:

>
>
> On Wed, 5 Aug 2020 at 20:18, Bruce Momjian <bruce(at)momjian(dot)us> wrote:
>
>> On Tue, Aug 4, 2020 at 10:33:49AM +0000, PG Doc comments form wrote:
>> > The following documentation comment has been logged on the website:
>> >
>> > Page: https://www.postgresql.org/docs/11/sql-createprocedure.html
>> > Description:
>> >
>> > The information on procedures could helpfully include that the feature
>> is
>> > new from PostgreSQL 11 and give an explanation of how it differs from
>> > functions. I found the information I needed here
>> > https://dba.stackexchange.com/a/262662, but I think it would really
>> benefit
>> > others if the information was provided in the official documentation.
>>
>> We don't normally mention what release added a features. However, I do
>> see your problem with finding that procedures can issue transaction
>> control statements. I see this for procedures:
>>
>> https://www.postgresql.org/docs/12/xproc.html
>>
>> but that has no mention of transactions, just a mention of using CALL,
>> then this pl/pgSQL section about transaction control mentions CALL:
>>
>> https://www.postgresql.org/docs/12/plpgsql-transactions.html
>>
>> Is this what you think needs improving?
>>
>> Neither of those places mention that procedures cannot be called inside a
> transaction.
> So ya I think there there is some room for improvement
>
> Dave Cramer
> www.postgres.rocks
>

In response to

Responses

Browse pgsql-docs by date

  From Date Subject
Next Message Bruce Momjian 2020-08-06 22:10:52 Re: Procedures
Previous Message Dave Cramer 2020-08-06 10:32:13 Re: Procedures