Re: PLPGSQL: Using Transactions and locks - Mailing list pgsql-general

From Gregory Wood
Subject Re: PLPGSQL: Using Transactions and locks
Date
Msg-id 00dd01c0f40f$6417ebf0$7889ffcc@comstock.com
Whole thread Raw
In response to PLPGSQL: Using Transactions and locks  (Allan Kamau <hugebirdwings@yahoo.com>)
List pgsql-general
> How do I write transaction statements like 'BEGIN
> WORK'... in PLPGSQL.

You can't... the function is already running within a transaction (implicit
or explicit) and PostgreSQL doesn't have any nested transactions, therefore
you can't start a transaction from within a function.

> Also how do I write lock statements in the same.

I'm not sure what you're trying to do, but I think SELECT ... FOR UPDATE
would work in this context.

Greg


pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: [Help] AGGREGATE problem w/v7.0
Next
From: Tom Lane
Date:
Subject: Re: Re: Does PostgreSQL support EXISTS?