Re: random generated string matching index in inexplicable ways [EXT]

From: Myles Miller <pg(at)q7r7(dot)com>
To: Daniel Perrett <dp13(at)sanger(dot)ac(dot)uk>, pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: random generated string matching index in inexplicable ways [EXT]
Date: 2019-05-07 13:15:12
Message-ID: 20190507131512.GB62383@50pop.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tue, May 07, 2019 at 12:17:12PM +0000, Daniel Perrett wrote:
> The WHERE expression (and therefore the random function) is being evaluated once per row, not once per query.
> If you run this query a few times, you will see the problem:
> SELECT y, chr(round(random())::int + 65) FROM (SELECT 'A' UNION SELECT 'B') x(y);

Ah! Thank you! I understand now.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Steven Lembark 2019-05-07 13:48:45 Re: Postgres for SQL Server users
Previous Message Myles Miller 2019-05-07 13:12:36 Re: random generated string matching index in inexplicable ways