Re: random generated string matching index in inexplicable ways - Mailing list pgsql-general

From Myles Miller
Subject Re: random generated string matching index in inexplicable ways
Date
Msg-id 20190507131236.GA62383@50pop.com
Whole thread Raw
In response to Re: random generated string matching index in inexplicable ways  (Alban Hertroys <haramrae@gmail.com>)
Responses Re: random generated string matching index in inexplicable ways
List pgsql-general
> > # SELECT y FROM x WHERE y = chr(round(random())::int + 65);
> > y 
> > ---
> > A
> > B
> > (2 rows)
> Here you got a random value in the lower range of 0..1 for the record with value ‘A’, so that’s a match, and one in
thehigher range for value ‘B’, a match again, so you get 2 rows.
 

No, the function is returning just one letter, either 'A' or 'B', not multiple values.

# SELECT * FROM chr(round(random())::int + 65);
 chr
-----
 B
(1 row)

# SELECT * FROM chr(round(random())::int + 65);
 chr
-----
 A
(1 row)





pgsql-general by date:

Previous
From: Alban Hertroys
Date:
Subject: Re: random generated string matching index in inexplicable ways
Next
From: Myles Miller
Date:
Subject: Re: random generated string matching index in inexplicable ways [EXT]