Search Postgresql Archives

Re: SPI_ERROR_TRANSACTION [PostgreSQL 8.3]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Daroslav wrote:
> 
> Hi
> 
> As a newbie in PL/pgSQL I have faced an error SPI_ERROR_TRANSACTION which
> was raised always when I have tried to launch following function with
> uncommented keywords SAVEPOINT, SET TRANSACTION and COMMIT(when commented,
> function works fine): 

Yes, you cannot use those constructs in plpgsql (or any other PL for
that matter; it's a limitation of the underlying layer).  You need to
use BEGIN/EXCEPTION/END blocks instead.

Also, keep in mind that if you RAISE EXCEPTION, the current transaction
is always rolled back, so the RETURN FALSE in your function would never be
reached.

-- 
Alvaro Herrera                                http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.

-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux