Re: BUG #6607: Strange select behavior - Mailing list pgsql-bugs

From Kevin Grittner
Subject Re: BUG #6607: Strange select behavior
Date
Msg-id 4F959339020000250004725A@gw.wicourts.gov
Whole thread Raw
In response to BUG #6607: Strange select behavior  (suvisor.root@gmail.com)
List pgsql-bugs
********* ********<suvisor.root@gmail.com> wrote:
> Kevin Grittner <Kevin.Grittner@wicourts.gov> *******:
=20
>> what you have written will scan the entire table and give each
>> row a 1 in 100000 chance of being selected.
>>
> Hmm, is this because random() marked as volatile (and would be
> called for every row)? Ups, I not taken this into account...
=20
The VOLATILE marker *guarantees* that random() will be run for every
row, but even with an immutable function you would be taking your
chances on how it might run, with the way it was coded.  The
semantics are made unambiguous (I think) by making it a subquery in
the FROM clause.
=20
-Kevin

pgsql-bugs by date:

Previous
From: "Kevin Grittner"
Date:
Subject: Re: BUG #6607: Strange select behavior
Next
From: biju.george@ust-global.com
Date:
Subject: BUG #6609: pattern matching (version 8.2 or so...)