initial random incompatibility

From: Euler Taveira <euler(at)timbira(dot)com(dot)br>
To: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: initial random incompatibility
Date: 2019-06-08 14:09:34
Message-ID: CAHE3wgjD-aKX6JGFJsY6b5vkVV_MkBxZKSSHdDLzwX7fVy5VXQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Guillaume Lelarge 2019-06-08 14:23:55 Re: Quick doc typo fix
Previous Message Dmitry Dolgov 2019-06-08 14:03:09 Re: pg_basebackup failure after setting default_table_access_method option