Обсуждение: please help

Поиск
Список
Период
Сортировка

please help

От
Loïc Bourgeois
Дата:
What is the equivalent of the oracle request: SELECT ... FOR UPDATE 
NOWAIT, under PostGreSQL


Thanks a lot



Re: please help

От
Peter Eisentraut
Дата:
Loïc Bourgeois writes:

> What is the equivalent of the oracle request: SELECT ... FOR UPDATE
> NOWAIT, under PostGreSQL

I don't know Oracle, but there doesn't seem to be such a command in
PostgreSQL.  If the table is already locked, the SELECT FOR UPDATE has to
wait.

-- 
Peter Eisentraut      peter_e@gmx.net       http://yi.org/peter-e/



Re: please help

От
Loïc Bourgeois
Дата:
Yes but the option NOWAIT say to the instruction SELECT ... FOR UPDATE to not wait the unlock but to return the
informationthe lines can't be lock.<br /> (Must retry late).<br /><br /><br /> Peter Eisentraut wrote:<br /><blockquote
cite="mid:Pine.LNX.4.30.0104052139300.1084-100000@peter.localdomain"type="cite"><pre wrap="">Loïc Bourgeois writes:<br
/><br/></pre><blockquote type="cite"><pre wrap="">What is the equivalent of the oracle request: SELECT ... FOR
UPDATE<br/>NOWAIT, under PostGreSQL<br /></pre></blockquote><pre wrap=""><br />I don't know Oracle, but there doesn't
seemto be such a command in<br />PostgreSQL.  If the table is already locked, the SELECT FOR UPDATE has to<br
/>wait.<br/><br /></pre></blockquote><br /> 

help

От
Loïc Bourgeois
Дата:
I read your document about the porting from Oracle to PgSql and I would 
like to know if
you can say to me if there is an equivalent on an the option NOWAIT for 
a request
SELECT ... FOR UPDATE (for Oracle) under PgSql.

This option don't wait a previus unlock and return the information like 
the line can't be lock.

Oracle:
SELECT * FROM toto WHERE id =4 and value = 'hello' FOR UPDATE NOWAIT;

PsSql:
????????????????????????


Tanks a lot....



Re: please help

От
Cedar Cox
Дата:
It would be somewhat (very) useful to have something like this.  We were
toying with the idea of making some sort of system to figure out if a
table is locked or not.  In the end we decided to go with executing this
asynchronously and after a given timeout ask the user if they would like
to wait or cancel the request.  Something like this may or may not work
for you..

-Cedar


On Fri, 6 Apr 2001, Loïc Bourgeois wrote:

> Yes but the option NOWAIT say to the instruction SELECT ... FOR UPDATE 
> to not wait the unlock but to return the information the lines can't be 
> lock.
> (Must retry late).
> 
> 
> Peter Eisentraut wrote:
> 
> > Loïc Bourgeois writes:
> > 
> >> What is the equivalent of the oracle request: SELECT ... FOR UPDATE
> >> NOWAIT, under PostGreSQL
> > 
> > 
> > I don't know Oracle, but there doesn't seem to be such a command in
> > PostgreSQL.  If the table is already locked, the SELECT FOR UPDATE has to
> > wait.
> > 
> 
> 



Re: please help

От
Peter Eisentraut
Дата:
Cedar Cox writes:

> It would be somewhat (very) useful to have something like this.  We were
> toying with the idea of making some sort of system to figure out if a
> table is locked or not.

This will probably introduce race conditions unless done very carefully.
In theory you need a second level of locks to protect the information you
obtained regarding the "real" locks.  I'm not saying it's impossible, but
20 years ago people were writing Ph.D. theses about these sort of things.

-- 
Peter Eisentraut      peter_e@gmx.net       http://yi.org/peter-e/