Re: Re: Getting last record ID created from DB
| From: | Richard Lynch | Date: | Wed, 21 Mar 2007 06:42:34 +0000 |
| Subject: | Re: Re: Getting last record ID created from DB | ||
| References: | 1 2 3 4 5 6 7 8 9 10 11 12 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-250978@lists.php.net to get a copy of this message | ||
On Mon, March 19, 2007 10:58 pm, markw@mohawksoft.com wrote:
>> markw@mohawksoft.com wrote:
>>>> markw@mohawksoft.com wrote:
>>>>>> On Sat, 2007-03-17 at 12:19 -0400, Mark wrote:
>> Check the documentation - currval returns the last one *for that
>> session* - it does not return the last global change.
>>
>>
>> http://www.postgresql.org/docs/current/static/functions-sequence.html
>>
>> It is perfectly safe to use this.
>
> In theory that may be true, but can the application developer make any
> assumption about the underlying architecture? Might you be familiar
> with
> connection pooling? Where multiple threads or processes share a
> database
> connection or "session?"
If the pool breaks the documentation about current session, the pool
is broken.
Fix it.
:-)
I don't think the "pool" will give you somebody else's ID, for the
record. It's smart enough to not do that, I *believe*, mostly on
faith.
--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?