Re: unsafe use of hash_search(... HASH_ENTER ...) - Mailing list pgsql-hackers

From Tom Lane
Subject Re: unsafe use of hash_search(... HASH_ENTER ...)
Date
Msg-id 877.1117340722@sss.pgh.pa.us
Whole thread Raw
In response to unsafe use of hash_search(... HASH_ENTER ...)  ("Qingqing Zhou" <zhouqq@cs.toronto.edu>)
List pgsql-hackers
"Qingqing Zhou" <zhouqq@cs.toronto.edu> writes:
> In general, code snippet like this:

> if (hash_search(..., HASH_ENTER, ...) == NULL)
>     action_except_elog__ERROR__;

> are considered unsafe if: (1) the allocation method of the target hash table
> could elog(ERROR) themselves and (2) the reaction to the failure of
> hash_search() is not elog(ERROR).

I've made some changes to hopefully prevent this type of thinko again.
Thanks for spotting it.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Escape handling in COPY, strings, psql
Next
From: Oleg Bartunov
Date:
Subject: Re: Bloom Filter indexes?