| От | Jeffrey Melloy |
|---|---|
| Тема | Re: Auto Increment Questions |
| Дата | |
| Msg-id | 42B1C469.3050405@visualdistortion.org обсуждение исходный текст |
| Ответ на | Auto Increment Questions ("Michael Avila" <mavila@mich.com>) |
| Список | pgsql-novice |
Michael Avila wrote: >In Postgres I see that it is not so automatic and is not truly >serial/sequential. Reviewing my objectives, I don't think not being truly >serial/sequential will be a problem. > Are you saying that since serial isn't guaranteed to be 1,2,3,4,5 without gaps there will be a problem? You can't just do something like "select max(val) + 1 from table" to get the next serial value. You need to do "select nextval(sequence)" and then use "currval(sequence)" to get the current value. If you don't care what the inserted value is, just use the DEFAULT keyword in your inserts. More information can be found in the manual. Jeff
В списке pgsql-novice по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера