Re: refential integrity to multiple tables ??
От | Erik Ronström |
---|---|
Тема | Re: refential integrity to multiple tables ?? |
Дата | |
Msg-id | 20031008082525.54141.qmail@web13805.mail.yahoo.com обсуждение исходный текст |
Ответ на | refential integrity to multiple tables ?? (Nagib Abi Fadel <nagib_postgres@yahoo.com>) |
Список | pgsql-general |
Almost everything is possible if you accept to write your own triggers and trigger functions. But there is no standard solution to this problem. There are of course inherited tables, but in the current implementation, foreign key constraints doesn't work very well with them (making them completly worthless IMO). That is going to change in a future release according to the docs, but for now, table inheritance is not the way to go in your case. Triggers are. Regards Erik > let's say i have a tansaction table called TRANSACTION > (transaction_id,amount,type,type_id) > > Let's say a transaction can have multiple types: TYPE1, TYPE2 for > example. > > EACH type has his own definition and his own table. > > Every transaction has a type that could be type1 or type2 that's why > if the type is TYPE1 i want to make a referential integrity to the > TYPE1_TABLE and if the type is TYPE2 i want to make a referential > integrity to the TYPE2_TABLE. > > IS IT POSSIBLE TO DO THAT??? > > I made a turn around to this problem by creating two tables: > - table TYPE1_TRANSACTION (type1_id,transaction_id) > - table TYPE2_TRANSACTION (type2_id,transaction_id) > > But this does not seem so right for me ?? > > thx for any help ________________________________________________________________________ Want to chat instantly with your online friends? Get the FREE Yahoo! Messenger http://mail.messenger.yahoo.co.uk
В списке pgsql-general по дате отправления: