"Higuchi, Daisuke" <higuchi.daisuke@jp.fujitsu.com> writes:
> From: Tom Lane [mailto:tgl@sss.pgh.pa.us]
>> So I think that we ought to unconditionally make the sqlda value's digit
>> buffer look just like the one we're copying, even when ndigits = 0,
>> which just requires removing the tests on ndigits.
> I agree with you. Seeing this thread[1], 'if (ndigits = 0)' was introduced only to avoid memcpy() crash. I do not
knowthis solution was best or not, but no crash occurs in the current version. So, I also think 'if (ndigits = 0)'
shouldbe removed.
Hmmm ... looking at PGTYPESnumeric_from_asc, it seems like the current
behavior is different from what was described in that old thread; the only
case where a digit buffer wouldn't be created is a NaN. But maybe a crash
could occur for NaN. Perhaps we should use "if (num->sign !=
NUMERIC_NAN)" as a guard?
regards, tom lane