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