Re: BUG #14737: Wrong PL/pgSQL behaviour

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: frank(dot)von(dot)postgresql(dot)org(at)familie-gard(dot)de
Cc: "pgsql-bugs(at)postgresql(dot)org" <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: BUG #14737: Wrong PL/pgSQL behaviour
Date: 2017-07-07 21:06:17
Message-ID: CAKFQuwYc1ZHxDs9vkG5q5=mDF6OLhYqXMyRVSEWpwSHsLh3RDQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Fri, Jul 7, 2017 at 1:49 PM, Frank Gard <frank(at)familie-gard(dot)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.

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2017-07-07 21:39:04 Re: BUG #14737: Wrong PL/pgSQL behaviour
Previous Message Frank Gard 2017-07-07 20:49:02 Re: BUG #14737: Wrong PL/pgSQL behaviour