Re: Integrity on large sites

From: "Alexander Staubo" <alex(at)purefiction(dot)net>
To: "Naz Gassiep" <naz(at)mira(dot)net>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Integrity on large sites
Date: 2007-05-23 17:43:50
Message-ID: 88daf38c0705231043t4082b34atf588aea54b6d2fb@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 5/23/07, Naz Gassiep <naz(at)mira(dot)net> wrote:
> "*Really* big sites don't ever have referential integrity. Or if the few
> spots they do (like with financial transactions) it's implemented on the
> application level (via, say, optimistic locking), never the database level."

It's not just the big ones. Try using Ruby on Rails -- and its ORM,
ActiveRecord -- at some point, and you will notice the rampant
ignorance of referential integrity. ActiveRecord bears signs of having
been designed for MySQL.

For example, you need a plugin to add programmatic support for
foreign-key declarations to your schema code, and foreign key
relationships have to be explicitly defined using directives such as
"has_many". The unit test framework assumes it can delete rows in any
order, irrespective of foreign-key references. And so on.

Interestingly, ActiveRecord's support for polymorphic object
associations -- which allow you define a reference to an object in an
arbitrary table -- violates RI *per definition*. There's no support
for setting up the check constraints that would be appropriate for
such attributes. All the more annoying, since such associations are
extremely useful.

Alexander.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message PFC 2007-05-23 17:48:54 Re: Integrity on large sites
Previous Message Scott Marlowe 2007-05-23 17:22:47 Re: Integrity on large sites