From: | David Fetter <david(at)fetter(dot)org> |
---|---|
To: | Perry Smith <pedz(at)easesoftware(dot)com> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Polymorphic delete help needed |
Date: | 2007-07-06 13:01:54 |
Message-ID: | 20070706130154.GA23898@fetter.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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(at)fetter(dot)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
From | Date | Subject | |
---|---|---|---|
Next Message | PFC | 2007-07-06 13:23:35 | Re: Polymorphic delete help needed |
Previous Message | Perry Smith | 2007-07-06 12:21:52 | Re: Polymorphic delete help needed |