pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: frederik nietzsche <nietzsche_psql@yahoo.it>
To: pgsql-sql@postgresql.org
Subject: how to inherits the references...
Date: Thu, 11 Jul 2002 16:43:58 +0200 (CEST)
Message-ID: <20020711144358.42879.qmail@web12906.mail.yahoo.com> (raw)

hi all,
I've created some table with the inharitance,
something like:

CREATE TABLE sigles(
	sigle	varchar(255) PRIMARY KEY
);

  CREATE TABLE cars(
        UNIQUE (sigle)
  )INHERITS (sigles);

    CREATE TABLE used_cars(
          old_owner text,
          km        text,
          model     text,
          year      text,
          PRIMARY KEY (sigle)
    )INHERITS (cars);

    CREATE TABLE new_cars(
          model     text,
          type      text,
          some_other  text,
          PRIMARY KEY (sigle)
    )INHERITS (cars);

then I have a table of owner (with some fields) that
does not inherits nothing.

and then I have a table for the relation between
used_cars and old_owner:

CREATE TABLE cars_owner_relations(
      car    text   REFERENCES used_cars (sigle),
      owner  text   REFERENCES old_owner (id)
);

now, when I insert used_cars it also create a sigle
inside the "sigles" table, and this is OK, but when I
insert a record inside the cars_owner_relations it
says: 

ERROR:  <unnamed> referential integrity violation -
key referenced from cars_owner_relations not found in
sigles


as if the sigles where not in the "sigles" table, but
it's there!
it's probably because of the way in which psql threats
 the inheritance.
my question is (finally): is there some workaround for
this?? or: am I making some mistakes??

ok, thanks and sorry for my english...
danilo

______________________________________________________________________
Scarica il nuovo Yahoo! Messenger: con webcam, nuove faccine e tante altre novità.
http://it.yahoo.com/mail_it/foot/?http://it.messenger.yahoo.com/



view thread (4+ messages)  latest in thread

Message-ID: <20020711144358.42879.qmail@web12906.mail.yahoo.com>
Permalink:  ../20020711144358.42879.qmail@web12906.mail.yahoo.com/
Also on:    postgresql.org/message-id/20020711144358.42879.qmail@web12906.mail.yahoo.com

 · 

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: nietzsche_psql@yahoo.it
  Subject: Re: how to inherits the references...
  In-Reply-To: <20020711144358.42879.qmail@web12906.mail.yahoo.com>

* 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