Re: Polymorphic delete help needed

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 15:36:29
Message-ID: 20070706153629.GA22153@fetter.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Fri, Jul 06, 2007 at 08:39:50AM -0500, Perry Smith wrote:
>
> On Jul 6, 2007, at 8:01 AM, David Fetter wrote:
>
> >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.
>
> I really want to follow this particular edict. Rails makes it easy
> to put the checking up in Rails but, I assume that if the interface
> between PostgreSQL and one of its languages like "SQL" or Python,
> etc is an inch thick, then the interface between Rails and
> PostgreSQL would be 12 inches thick.

At some point, you're going to realize that Rails is the problem, not
the solution. It's written by people who do not understand what a
shared data store is and reflects problems inherent in its native
database platform: MySQL 3.23.

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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Michael Glaesemann 2007-07-06 15:46:06 Re: Localization trouble
Previous Message Louis-David Mitterrand 2007-07-06 15:09:04 CASE in ORDER BY clause