Re: Re: Getting last record ID created from DB

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> markw@xxxxxxxxxxxxxx wrote:
>>>
>>> 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 developers of the database say it's safe, then I'm happy to take
> their word on it. If you can prove otherwise, please do so and post a
> bug report to them.

This isn't abut the database, per se' but connection pooling between the
Apache/PHP process and the database. I can't tell you how many times I've
seen that burn people.


> In this case, tons of people are using connection
> pooling with postgres. If a problem had been discovered, then they would
> have complained and it would have been fixed.

I periodically participate on the PG hackers list, and if such a bug were
reported, it would be bounced to the connection pool interface guys or
ignored, because, it is essentially out of the control of the PostgreSQL
developers.

>
> Do I need to evaluate every section of code that a 3rd party provides to
> make sure the code does what the docs say it should? I'd never get
> anything done. At some point I just need to know how to use it and trust
> it works as it should. If it's a super critical application (eg
> financial information) where integrity is 100% required, then I'd test
> it. If I found a problem then I'd complain *shrug*.

You are confusing "PostgreSQL" with the connection pooling interface. I
have seen this issue a few times with PostgreSQL and Oracle.

>
> As Richard mentioned in another reply, the developers (whether it's
> mysql or postgres or "other") have taken a lot of pain to make sure
> these things work properly.

Again, it isn't about "PostgreSQL," because yes it does work if you go
directly to PG, but if you use an interface that uses connection pooling
to reduce resource usage, you are going to see problems.

>
> Why would I try and do exactly the same thing myself and most likely get
> it completely wrong?

Because doing a a good web site, that really works, takes thinking about
it, it takes understanding it, you can't be lazy and "trust" that someone
else has done something, and then forget all the possible layers between
you and it. That is *the* recipe for failure.

>
>
> The rest of your rant I agree with in theory, but making something
> "flexible" is extremely difficult unless you understand what you're
> trying to accomplish from the beginning - and know each system well
> enough to know how each one works and the differences between them. Not
> even "LIMIT" is standard across databases let alone anything else like
> data types ('int(11)' compared to 'int', 'datetime' compared to
> 'timestamp' etc etc etc) or even date formats that they store.
>
> Taking all of that into account from the very beginning is pretty tough.

My father used to say the most sexist thing to me, it is kind of offensive
if you are a woman, but I know what it was intended to mean. "If it were
easy, they'd have women do it."

If you going to do something, do it right, or else what's the point?
Sometimes it is harder, but that's why being a professional is different.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux