Hello,
We are experiencing a strange error with the following request :
select cmp
from (select random () < 0.5 as cmp from pg_type) as tmp
where cmp;
With this request even false results are shown. This behaviour doesn't
appear when we don't join the boolean expression to a table to have
mu
Fabien Fournier <[EMAIL PROTECTED]> writes:
> We are experiencing a strange error with the following request :
> select cmp
> from (select random () < 0.5 as cmp from pg_type) as tmp
> where cmp;
> With this request even false results are shown.
I think the planner will flatten this into
Tom Lane <[EMAIL PROTECTED]> writes:
> There was some talk awhile ago of preventing flattening when the
> subquery targetlist contains volatile functions, but we didn't
> have any consensus that the cure would be better than the disease.
> (In particular, since user-defined functions default to be
The sql can be predigest to:
select random() from a where random()<0.5;
\d a
Table "public.a"
Column | Type | Modifiers
+-+---
a | integer |
This query can get about a half rows in the table 'a'.
When search a row, postgresql calcuate random() twice.