Re: The rule question before, request official documentation on the problem

From: Martijn van Oosterhout <kleptog(at)svana(dot)org>
To: Chris Travers <chris(at)metatrontech(dot)com>
Cc: Listmail <lists(at)peufeu(dot)com>, Stuart Cooper <stuart(dot)cooper(at)gmail(dot)com>, pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: The rule question before, request official documentation on the problem
Date: 2007-04-11 17:41:22
Message-ID: 20070411174122.GB25511@svana.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, Apr 11, 2007 at 09:21:46AM -0700, Chris Travers wrote:
> DO ALSO rules involving NEW are fundamentally dangerous to the integrity
> of data because NEW is not guaranteed to be internally consistent. DO
> INSTEAD rules are fine (there is only one NEW), as are any DO ALSO rules
> involving OLD.

Huh? The entered data is exactly what was asked. The whole system is
totally deterministic and works as designed. Really, I'd prefer a warning
stating that people shouldn't use rules unless they absolutly know what
they're doing.

> One of the things that causes me to favor PostgreSQL for all my projects
> is the strong emphasis on data integrity by the community, perhaps
> better than any other RDBMS out there. Being unwilling to warn clearly
> and loudly about unsafe features does undermine that commitment.

The problem is that the are some things that really need rules.
However, I think you can safely say:

Unless what you want can only be done using rules, use triggers. They
are far more obivous.

Not to mention that using a rule for auditing is silly, since it won't
record what actually went into the table.

> For 90% of what I do, I use the local copy of the docs. My concern is
> that (at least in 8.1) there is no obvious warning about DO ALSO rules
> using NEW to be inherently nondeterministic.

Wrong word. It's not non-deterministic, nor is it undocumented, it's
just often misunderstood. Which brings you back to: if it doesn't have
to be a rule, make it a trigger. Forget you ever heard about rules.
Pretend they don't exist...

Have a nice day,
--
Martijn van Oosterhout <kleptog(at)svana(dot)org> http://svana.org/kleptog/
> From each according to his ability. To each according to his ability to litigate.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Andrew Edson 2007-04-11 17:50:57 Dumping part (not all) of the data in a database...methods?
Previous Message Jaime Silvela 2007-04-11 17:02:58 indexes, and tables within tables