Re: [PATCHES] hash_create(): check return code

2004-10-24 Thread Neil Conway
Tom Lane wrote: With all due respect to Jan, that coding seems 100% bogus. elog(ERROR) will work (it had better, because pgstat.c certainly calls routines that might do it) and the insistence on using exit() rather than proc_exit() is just plain wrong anyway. Attached is a patch that makes the

Re: [PATCHES] hash_create(): check return code

2004-10-24 Thread Tom Lane
Neil Conway [EMAIL PROTECTED] writes: There was one case in pgstat.c where I had to wrap the hash_create() call in a PG_TRY() block to ensure a file handle is closed (this code might be invoked by a regular backend it appears, so elog(ERROR) won't necessarily close the file handle). A

Re: [PATCHES] hash_create(): check return code

2004-10-24 Thread Neil Conway
On Mon, 2004-10-25 at 00:25, Tom Lane wrote: A better solution is to use AllocateFile/FreeFile; I'm not 100% certain that that works in the pgstat context, but I think it should. I applied the patch I posted earlier to HEAD (post beta4). I'll look at doing this separately. -Neil

Re: [PATCHES] hash_create(): check return code

2004-10-22 Thread Tom Lane
Neil Conway [EMAIL PROTECTED] writes: I'm not really sure whether this is the correct fix, but it certainly seems wrong to be doing the check in some places and not in others. Another approach would be to elog(ERROR) when an error occurs in hash_create(), which would be fine except there might

Re: [PATCHES] hash_create(): check return code

2004-10-22 Thread Neil Conway
On Fri, 2004-10-22 at 16:13, Tom Lane wrote: There are no places where hash_create is called before elog() is functional. Well, it's invoked from the statistics collector, which avoids doing elog(ERROR) for some reason. But my guess is that it should be workable to get elog(ERROR) / elog(FATAL)

Re: [PATCHES] hash_create(): check return code

2004-10-22 Thread Tom Lane
Neil Conway [EMAIL PROTECTED] writes: On Fri, 2004-10-22 at 16:13, Tom Lane wrote: There are no places where hash_create is called before elog() is functional. Well, it's invoked from the statistics collector, which avoids doing elog(ERROR) for some reason. With all due respect to Jan, that

[PATCHES] hash_create(): check return code

2004-10-21 Thread Neil Conway
hash_create() can return a NULL pointer if an error occurs (principally, when we're out of memory). Some of the call sites checked for this condition, but some did not. This patch fixes the remaining call sites to check the return value, and ereport(ERROR) if it is NULL. I'm not really sure