Re: [HACKERS] safer node casting

Поиск
Список
Период
Сортировка
От Peter Eisentraut
Тема Re: [HACKERS] safer node casting
Дата
Msg-id c9086459-11f4-e2ee-2a41-4d94b62fd3e4@2ndquadrant.com
обсуждение исходный текст
Ответ на Re: [HACKERS] safer node casting  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
On 2/24/17 10:54, Tom Lane wrote:
> Andres Freund <andres@anarazel.de> writes:
>> Those aren't actually equivalent, because of the !nodeptr. IsA() crashes
>> for NULL pointers, but the new code won't. Which means 9ba8a9ce4548b et
>> al actually weakened some asserts.
> 
>> Should we perhaps have one NULL accepting version (castNodeNull?) and
>> one that separately asserts that ptr != NULL?
> 
> -1 ... if you're going to use something in a way that requires it not to
>  be null, your code will crash quite efficiently on a null, with or
>  without an assert.  I don't think we need the extra cogitive burden of
>  two distinct macros for this.

I think we should just add some Assert(thepointer) where necessary.

-- 
Peter Eisentraut              http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Robert Haas
Дата:
Сообщение: Re: [HACKERS] Patch: Write Amplification Reduction Method (WARM)
Следующее
От: Tom Lane
Дата:
Сообщение: Re: [HACKERS] Make subquery alias optional in FROM clause