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@svana.org> http://svana.org/kleptog/
> From each according to his ability. To each according to his ability to litigate.