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

From suvisor.root@gmail.com
Subject BUG #6607: Strange select behavior
Date
Msg-id E1SM2Hz-0000Ox-PP@wrigleys.postgresql.org
Whole thread Raw
Responses Re: BUG #6607: Strange select behavior  ("Kevin Grittner" <Kevin.Grittner@wicourts.gov>)
List pgsql-bugs
The following bug has been logged on the website:

Bug reference:      6607
Logged by:          Sheplyakov Alexander
Email address:      suvisor.root@gmail.com
PostgreSQL version: 9.1.3
Operating system:   Debian GNU/Linux Wheezy kernel ver 3.3.1
Description:=20=20=20=20=20=20=20=20

Create test table in such manner:
create table testt (id serial PRIMARY KEY, val text not null);
Populate table with test data:
 insert into testt (val) values ('1'), ('2'), ('3'), ('4'), ('5'), ('6'),
('7'), ('8'), ('9');
(repeat next line until table doesn't contain approx 1000000 rows)
insert into testt (id, val) select nextval('testt_id_seq'::regclass),
currval('testt_id_seq'::regclass) + val::integer from testt;

And then, repeat some times such query:
select * from testt where id =3D (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!

pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: BUG #6605: wrong type cast from timestamp to timestamptz
Next
From: duncan.burke@orionvm.com.au
Date:
Subject: BUG #6608: SELECT FOR UPDATE not obtaining row exclusive locks in CTEs