On Tue, May 7, 2019 at 3:12 PM Myles Miller <pg@q7r7.com> wrote:
> No, the function is returning just one letter, either 'A' or 'B', not multiple values.
Your random function is being evaluated ONCE FOR EACH ROW.
i.e, it's doing something like:
select y from
( SELECT y, chr(round(random())::int + 65) as z FROM x ) aux
WHERE y = z;
o
with aux as ( SELECT y, chr(round(random())::int + 65) as z FROM x )
select y from aux WHERE y = z;
You may want to try something like this:
with aux as ( SELECT chr(round(random())::int + 65) as z )
select y from x,aux WHERE y = z;
( Untested, but that's the idea )
Francisco Olarte