| От | Ben |
|---|---|
| Тема | Basic locking question |
| Дата | |
| Msg-id | 431E0787.7070907@silentmedia.com обсуждение исходный текст |
| Ответы |
Re: Basic locking question
|
| Список | pgsql-general |
I'm not very familiar with explicitly locking things in SQL, so this may be a dumb question, but..... I've got a stored proc that takes a text key and returns an ID. If the key isn't in a lookup table, it adds it and will return the auto-generated serial number. If it's already there, it simply returns the existing serial number. I'm concerned about multiple sessions calling this at the same time with the same key. While I *could* just put in a unique constraint and let things fail, that's hardly graceful. It seems I should be able to lock the lookup table, but I don't really know what mode to lock that table in. Will ROW EXCLUSIVE keep the same key from being entered twice?
В списке pgsql-general по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера