| От | Tom Lane |
|---|---|
| Тема | Re: nextval/dbi question |
| Дата | |
| Msg-id | 7165.997052971@sss.pgh.pa.us обсуждение |
| Ответ на | Re: nextval/dbi question (harrold@sage.che.pitt.edu) |
| Ответы |
Re: nextval/dbi question
|
| Список | pgsql-novice |
harrold@sage.che.pitt.edu writes:
> i want to insert data into a table that has a serialized key. then i want
> the value of the key for the row i just inserted. from the stuff i read
> on the net i though i was supposed to run the nextval command first then
> preform the insert.
That is about the simplest and most obvious way to do it, IMHO. What
you're missing is that you have to explicitly insert the value you got
from nextval() into the key column. If you allow the key column to be
defaulted in the INSERT, then nextval() gets run again.
regards, tom lane
В списке pgsql-novice по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера