Re: Lock ACCESS EXCLUSIVE and Select question ! - Mailing list pgsql-general

From Bosco Rama
Subject Re: Lock ACCESS EXCLUSIVE and Select question !
Date
Msg-id 4D6C2531.3000102@boscorama.com
Whole thread Raw
In response to Re: Lock ACCESS EXCLUSIVE and Select question !  (Alan Acosta <zagato.gekko@gmail.com>)
List pgsql-general
Alan Acosta wrote:
> But i have a new problem there, i have no rows for update, i create new rows
> when the seats are sold, cause rarely the database knows the capacity of the
> bus, number of seats, even some bus doesn't have seat number 4 for example
> :p. So i cannot SELECT FOR UPDATE no existent rows, but i still need to lock
> in some way in order to check if seat number X was already sold or is free !

Sounds like you need a uniqueness constraint of some sort to detect when the
seat has been sold already when you try the insert.

Bosco.

pgsql-general by date:

Previous
From: Alan Acosta
Date:
Subject: Re: Lock ACCESS EXCLUSIVE and Select question !
Next
From: Alban Hertroys
Date:
Subject: Re: Transactions and ID's generated by triggers