Re: Last Id?

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Last Id?
Дата
Msg-id 17684.1126017198@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Last Id?  (<me@alternize.com>)
Список pgsql-novice
<me@alternize.com> writes:
> unfortunately as i had to find out some days ago, "session-local" is a bit
> dependend on how (and when) you actually open up new db connections to the
> db, especially when you maybe have connection pooling enabled.

If your connection pooler will flip the connection out from under you
within a transaction, you need another connection pooler.  If you are
doing the insert and then reading currval in separate transactions,
I'd suggest changing the logic to make it one transaction.  Whatever
you are going to do with the currval probably ought to be part of the
original inserting transaction anyway.

The nextval-then-insert approach is perfectly fine too of course,
but there's no reason you shouldn't be able to use currval.

            regards, tom lane

В списке pgsql-novice по дате отправления:

Предыдущее
От: Michael Fuhr
Дата:
Сообщение: Re: Inserting data in other db
Следующее
От: Mike G
Дата:
Сообщение: Re: howto to do an automated backup on windows xp?