On 20-2-2007 8:07 Tom Lane wrote:
> It's surely incorrect as a means of getting out of a COPY state. To
> tell the truth, if their intention is to close the connection
> unceremoniously, they should just do that, ie PQfinish or just quit
> the application. So I'd suggest removing that loop.
I think its meant as a generic way of closing the connection. I.e. not
only to close the connection as a last-resort "clean things up before we
return to the webserver/console, but also half-way if the client asks
for it (as the code behind 'pg_close').
I.e. you don't want memory-leaks to build up because someone, for some
reason, needs something like this and the internal code doesn't clean up
something that easily could've been cleaned up:
$c = pg_connect("..");
Although obviously, that kind of code is not so common and should only
be used if there is a very good reason not to open/close the connection
outside the loop. Besides that, its very common in php to just leave the
garbage to the php-engine, probably even worse than in Java.
I guess, that if they really wanted to keep something like this
while-loop, they need to request the result-status and if its not the
result of a finished query (either failed, ok, empty, etc) they should
send a cancel request?
Anyway, I'll add your advice to that bug-report.
In response to
pgsql-bugs by date
|Next:||From: Michael Meskes||Date: 2007-02-20 13:09:32|
|Subject: Re: BUG #2973: Compile Error with MIPSpro compiler|
|Previous:||From: Tom Lane||Date: 2007-02-20 07:07:52|
|Subject: Re: BUG #3031: PHP (and others?) cannot close a connection when "in" a COPY-statement |