BUG #2830: Wrong results for prepared statements while clustering target table

From: "" <martin(dot)pihlak(at)gmail(dot)com>
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #2830: Wrong results for prepared statements while clustering target table
Date: 2006-12-16 12:28:51
Message-ID: 200612161228.kBGCSp0B056041@wwwmaster.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs


The following bug has been logged online:

Bug reference: 2830
Logged by:
Email address: martin(dot)pihlak(at)gmail(dot)com
PostgreSQL version: 8.2.0, older
Operating system: Ubuntu 6.10 2.6.17-10-386, libc6 2.4-1ubuntu12
Description: Wrong results for prepared statements while clustering
target table
Details:

Prepared SELECT/UPDATE/DELETE statements produce wrong results if executed
while target table is being clustered. Only seems to happens when CLUSTER
and statement are executed in different sessions. Tested on 8.0.6, 8.0.8,
8.1.4 and 8.2.0, reproducible with the following test case:

create table test(i integer);
-- generate large enough table, so that clustering takes more than 1 sec
insert into test select * from generate_series(1,1000000);
create index test_idx on test(i);

prepare c as select count(*) from test;

\! psql -c "cluster test_idx on test" &
-- sleep to make sure we stay behind cluster
\! sleep 1

-- should produce same values
execute c;
select count(1) from test;

Executing 'c' after CLUSTER returns 0 instead of 1000000.

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2006-12-16 22:39:13 Re: lost on referentail integrity
Previous Message Patrice Beliveau 2006-12-15 19:26:07 lost on referentail integrity