Re: Question about ECPGset_noind_null() and ECPGis_noind_null()
От | Boszormenyi Zoltan |
---|---|
Тема | Re: Question about ECPGset_noind_null() and ECPGis_noind_null() |
Дата | |
Msg-id | 4B059898.2090007@cybertec.at обсуждение исходный текст |
Ответ на | Question about ECPGset_noind_null() and ECPGis_noind_null() (Boszormenyi Zoltan <zb@cybertec.at>) |
Ответы |
Re: Question about ECPGset_noind_null() and ECPGis_noind_null()
|
Список | pgsql-hackers |
Boszormenyi Zoltan írta: > Hi, > > my question is that what platform were these > functions developed and tested? > > We have come across a value that fails a NOT NULL > constraint upon INSERT under HP-UX/IA64, but not > under x86-64 Linux. The value in question is > 1.9999999999999998 assigned to a "double" variable. > Under HP-UX/IA64, testing with risnull() from > the application indeed returns true, but under > Linux/x86-64 returns false. > > I will test rsetnull() results on real Informix under > HP-UX/IA64. > I have tested it under ESQL/C on HP-UX/ia64 and this happened: - rsetnull() on a double value creates FF FF FF FF FF FF FF FF - the value causing the error above is 3F FF FF FF FF FF FF FF It seems that this function in ecpglib/misc.c has an off-by-one bug as it's interpreted by the HP-UX CC: static bool _check(unsigned char *ptr, int length) { for (; length > 0 && ptr[--length] == 0xff;); if (length <= 0) return true; return false; } I suspect that GCC does the "--length" after checking "length > 0" and before checking the "ptr[...] == 0xff", but HP CC does it before checking "length > 0". The attached patch solves the problem. Best regards, Zoltán Böszörményi -- Bible has answers for everything. Proof: "But let your communication be, Yea, yea; Nay, nay: for whatsoever is more than these cometh of evil." (Matthew 5:37) - basics of digital technology. "May your kingdom come" - superficial description of plate tectonics ---------------------------------- Zoltán Böszörményi Cybertec Schönig & Schönig GmbH http://www.postgresql.at/
Вложения
В списке pgsql-hackers по дате отправления: