Skip site navigation (1) Skip section navigation (2)

Re: BUG #6607: Strange select behavior

From: "Kevin Grittner" <Kevin(dot)Grittner(at)wicourts(dot)gov>
To: ********* ******** <suvisor(dot)root(at)gmail(dot)com>
Cc: <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: BUG #6607: Strange select behavior
Date: 2012-04-23 22:36:57
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-bugs
********* ********<suvisor(dot)root(at)gmail(dot)com> wrote:
> Kevin Grittner <Kevin(dot)Grittner(at)wicourts(dot)gov> *******:
>> 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...
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.

In response to

pgsql-bugs by date

Next:From: Josh KupershmidtDate: 2012-04-23 23:51:34
Subject: Re: BUG #6609: pattern matching (version 8.2 or so...)
Previous:From: Александр ШепляковDate: 2012-04-23 22:23:38
Subject: Re: BUG #6607: Strange select behavior

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group