Skip site navigation (1) Skip section navigation (2)

Re: fix a bogus line in dynahash.c

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Qingqing Zhou" <zhouqq(at)cs(dot)toronto(dot)edu>
Cc: pgsql-patches(at)postgresql(dot)org
Subject: Re: fix a bogus line in dynahash.c
Date: 2005-05-25 02:59:15
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-patches
"Qingqing Zhou" <zhouqq(at)cs(dot)toronto(dot)edu> writes:
> Change elog(ERROR) to Assert(false) for two reasons:

No.  Remember that in most installations Assert() is a no-op.

> (2) even if it could happen, elog(ERROR) won't save us since in many places
> we have to check the return code of hash_search() and decide the error
> level.

You do know that elog(ERROR) doesn't return control to the caller?

> On a separate matter, can anyone please explain me how this piece of code
> works:

>     /* no free elements.  allocate another chunk of buckets */
>     if (!element_alloc(hashp, HASHELEMENT_ALLOC_INCR))
>      return NULL; /* out of memory */

That test is a no-op in the case where hashp->alloc in fact points to
palloc.  But it doesn't always point there --- see shmem_alloc.

			regards, tom lane

In response to


pgsql-patches by date

Next:From: Qingqing ZhouDate: 2005-05-25 03:06:19
Subject: Re: fix a bogus line in dynahash.c
Previous:From: Neil ConwayDate: 2005-05-25 02:50:09
Subject: Re: fix a bogus line in dynahash.c

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group