Re: [SQL] Savepoints and SELECT FOR UPDATE in 8.2

"Scott Marlowe" <[email protected]>
Newsgroups gmane.comp.db.postgresql.general,gmane.comp.db.postgresql.interfaces,gmane.comp.db.postgresql.sql
Message-ID <[email protected]>
On Fri, Aug 1, 2008 at 11:02 AM, EXT-Rothermel, Peter M
<[email protected]> wrote:
>
> I was thinking of something like this:
>
> connect to DB
>
> BEGIN
>
> SELECT * FROM table_foo where foo_state = 'queued'  FOR UPDATE;
> for each row
> do [
>
>    SAVEPOINT s;
>    UPDATE foo_resource SET in_use = 1 WHERE ...;
>
>    status = application_logic_code(foo_column1, foo_column2);
>
>    IF status OK
>    THEN
>          ROLLBACK TO SAVEPOINT s;
>    ELSE
>          RELEASE SAVEPOINT s;
>    ENDIF
> ]
>
>
> COMMIT;
>
> I found a caution in the documentation that says that SELECT FOR UPDATE
> and SAVEPOINTS is not implemented correctly in version 8.2:
>
> http://www.postgresql.org/docs/8.2/interactive/sql-select.html#SQL-FOR-U
> PDATE-SHARE
>
> Any suggestions?

Why not plain rollback?

-- 
Sent via pgsql-general mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.