[GENERAL] Boolean error

2004-11-27 Thread Fabien Fournier
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

Re: [GENERAL] Boolean error

2004-11-27 Thread Tom Lane
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

Re: [GENERAL] Boolean error

2004-11-28 Thread Greg Stark
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

Re: [GENERAL] GENERAL] Boolean error

2004-11-27 Thread songsubosongtebo songsubosongtebo
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.