| От | Steve Wolfe |
|---|---|
| Тема | Re: [GENERAL] Simple problem? |
| Дата | |
| Msg-id | 002301bf852c$aa48dba0$85755ad1@iboats.com обсуждение исходный текст |
| Ответ на | Simple problem? (Stan Jacobs <jacobs@jtek.com>) |
| Список | pgsql-general |
> You can do a SELECT curval('sequence_name'); to get the value you were
just
> assigned without worrying about other people updating, as curval gets the
> current value within the current transaction (or within the current
> session, either way, it works.)
Or, my prefered method, create the table like so..
create table MyTable
(
MyField int4 default nextval('SomeSequence'),
...
);
That gives you the flexibility to select the nextval of the sequence and
insert it yourself (if you need it for further processing), or to simply
let the database take care of it for itself.
steve
В списке pgsql-general по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера