how to inherits the references...

From: frederik nietzsche <nietzsche_psql(at)yahoo(dot)it>
To: pgsql-sql(at)postgresql(dot)org
Subject: how to inherits the references...
Date: 2002-07-11 14:43:58
Message-ID: 20020711144358.42879.qmail@web12906.mail.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

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/

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Rudi Starcevic 2002-07-11 15:18:24 Re: [SQL] XML to Postgres conversion
Previous Message George.T.Essig 2002-07-11 14:23:39 Re: XML to Postgres conversion