Bug?: Update on ancestor for a row of a child

From: Kovacs Baldvin <kb136(at)hszk(dot)bme(dot)hu>
To: <pgsql-sql(at)postgresql(dot)org>, <pgsql-hackers(at)postgresql(dot)org>, Kevin Way <kevin(dot)way(at)overtone(dot)org>
Subject: Bug?: Update on ancestor for a row of a child
Date: 2001-09-23 23:55:38
Message-ID: Pine.GSO.4.33.0109240143280.11546-100000@ural2
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-sql

Hello (mainly developer) folks!

Probably Kevin really found a bug.

When I saw his words in $50, I immediately started to look around his
problem... You probably don't think that as a student here, in Hungary I
live half a month for $50 :-))))

So I simplified his given schema as much as I needed, and found out
what exactly the problem is.

(Kevin, if you badly need a workaround, I can give you one,
but quite an ugly one.)

The problem is: when updating a row in an ancestor table,
which is really belongs to a child, there's something wrong
with the CHECK system.

Here's the simple schema, producing the error:

----------------

drop table child;
drop table ancestor;

create table ancestor (
node_id int4,
a int4
);

create table child (
b int4 NOT NULL DEFAULT 0
CHECK ( b = 0 OR b = 1)
) inherits (ancestor);

insert into ancestor values (3,4);
insert into child values (5,6,1);

update ancestor set a=8 where node_id=5;

----------------

If one leaves out the CHECK condition, the UPDATE
works just fine, and __the final result meets the
check condition__.

So it seems to me that the system
1. either tries to check the CHECK condition of the child on the
ancestor
2. or only uses a wrong time to check against it.

Best regards,
Baldvin

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tatsuo Ishii 2001-09-23 23:58:22 Re: UTF-8 support
Previous Message Peter Eisentraut 2001-09-23 23:53:33 Re: CVS changes

Browse pgsql-sql by date

  From Date Subject
Next Message Alex Pilosov 2001-09-24 01:29:11 outer joins strangeness
Previous Message Josh Berkus 2001-09-23 21:14:17 Request for book reviews/comments