pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Myles Miller <pg@q7r7.com>
To: Daniel Perrett <dp13@sanger.ac.uk>
To: pgsql-general@lists.postgresql.org
Subject: Re: random generated string matching index in inexplicable ways [EXT]
Date: Tue, 7 May 2019 09:15:12 -0400
Message-ID: <20190507131512.GB62383@50pop.com> (raw)
In-Reply-To: <dc6516feb3ef43dba72779eeab659d79@sanger.ac.uk>
References: <20190507115345.GA56585@50pop.com>
	<dc6516feb3ef43dba72779eeab659d79@sanger.ac.uk>

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.






view thread (5+ messages)  latest in thread

Message-ID: <20190507131512.GB62383@50pop.com>
Permalink:  ../20190507131512.GB62383@50pop.com/
Also on:    postgresql.org/message-id/20190507131512.GB62383@50pop.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: pg@q7r7.com, dp13@sanger.ac.uk
  Subject: Re: random generated string matching index in inexplicable ways [EXT]
  In-Reply-To: <20190507131512.GB62383@50pop.com>
  References: <20190507115345.GA56585@50pop.com> <dc6516feb3ef43dba72779eeab659d79@sanger.ac.uk> <20190507131512.GB62383@50pop.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox