pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Bug?: Update on ancestor for a row of a child
4+ messages / 3 participants
[nested] [flat]

* Bug?: Update on ancestor for a row of a child
@ 2001-09-23 23:55 Kovacs Baldvin <kb136@hszk.bme.hu>
  2001-09-24 02:51 ` Re: Bug?: Update on ancestor for a row of a child Kevin Way <kevin.way@overtone.org>
  0 siblings, 1 reply; 4+ messages in thread

From: Kovacs Baldvin @ 2001-09-23 23:55 UTC (permalink / raw)
  To: pgsql-sql; pgsql-hackers@postgresql.org; Kevin Way <kevin.way@overtone.org>

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





^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: Bug?: Update on ancestor for a row of a child
  2001-09-23 23:55 Bug?: Update on ancestor for a row of a child Kovacs Baldvin <kb136@hszk.bme.hu>
@ 2001-09-24 02:51 ` Kevin Way <kevin.way@overtone.org>
  2001-09-24 15:11   ` Re: Bug?: Update on ancestor for a row of a child Josh Berkus <josh@agliodbs.com>
  0 siblings, 1 reply; 4+ messages in thread

From: Kevin Way @ 2001-09-24 02:51 UTC (permalink / raw)
  To: Kovacs Baldvin <kb136@hszk.bme.hu>; +Cc: pgsql-sql

> 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.

Well, I believe you found one minor problem.  The bigger one is still
lurking in the shadows though.  To duplicate it, take my previous schema,
and add 

        lastlog         TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,           

to the users table, between pass_hash and logged_in.

After doing so, you'll find that postgres actually crashes when you try
to insert a vote into the uservote table.  That's the one that has me
looking at the costs involved with migrating to Oracle.

-Kevin



^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: Bug?: Update on ancestor for a row of a child
  2001-09-23 23:55 Bug?: Update on ancestor for a row of a child Kovacs Baldvin <kb136@hszk.bme.hu>
  2001-09-24 02:51 ` Re: Bug?: Update on ancestor for a row of a child Kevin Way <kevin.way@overtone.org>
@ 2001-09-24 15:11   ` Josh Berkus <josh@agliodbs.com>
  2001-09-24 16:11     ` Re: Bug?: Update on ancestor for a row of a child Kevin Way <kevin.way@overtone.org>
  0 siblings, 1 reply; 4+ messages in thread

From: Josh Berkus @ 2001-09-24 15:11 UTC (permalink / raw)
  To: Kevin Way <kevin.way@overtone.org>; +Cc: pgsql-sql

Kevin,

> After doing so, you'll find that postgres actually crashes when you
> try
> to insert a vote into the uservote table.  That's the one that has me
> looking at the costs involved with migrating to Oracle.

And you think that Oracle is entirely free of bugs?  ;-)

At least here, you can get a message to the actual database developers.

Still, I understand your frustration.   

-Josh


______AGLIO DATABASE SOLUTIONS___________________________
                                       Josh Berkus
  Complete information technology      josh@agliodbs.com
   and data management solutions       (415) 565-7293
  for law firms, small businesses        fax 621-2533
    and non-profit organizations.      San Francisco







^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: Bug?: Update on ancestor for a row of a child
  2001-09-23 23:55 Bug?: Update on ancestor for a row of a child Kovacs Baldvin <kb136@hszk.bme.hu>
  2001-09-24 02:51 ` Re: Bug?: Update on ancestor for a row of a child Kevin Way <kevin.way@overtone.org>
  2001-09-24 15:11   ` Re: Bug?: Update on ancestor for a row of a child Josh Berkus <josh@agliodbs.com>
@ 2001-09-24 16:11     ` Kevin Way <kevin.way@overtone.org>
  0 siblings, 0 replies; 4+ messages in thread

From: Kevin Way @ 2001-09-24 16:11 UTC (permalink / raw)
  To: Josh Berkus <josh@agliodbs.com>; +Cc: pgsql-sql

> And you think that Oracle is entirely free of bugs?  ;-)

Yes, but they'd be exciting technology-oriented e-business enabled bugs!

> Still, I understand your frustration.   

Thanks...  It's just frustrating that the bug is on something so basic,
which makes it both hard to code around and hard for me to delve into the
postgres source and fix.  I spent a few hours tracing source before finally
conceding the point that it takes more than a few hours to understand
postgres internals well enough to fix a major bug.

For development purposes I've just removed all the CHECK constraints 
from my child tables, and I'm hoping some genius will solve the problem
by the time I'm looking to deploy.

-Kevin Way



^ permalink  raw  reply  [nested|flat] 4+ messages in thread


end of thread, other threads:[~2001-09-24 16:11 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2001-09-23 23:55 Bug?: Update on ancestor for a row of a child Kovacs Baldvin <kb136@hszk.bme.hu>
2001-09-24 02:51 ` Kevin Way <kevin.way@overtone.org>
2001-09-24 15:11   ` Josh Berkus <josh@agliodbs.com>
2001-09-24 16:11     ` Kevin Way <kevin.way@overtone.org>

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