oidrand question - Mailing list pgsql-sql

From Darren Greer
Subject oidrand question
Date
Msg-id 9906230705310F.13060@george
Whole thread Raw
List pgsql-sql
Hello again all.  First I would like to thank all those who helped me with the
multiple select statement.  Thanks to your help, it is working fine.

I am in the process of using oidrand inside of a select statement.  However, I
am noticing some wierd results when I feed certain numbers in.  Here is a
sample select statement.
select * from listeners where station = 'KKLS' and oidrand(oid, 2);

This returns, as expected, about 50% of the results.  Another:select * from listeners where station = 'KKLS' and
oidrand(oid,3);
 

This return about 33%.

Now lets say that I want to get 75% of the results.  I would put 1.333 in
there, but it does not return 75%, it return 100%.  This tells me that this is
rounding to the nearest whole number.  If so, how does one get say 75% of the
results?

Thanks,

Darren




pgsql-sql by date:

Previous
From: José Soares
Date:
Subject: Re: [SQL] Are int4/int8 ops defined?
Next
From: Mark Dalphin
Date:
Subject: Re:Create table doesn't always respect atomicity of transactions