Re: Table locks - Mailing list pgsql-novice

From Andreas Seltenreich
Subject Re: Table locks
Date
Msg-id 877jr377m4.fsf@gate450.dyndns.org
Whole thread Raw
In response to Table locks  (Jake Stride <nsuk@users.sourceforge.net>)
Responses Re: Table locks
List pgsql-novice
Jake Stride writes:

> I thought of doing:
>
> SELECT max(jobno) from jobs where companyid=1;
>
> Then use the result as the job number, is there a way I can lock the table
> to do this or a better way of achieving the required result.

I think SELECT FOR UPDATE should work fine here.

See: http://www.postgresql.org/docs/7.4/static/mvcc.html

HTH
Andreas

pgsql-novice by date:

Previous
From: Jake Stride
Date:
Subject: Re: Table locks
Next
From: Tom Lane
Date:
Subject: Re: Table locks