Re: to_char() dumps core
От | Tom Lane |
---|---|
Тема | Re: to_char() dumps core |
Дата | |
Msg-id | 2023.972176649@sss.pgh.pa.us обсуждение исходный текст |
Ответ на | to_char() dumps core (Tatsuo Ishii <t-ishii@sra.co.jp>) |
Список | pgsql-hackers |
Tatsuo Ishii <t-ishii@sra.co.jp> writes: > In 7.0.2 > select to_char(sum(n),'999') from t1; > causes backend dump a core if n is a float/numeric ...data type AND if > sum(n) returns NULL. This seems due to a bad null pointer handling for > aruguments of pass-by-reference data types. I think just a simple > null pointer checking at very top of each function (for example > float4_to_char()) would solve the problem. Comments? Just a note to remind everyone, since I haven't yet updated the documentation for the new-fmgr changes: under the 7.1 fmgr it is *no longer necessary* to check for NULL pointer in function execution routines, assuming that your function is marked "strict" in pg_proc (as nearly all built-in functions are). The fmgr will not call such a function in the first place, if any of its inputs are NULLs. So, while adding the NULL-pointer checks is an OK patch for 7.0.*, don't stick such checks into current sources. (Also, if you do want to check for a NULL input in current sources, looking for a NULL pointer is the wrong way to code it anyway; PG_ARGISNULL(n) is the right way.) regards, tom lane
В списке pgsql-hackers по дате отправления: