Re: core dump on 8.1 and no dump on REL8_1_STABLE

From: Atsushi Ogawa <atsushi(dot)ogawa(at)gmail(dot)com>
To: Teodor Sigaev <teodor(at)sigaev(dot)ru>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Pgsql Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: core dump on 8.1 and no dump on REL8_1_STABLE
Date: 2005-11-25 10:15:55
Message-ID: 613787150511250215h6fbbcc2q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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 column with 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_chk check (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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Simon Riggs 2005-11-25 10:23:54 Re: gprof SELECT COUNT(*) results
Previous Message R, Rajesh (STSD) 2005-11-25 10:05:33 Ipv6 and Postgresql 8.0.3