Re: GetLastInsertID ?

Поиск
Список
Период
Сортировка
От Mike Nolan
Тема Re: GetLastInsertID ?
Дата
Msg-id 200401042215.i04MF0Xo000964@gw.tssi.com
обсуждение исходный текст
Ответ на Re: GetLastInsertID ?  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: GetLastInsertID ?  (Doug McNaught <doug@mcnaught.org>)
Список pgsql-general
> If you are using persistent connections in PHP you have to be very
> careful, because independent bits of PHP script may re-use the same
> database connection, and thereby will see a common currval value.
> After doing a nextval, you have to be sure to fetch currval before
> releasing the connection back to the pool.

I don't think I was using persistent connections at the time, as I have
security concerns about them.

It sound to me like there's the potential for a second web program sharing
the persistent connection to do something in between the nextval and
the currval.

Is currval for each process maintained at the front end (e.g., the PHP or
psql connection) or at the back end?  If the latter, isn't there always
the potential for memory overflows or other high-demand situations causing
the pairing of nextval/currval to get corrupted or lost, in which case
RELYING upon it for the last key value could be a source of problems.
--
Mike Nolan

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

Предыдущее
От: Paul Ganainm
Дата:
Сообщение: Re: Is my MySQL Gaining ?
Следующее
От: Doug McNaught
Дата:
Сообщение: Re: GetLastInsertID ?