initial random incompatibility - Mailing list pgsql-hackers

From Euler Taveira
Subject initial random incompatibility
Date
Msg-id CAHE3wgjD-aKX6JGFJsY6b5vkVV_MkBxZKSSHdDLzwX7fVy5VXQ@mail.gmail.com
Whole thread Raw
Responses Re: initial random incompatibility
List pgsql-hackers
Hi,

While fixing the breakage caused by the default number of trailing
digits output for real and double precision, I noticed that first
random() call after setseed(0) doesn't return the same value as 10 and
earlier (I tested 9.4 and later). It changed an expected behavior and
it should be listed in incompatibilities section of the release notes.
Some applications can rely on such behavior.

$ psql postgres
psql (10.4)
Type "help" for help.

postgres=# select setseed(0);
 setseed
---------

(1 row)

postgres=# select random();
      random
-------------------
 0.840187716763467
(1 row)

$ psql postgres
psql (12beta1)
Type "help" for help.

postgres=# select setseed(0);
 setseed
---------

(1 row)

postgres=# select random();
        random
-----------------------
 3.907985046680551e-14
(1 row)

It seems related to the pg_erand48() adoption at the end of the year
[1] (commit 6645ad6bdd81e7d5a764e0d94ef52fae053a9e13).


[1] https://www.postgresql.org/message-id/3859.1545849900@sss.pgh.pa.us


-- 
   Euler Taveira                                   Timbira -
http://www.timbira.com.br/
   PostgreSQL: Consultoria, Desenvolvimento, Suporte 24x7 e Treinamento



pgsql-hackers by date:

Previous
From: Dmitry Dolgov
Date:
Subject: Re: pg_basebackup failure after setting default_table_access_method option
Next
From: Guillaume Lelarge
Date:
Subject: Re: Quick doc typo fix