Re: [Bug Fix]ECPG: cancellation of significant digits on ECPG

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Higuchi, Daisuke" <higuchi(dot)daisuke(at)jp(dot)fujitsu(dot)com>
Cc: "'Dmitry Dolgov'" <9erthalion6(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [Bug Fix]ECPG: cancellation of significant digits on ECPG
Date: 2018-11-14 16:32:15
Message-ID: 8473.1542213135@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

I wrote:
> 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?

After sleeping on it, it seems like the right thing to check for is
whether num->buf is NULL, which describes precisely the situation
where we should not try to make a copy of the digit buffer (and the
initial struct memcpy has made a valid copy of the null pointers).
So I fixed it like that.

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Dmitry Dolgov 2018-11-14 16:48:47 Re: Index Skip Scan
Previous Message Peter Eisentraut 2018-11-14 16:13:02 Re: Alter index rename concurrently to