From: Scott Marlowe <scott.marlowe@gmail.com>
To: EXT-Rothermel, Peter M <Peter.M.Rothermel@boeing.com>
Cc: pgsql-interfaces@postgresql.org
Cc: pgsql-general@postgresql.org
Cc: pgsql-sql@postgresql.org
Subject: Re: [SQL] Savepoints and SELECT FOR UPDATE in 8.2
Date: Fri, 1 Aug 2008 19:07:08 -0600
Message-ID: <dcc563d10808011807l3100f873vc2e1806ddea4c642@mail.gmail.com> (raw)
In-Reply-To: <8D9E4E8445BD14478121CC9B027B518AB57AA0@XCH-NW-11V2.nw.nos.boeing.com>
References: <8D9E4E8445BD14478121CC9B027B518AB57AA0@XCH-NW-11V2.nw.nos.boeing.com>
On Fri, Aug 1, 2008 at 11:02 AM, EXT-Rothermel, Peter M
<Peter.M.Rothermel@boeing.com> 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?
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-interfaces@postgresql.org
Cc: scott.marlowe@gmail.com, Peter.M.Rothermel@boeing.com, pgsql-general@postgresql.org, pgsql-sql@postgresql.org
Subject: Re: [SQL] Savepoints and SELECT FOR UPDATE in 8.2
In-Reply-To: <dcc563d10808011807l3100f873vc2e1806ddea4c642@mail.gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox