Re: Polymorphic delete help needed
От | David Fetter |
---|---|
Тема | Re: Polymorphic delete help needed |
Дата | |
Msg-id | 20070706130154.GA23898@fetter.org обсуждение исходный текст |
Ответ на | Polymorphic delete help needed (Perry Smith <pedz@easesoftware.com>) |
Ответы |
Re: Polymorphic delete help needed
|
Список | pgsql-general |
On Thu, Jul 05, 2007 at 09:56:12PM -0500, Perry Smith wrote: > I am doing a project using Ruby On Rails with PostgreSQL as the > database. I have not seen the term polymorphic used with databases > except with Rails so I will quickly describe it. You have now :) http://archives.postgresql.org/sfpug/2005-04/msg00022.php > Instead of holding just an id as a foreign key, the record holds a > "type" field which is a string and an id. The string is the name of > the table to which the id applies. (That is slightly simplified). This is brittle by nature. The above link sketches out a way to make it stable. If you have questions, ask :) > The first problem of many ;) [other stuff snipped] > that creates is it makes it hard to do a constraint > on the name/id pair. Let PostgreSQL work *for* you instead of picking a fight with it and then piling on heaps of unnecessary code. Cheers, David. -- David Fetter <david@fetter.org> http://fetter.org/ phone: +1 415 235 3778 AIM: dfetter666 Skype: davidfetter Remember to vote! Consider donating to PostgreSQL: http://www.postgresql.org/about/donate
В списке pgsql-general по дате отправления: