pg.ddx.io  pgsql-docs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Bruce Momjian <bruce@momjian.us>
To: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
Cc: Pavel Stehule <pavel.stehule@gmail.com>
Cc: David G. Johnston <david.g.johnston@gmail.com>
Cc: Robin Abbi <robin.abbi@downley.net>
Cc: Dave Cramer <davecramer@postgres.rocks>
Cc: Pg Docs <pgsql-docs@lists.postgresql.org>
Subject: Re: Procedures
Date: Tue, 25 Aug 2020 15:03:13 -0400
Message-ID: <20200825190313.GE26852@momjian.us> (raw)
In-Reply-To: <bdf3066b-8779-b76e-ea49-5866dbf6cbcb@2ndquadrant.com>
References: <CAKFQuwaEnUAaF=rPhsLymWDsGg71CXAswVRNnhxV+h=3q+3pDg@mail.gmail.com>
	<20200822171447.GF26781@momjian.us>
	<CAKFQuwbbfW01BGT=X6buQySXMr08P98yhG-cja22_rPfravE2g@mail.gmail.com>
	<20200824150056.GI26781@momjian.us>
	<CAFj8pRAMRsC8r0bBsqRz_hiVH+TxOrTa0_0F+c5qBwbNis7=uQ@mail.gmail.com>
	<20200824153557.GK26781@momjian.us>
	<20200824153847.GL26781@momjian.us>
	<CAFj8pRCZOa6739u88_vMV5uqB2kWFST3DCU0Y6wPx1b9DFfbUg@mail.gmail.com>
	<20200824160023.GM26781@momjian.us>
	<bdf3066b-8779-b76e-ea49-5866dbf6cbcb@2ndquadrant.com>

On Tue, Aug 25, 2020 at 08:38:11PM +0200, Peter Eisentraut wrote:
> On 2020-08-24 18:00, Bruce Momjian wrote:
> > -    command, a procedure is called explicitly using
> > -    the <xref linkend="sql-call"/> statement.
> > +    command, a procedure is called in isolation using
> > +    the <xref linkend="sql-call"/> command.  If the CALL command is not
> > +    part of an explicit transaction, a procedure can commit, rollback,
> > +    and begin new transactions during its execution, which is not possible
> > +    in functions.
> 
> There are additional conditions for when a procedure can do transaction
> control, and it also depends on the language.  It's not clear how much
> detail we should give in a general section like this.  Often people read
> this and then wonder why it doesn't work.

I have updated the patch to mention it is dependend on the server-side
language.

-- 
  Bruce Momjian  <bruce@momjian.us>        https://momjian.us
  EnterpriseDB                             https://enterprisedb.com

  The usefulness of a cup is in its emptiness, Bruce Lee

Attachments:

proc.diff (text/x-diff, 853B) download diff --git a/doc/src/sgml/xfunc.sgml b/doc/src/sgml/xfunc.sgml index 6de464c654..732d935521 100644 --- a/doc/src/sgml/xfunc.sgml +++ b/doc/src/sgml/xfunc.sgml @@ -84,8 +84,11 @@ A procedure is a database object similar to a function. The difference is that a procedure does not return a value, so there is no return type declaration. While a function is called as part of a query or DML - command, a procedure is called explicitly using - the <xref linkend="sql-call"/> statement. + command, a procedure is called in isolation using + the <xref linkend="sql-call"/> command. If the CALL command is not + part of an explicit transaction, a procedure in many server-side + languages can commit, rollback, and begin new transactions during + its execution, which is not possible in functions. </para> <para>

view thread (24+ messages)  latest in thread

Message-ID: <20200825190313.GE26852@momjian.us>
Permalink:  ../20200825190313.GE26852@momjian.us/
Also on:    postgresql.org/message-id/20200825190313.GE26852@momjian.us

 ·  · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-docs@postgresql.org
  Cc: bruce@momjian.us, peter.eisentraut@2ndquadrant.com, pavel.stehule@gmail.com, david.g.johnston@gmail.com, robin.abbi@downley.net, davecramer@postgres.rocks, pgsql-docs@lists.postgresql.org
  Subject: Re: Procedures
  In-Reply-To: <20200825190313.GE26852@momjian.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox