Re: Postgres bug (working with iserverd) - Mailing list pgsql-bugs

From Tom Lane
Subject Re: Postgres bug (working with iserverd)
Date
Msg-id 23384.989727769@sss.pgh.pa.us
Whole thread Raw
In response to Postgres bug (working with iserverd)  ("A.V.Shutko" <AVShutko@mail.khstu.ru>)
Responses Re: Postgres bug (working with iserverd)  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-bugs
"A.V.Shutko" <AVShutko@mail.khstu.ru> writes:
> Your server have a bug that sometimes cause coredumps.....

> Tom Lane> What version of postgres?
> # ./postgres -V
> postgres (PostgreSQL) 7.1

Okay, I think I understand the scenario here.  Are you using table
inheritance?  I can produce a crash in the same place using UPDATE
of an inheritance group:


regression=# create table par(f1 int);
CREATE
regression=# create table child(f2 int) inherits (par);
CREATE
regression=# insert into par values(1);
INSERT 1453231 1
regression=# begin;
BEGIN
regression=# update par set f1 = f1 + 1;
UPDATE 1

<< now start a second backend, and in it also do >>

regression=# update par set f1 = f1 + 1;

<< second backend blocks waiting for first one to commit;
   go back to first backend and do >>

regression=# end;
COMMIT

<< now second backend crashes in exec_append_initialize_next >>


The direct cause of the problem is that EvalPlanQual isn't completely
initializing the estate that it sets up for re-evaluating the plan.
In particular it's not filling in es_result_relations and
es_num_result_relations, which need to be set up if the top plan node
is an Append.  (That's probably my fault.)  But there are a bunch of
other fields that it's failing to copy, too.

Vadim, I'm thinking that EvalPlanQual would be better if it memcpy'd
the parent estate, and then changed the fields that should be different,
rather than zeroing the child state and then copying the fields that
need to be copied.  Seems like the default behavior should be to copy
fields rather than leave them zero.  What do you think?  Which fields
should really be zero in the child?

            regards, tom lane

pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: Postgres bug (working with iserverd)
Next
From: "Todd R. Eigenschink"
Date:
Subject: Re: REQ: build src/backend/postgres w/o -lncurses or -lreadline