Skip site navigation (1) Skip section navigation (2)

Re: Lock ACCESS EXCLUSIVE and Select question !

From: Bosco Rama <postgres(at)boscorama(dot)com>
To: Alan Acosta <zagato(dot)gekko(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Lock ACCESS EXCLUSIVE and Select question !
Date: 2011-02-28 22:44:01
Message-ID: 4D6C2531.3000102@boscorama.com (view raw or flat)
Thread:
Lists: 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.

In response to

pgsql-general by date

Next:From: Alban HertroysDate: 2011-02-28 22:44:10
Subject: Re: Transactions and ID's generated by triggers
Previous:From: Alan AcostaDate: 2011-02-28 22:39:07
Subject: Re: Lock ACCESS EXCLUSIVE and Select question !

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group