| От | Bruno Wolff III |
|---|---|
| Тема | Re: Return serial from insert |
| Дата | |
| Msg-id | 20021115172223.GA3260@wolff.to обсуждение исходный текст |
| Ответ на | Re: Return serial from insert (Rory Campbell-Lange <mail@campbell-lange.net>) |
| Список | pgsql-novice |
On Fri, Nov 08, 2002 at 16:02:07 +0000, Rory Campbell-Lange <mail@campbell-lange.net> wrote: > The problem is that I need to use the id for naming an image file. > Consequently I need the id from the insert. You will note (from my > original messgage) that I'm already using a SERIAL type field for the id > column. Then you can select currval of the associated sequence. currval returns the last value of the sequence assigned by this backend. So as long as it is the same connection that did the insert and nothing else using this connection has modified the sequence since the insert, this will work.
В списке pgsql-novice по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера