From: Thomas Rokohl <rokohl@raygina.de>
To: pgsql-odbc@postgresql.org
Subject: Re: lock - feedback
Date: Wed, 12 Oct 2005 14:51:48 +0000
Message-ID: <434D2304.3090501@raygina.de> (raw)
In-Reply-To: <6EE64EF3AB31D5448D0007DD34EEB3417DD591@Herge.rcsinc.local>
References: <6EE64EF3AB31D5448D0007DD34EEB3417DD591@Herge.rcsinc.local>
Merlin Moncure wrote:
> select user_write_lock(oid) from my_table where value = x;
> returns 1 on success, 0 on failure.
>
> just be careful...
> select user_write_lock(oid) from my_table where value = x order by y
> limit 1;
> can acquire more locks than you might think since the table has to be
> materialized to do the order.
>
> better to write:
>
> select user_write_lock(oid) from
> (
> select oid, * from my_table where value = x order by y limit 1;
> )
>
> also, don't use oid :). In my applications, I make a domain type called
> 'cuid' which pulls nextval() from a public sequence. Put that into your
> tables and lock on it. Just watch for dump/restore.
>
> Merlin
>
>
>
ok i understand, thanks. that work's.
but i'm a little bit confused. this problem is, from my point of view, a
highly frequently appearing problem.
on all places where it can be that two users edit the same record, the
"lost update" problem or the "waiting" problem ;-) can be appeared.
and this is not rare i think.
your solution is good and works surely
<http://dict.leo.org/se?lp=ende&p=lURE.&search=surely; fine( i will test
it ), but it is also unhandy.
my opinion is that this problem should be solved by the database and not
by the user, so i think it is a good point for a wish list ;-).
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-odbc@postgresql.org
Cc: rokohl@raygina.de
Subject: Re: lock - feedback
In-Reply-To: <434D2304.3090501@raygina.de>
References: <6EE64EF3AB31D5448D0007DD34EEB3417DD591@Herge.rcsinc.local> <434D2304.3090501@raygina.de>
* 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