| От | Bruno Wolff III |
|---|---|
| Тема | Re: Using sequence name depending on other column |
| Дата | |
| Msg-id | 20050313035958.GA28240@wolff.to обсуждение исходный текст |
| Ответ на | Using sequence name depending on other column ("Andrus Moor" <eetasoft@online.ee>) |
| Ответы |
Re: Using sequence name depending on other column
|
| Список | pgsql-general |
On Sat, Mar 12, 2005 at 23:05:41 +0200, Andrus Moor <eetasoft@online.ee> wrote: > I have table containing different types of documents (type A, B and C). > > Each document type must have separate sequential ID starting at 1 > > ID of first inserted record of type A must be set to 1 > ID of first inserted record of type B must be also set to 1 > ID of second record of type A must be set to 2 > etc. Sequences aren't designed for doing this. If you aren't doing lots of updates, just lock the table and assign the next id as the current max id of that type + 1.
В списке pgsql-general по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера