Hi,

I have a stored procedure and I need a SHARE ROW EXCLUSIVE lock in this procedure (otherwise data will get corrupted).

According to the documentation the LOCK statement is useless and will silently fail if not executed inside a transaction. (btw: this sounds dangerous to me)

Also it is not possible to start a transaction inside a stored procedure.

How can I make the code of this stored procedure safe?

is there a way to let the procedure fail with an error if not executed within a transaction.

does adding a SAVEPOINT the trick?
documentation says that savepoints can only be established inside transactions, but does it fail fatal enough so that the procedure getss aborted? (more fatal than LOCK does?)


thank you very much.
/sebastian


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

Reply via email to