> > # 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 the higher 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)