| От | Scott Marlowe |
|---|---|
| Тема | Re: guaranteeing that a sequence never skips |
| Дата | |
| Msg-id | 1096824098.32732.16.camel@localhost.localdomain обсуждение исходный текст |
| Ответ на | guaranteeing that a sequence never skips (David Garamond <lists@zara.6.isreserved.com>) |
| Ответы |
Re: guaranteeing that a sequence never skips
|
| Список | pgsql-general |
On Sun, 2004-10-03 at 08:58, David Garamond wrote: > Am I correct to assume that SERIAL does not guarantee that a sequence > won't skip (e.g. one successful INSERT gets 32 and the next might be 34)? > > Sometimes a business requirement is that a serial sequence never skips, > e.g. when generating invoice/ticket/formal letter numbers. Would an > INSERT INTO t (id, ...) VALUES (SELECT MAX(col)+1 FROM t, ...) suffice, > or must I install a trigger too to do additional checking? You will have to lock the whole table and your parallel performance will be poor.
В списке pgsql-general по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера