pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Kovacs Baldvin <kb136@hszk.bme.hu>
To: pgsql-sql@postgresql.org
To: pgsql-hackers@postgresql.org
To: Kevin Way <kevin.way@overtone.org>
Subject: Bug?: Update on ancestor for a row of a child
Date: Mon, 24 Sep 2001 01:55:38 +0200 (MEST)
Message-ID: <Pine.GSO.4.33.0109240143280.11546-100000@ural2> (raw)

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





view thread (4+ messages)  latest in thread

Message-ID: <Pine.GSO.4.33.0109240143280.11546-100000@ural2>
Permalink:  ../Pine.GSO.4.33.0109240143280.11546-100000@ural2/
Also on:    postgresql.org/message-id/Pine.GSO.4.33.0109240143280.11546-100000@ural2

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: kb136@hszk.bme.hu, pgsql-hackers@postgresql.org, kevin.way@overtone.org
  Subject: Re: Bug?: Update on ancestor for a row of a child
  In-Reply-To: <Pine.GSO.4.33.0109240143280.11546-100000@ural2>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox