Re: Heritage

From: Mark Gibson <gibsonm(at)cromwell(dot)co(dot)uk>
To: Sebastian Davancens <sdavancens(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Heritage
Date: 2004-09-09 14:10:55
Message-ID: 439e2f820831406f8863b9d2bb9e4e7c41406481@cromwell.co.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Sebastian Davancens wrote:
> Hi everyone. Im having a problem with heritage. The situation is the following:
> I have two tables, tbl_everyone and tbl_employees. tbl_employees
> inherits from tbl_everyone.
> In tbl_everyone, i store some information about everyone who is
> related with the place where i work: Name, ID (PK), Birth Date,
> Adress...
> Then, in tbl_employees i have aditional information, like area, position, etc.
> The problem appears when i have someone in tbl_everyone that becomes
> an employee. What do i have to do ? Consider that ID in tbl_everyone
> is used in auxiliar tables, so i cannot easily delete the person in
> tbl_everyone and insert it again in tbl_employees...

Have you tried deferred constraints, eg:

BEGIN;
SET CONSTRAINTS ALL DEFERRED;
DELETE ...;
INSERT ...;
END;

I've haven't had chance to test this, but I think this could
be what you're looking for.

--
Mark Gibson <gibsonm |AT| cromwell |DOT| co |DOT| uk>
Web Developer & Database Admin
Cromwell Tools Ltd.
Leicester, England.

In response to

  • Heritage at 2004-09-08 13:27:13 from Sebastian Davancens

Browse pgsql-general by date

  From Date Subject
Next Message Vic Cekvenich 2004-09-09 14:14:34 Re: Text Search vs MYSQL vs Lucene
Previous Message Jeff Eckermann 2004-09-09 13:49:05 Re: ERROR: parser: unterminated quoted string