Re: BUG #6607: Strange select behavior

Поиск
Список
Период
Сортировка
От Александр Шепляков
Тема Re: BUG #6607: Strange select behavior
Дата
Msg-id CALiGy8bJw3KkQVZrnBcGYOV=-9v2Fv9LBN=MS3WNAZxKwaXyrw@mail.gmail.com
обсуждение исходный текст
Ответ на Re: BUG #6607: Strange select behavior  ("Kevin Grittner" <Kevin.Grittner@wicourts.gov>)
Список pgsql-bugs
23 апреля 2012 г. 17:53 пользователь Kevin Grittner
<Kevin.Grittner@wicourts.gov> написал:
> <suvisor.root@gmail.com> wrote:
>
>> select * from testt where id = (random()* 100000)::integer;
>>
>> And sometimes it comes out something like this:
>> id | val
>> -------+--------
>> 11894 | 15051
>> 29233 | 42198
>> 80725 | 90213
>> 85688 | 100992
>> 88017 | 108075
>> (5 rows)
>> Here can be 2, 3 or other rows amount in result... But must be
>> only one!
>
> No, what you have written will scan the entire table and give each
> row a 1 in 100000 chance of being selected.  Maybe something like
> this would give you what you want:
>
Hmm, is this because random() marked as volatile (and would be called
for every row)? Ups, I not taken this into account... Sorry for bothering
and thanks for reply!


В списке pgsql-bugs по дате отправления:

Предыдущее
От: biju.george@ust-global.com
Дата:
Сообщение: BUG #6609: pattern matching (version 8.2 or so...)
Следующее
От: Josh Kupershmidt
Дата:
Сообщение: Re: BUG #6609: pattern matching (version 8.2 or so...)