Re: core dump on 8.1 and no dump on REL8_1_STABLE - Mailing list pgsql-hackers

From Atsushi Ogawa
Subject Re: core dump on 8.1 and no dump on REL8_1_STABLE
Date
Msg-id 613787150511250215h6fbbcc2q@mail.gmail.com
Whole thread Raw
In response to Re: core dump on 8.1 and no dump on REL8_1_STABLE  (Teodor Sigaev <teodor@sigaev.ru>)
Responses Re: core dump on 8.1 and no dump on REL8_1_STABLE
List pgsql-hackers
I reproduced the problem by loading this dump to 8.1.0.
I think that the problem is the same as this:
http://archives.postgresql.org/pgsql-hackers/2005-11/msg01016.php

I saw heap_tuple_toast_attrs() overwrites a new tuple. And, backend
crashed while executing ExecInsertIndexTuples().

The problem occurs by the table like the following structures.(1)The table has a varlena column.(2)The table has a
columnwith check constraint after the varlena column.(3)The table has a indexed column after the column with check
constraint.
And, the problem occurs if a tuple for which TOAST is necessary is
inserted or updated.

Example:

create table test_tbl (   varlena_col     text,   check_col       text,   index_col       text,   constraint
test_tbl_chkcheck (check_col ~ '^[0-9]+$') 
);

create index test_tbl_idx on test_tbl(index_col);

insert into test_tbl (varlena_col, check_col, index_col)
values('A', '0', 'B');

update test_tbl
set varlena_col = repeat('A', 2000)
where index_col = 'B';

The backend will be crashed or wrong data will be registered to the index.
If backend is not crashed, Index Scan might return the wrong result.

explain select count(*) from test_tbl where index_col = 'B';                             QUERY PLAN
---------------------------------------------------------------------------Aggregate  (cost=8.50..8.51 rows=1 width=0)
-> Bitmap Heap Scan on test_tbl  (cost=2.01..8.49 rows=3 width=0)        Recheck Cond: (index_col = 'B'::text)
-> Bitmap Index Scan on test_tbl_idx  (cost=0.00..2.01 rows=3 width=0)              Index Cond: (index_col = 'B'::text) 

select count(*) from test_tbl where index_col = 'B';count
-------    0  (Wrong result. Correct result is 1.)

--- Atsushi Ogawa


pgsql-hackers by date:

Previous
From: "R, Rajesh (STSD)"
Date:
Subject: Ipv6 and Postgresql 8.0.3
Next
From: Simon Riggs
Date:
Subject: Re: gprof SELECT COUNT(*) results