how to inherits the references...

Поиск
Список
Период
Сортировка
От frederik nietzsche
Тема how to inherits the references...
Дата
Msg-id 20020711144358.42879.qmail@web12906.mail.yahoo.com
обсуждение исходный текст
Ответы Re: how to inherits the references...
Список 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 threatsthe 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/


В списке pgsql-sql по дате отправления:

Предыдущее
От:
Дата:
Сообщение: Re: XML to Postgres conversion
Следующее
От: "Rudi Starcevic"
Дата:
Сообщение: Re: XML to Postgres conversion