Re: Strange results when casting string to double - Mailing list pgsql-general

From Peter J. Holzer
Subject Re: Strange results when casting string to double
Date
Msg-id 20220218214249.su6x5hi6ixauggku@hjp.at
Whole thread Raw
In response to Re: Strange results when casting string to double  (Carsten Klein <c.klein@datagis.com>)
Responses Re: Strange results when casting string to double  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: Strange results when casting string to double  (Tomas Pospisek <tpo2@sourcepole.ch>)
List pgsql-general
On 2022-02-18 18:07:35 +0100, Carsten Klein wrote:
> both PostgreSQL and my C program are linked to the same libc.so.6. Same
> path, same MD5 sum. Since libc is a Shared Object (so), both processes
> should really run the identical code. Am I missing something? I've written
> and compiled the small C program on the same old Ubuntu OS.
[...]
> PostgreSQL is up for more than 480 days on that server. I'm thinking of
> giving a restart of the database a try. However, there's a long running
> import taking place, so this will not happen before mid or end of next week.

If there has been a glibc update (or a postgresql update) in those 480
days (Ubuntu 14.04 is out of its normal maintenance period but ESM is
still available) the running processes may well run different code than
a newly started program. So it could be a bug which has since been
fixed.

Another idea: It could be the case that something (maybe a bug in
postgres, maybe an extension, maybe even a random bit flip in memory)
changed the FP rounding mode within the postgres process, which would
affect all FP computations until the rounding mode is reset. That would
have to have happened in the master to affect the worker processes as
consistently as you are seeing. I don't know if it is even possible for
a non-standard rounding mode to persist for any length of time, but if
it is it would certainly account for weird rounding errors.

        hp

--
   _  | Peter J. Holzer    | Story must make more sense than reality.
|_|_) |                    |
| |   | hjp@hjp.at         |    -- Charles Stross, "Creative writing
__/   | http://www.hjp.at/ |       challenge!"

Attachment

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: Strange results when casting string to double
Next
From: Tom Lane
Date:
Subject: Re: Strange results when casting string to double