Thread: BUG #2791: Error while commiting

BUG #2791: Error while commiting

From
"Raman Dabhade"
Date:
The following bug has been logged online:

Bug reference:      2791
Logged by:          Raman Dabhade
Email address:      raman.dabhade@coalitiondev.com
PostgreSQL version: 8.1
Operating system:   Win XP
Description:        Error while commiting
Details:

ERROR:  SPI_execute_plan failed executing query "commit":
SPI_ERROR_TRANSACTION
CONTEXT:  PL/pgSQL function "processrecords" line 4 at SQL statement

When executing following procedure:

CREATE OR REPLACE FUNCTION processRecords()
  RETURNS int8 AS
$BODY$
declare
begin

   commit ;

return 0;
end;
$BODY$
  LANGUAGE 'plpgsql' VOLATILE;

Re: BUG #2791: Error while commiting

From
Michael Fuhr
Date:
On Tue, Nov 28, 2006 at 02:13:15PM +0000, Raman Dabhade wrote:
> ERROR:  SPI_execute_plan failed executing query "commit":
> SPI_ERROR_TRANSACTION
> CONTEXT:  PL/pgSQL function "processrecords" line 4 at SQL statement

http://www.postgresql.org/docs/8.1/interactive/plpgsql-structure.html

"Functions and trigger procedures are always executed within a
transaction established by an outer query -- they cannot start or
commit that transaction, since there would be no context for them
to execute in."

--
Michael Fuhr