Re: BUG #3031: PHP (and others?) cannot close a connection when "in" a COPY-statement
| От | Arjen van der Meijden |
|---|---|
| Тема | Re: BUG #3031: PHP (and others?) cannot close a connection when "in" a COPY-statement |
| Дата | |
| Msg-id | 45DAA175.2040705@tweakers.net обсуждение исходный текст |
| Ответ на | Re: BUG #3031: PHP (and others?) cannot close a connection when "in" a COPY-statement (Tom Lane <tgl@sss.pgh.pa.us>) |
| Список | pgsql-bugs |
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:
while($something)
{
$c = pg_connect("..");
// Queries
pg_close($c);
}
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.
Best regards,
Arjen
В списке pgsql-bugs по дате отправления: