Re: [BUGS] BUG #14737: Wrong PL/pgSQL behaviour - Mailing list pgsql-bugs

From David G. Johnston
Subject Re: [BUGS] BUG #14737: Wrong PL/pgSQL behaviour
Date
Msg-id CAKFQuwYc1ZHxDs9vkG5q5=mDF6OLhYqXMyRVSEWpwSHsLh3RDQ@mail.gmail.com
Whole thread Raw
In response to [BUGS] BUG #14737: Wrong PL/pgSQL behaviour  (frank.von.postgresql.org@familie-gard.de)
List pgsql-bugs
On Fri, Jul 7, 2017 at 1:49 PM, Frank Gard <frank@familie-gard.de> wrote:
In addition, the result should not differ at all between the two variants of
the function. What makes, semantically, the difference? There's none at all!

     FOR v_anzahl IN 1 .. p_anzahl LOOP
​[...]​

-                wert = p_von + FLOOR( ( 1 + p_bis - p_von ) * RANDOM() )
+                wert = v_zufall

SELECT gs, random()
FROM generate_series(1,10) ser (gs)

The reason this is not a bug is for the same reason the value of random() in the above query is different for every row.

David J.

pgsql-bugs by date:

Previous
From: Frank Gard
Date:
Subject: Re: [BUGS] BUG #14737: Wrong PL/pgSQL behaviour
Next
From: Tom Lane
Date:
Subject: Re: [BUGS] BUG #14737: Wrong PL/pgSQL behaviour