Re: lock table question
От | Andy Kriger |
---|---|
Тема | Re: lock table question |
Дата | |
Msg-id | OJEFIHHAALOBKKJEOMBDGEMPCNAA.akriger@greaterthanone.com обсуждение исходный текст |
Ответ на | Re: lock table question (Doug McNaught <doug@mcnaught.org>) |
Ответы |
Re: lock table question
Re: lock table question Re: lock table question |
Список | pgsql-general |
It doesn't lock the row from being read. I want to make sure the row cannot be read until I have done my read and updated if necessary. LOCK TABLE does that but also prevents other rows from being read which is a bit overzealous for my taste (the app is small so it's probably not a big deal in this case, but I can see in future possibilities how it would be). -----Original Message----- From: pgsql-general-owner@postgresql.org [mailto:pgsql-general-owner@postgresql.org]On Behalf Of Doug McNaught Sent: Monday, December 30, 2002 15:18 To: Andy Kriger Cc: Pgsql-General Subject: Re: [GENERAL] lock table question "Andy Kriger" <akriger@greaterthanone.com> writes: > I have an inventory table. I need to be able to lock a row from being > read/written while I: check the quantity value; modify it if necessary. From > my experiments, it appears I can only do this with LOCK TABLE. Since this > locks the whole table and not just the individual row, I'm guessing this > would create quite a bottleneck if our application were larger. I'm also > guessing that there's a better way to approach this probably common need. Does SELECT ... FOR UPDATE not do what you want? -Doug ---------------------------(end of broadcast)--------------------------- TIP 2: you can get off all lists at once with the unregister command (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)
В списке pgsql-general по дате отправления: