Re: many to one of many modeling question
От | Kevin Hunter |
---|---|
Тема | Re: many to one of many modeling question |
Дата | |
Msg-id | 47827E4A.2030309@earlham.edu обсуждение исходный текст |
Ответ на | Re: many to one of many modeling question (brian <brian@zijn-digital.com>) |
Ответы |
Re: many to one of many modeling question
Re: many to one of many modeling question |
Список | pgsql-general |
At 2:09p -0500 on 07 Jan 2008, brian wrote: > Kevin Hunter wrote: >> Is there a clever/clean way of having the comments foreign key into >> the multiple tables? > > If, by object, you mean that you have several tables, each row of which > should be associated with one or more comments, the best way would be to > create join tables for each of those tables: :-( Yeah this is one method. I was hoping for something cleaner though. Something along the lines of CREATE TABLE o_1 ( id SERIAL ... ); CREATE TABLE o_2 ( id SERIAL ... ); CREATE TABLE o_3 ( id SERIAL ... ); CREATE TABLE comments ( id SERIAL, obj_id INTEGER ... FOREIGN KEY (obj_id) REFERENCES ONE OF o_1(id), o_2(id), o_3(id) ); This obviously won't syntactically work, but you perhaps get the drift ... > Out of curiosity, is this for a CakePHP app? Nope. This is for a customers private project. Sorry! :-) Kevin
В списке pgsql-general по дате отправления: