Search Postgresql Archives

Re: Rules going away

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> -----Original Message-----
> From: Ondrej Ivanič [mailto:ondrej.ivanic@xxxxxxxxx]
> Sent: Wednesday, September 28, 2011 6:47 PM
> To: pgsql-general@xxxxxxxxxxxxxx
> Subject: Re: Rules going away
> 
> Hi,
> 
> > folks, don't use RULES! use triggers -- and as much as possible, keep
> > triggers simple, short, and to the point (simple validation, custom
> > RI, auditing/logging, etc).
> 
> I like them :). 'DO INSTEAD' rules are great for partitioning so you
> can insert (or update) to parent table and 'DO INSTEAD' rule takes
> care about the rest.
> 
> --
> Ondrej Ivanic
> (ondrej.ivanic@xxxxxxxxx)

Years ago (PG version 8.2), I was working on implementing partitioned tables, and evaluated whether to use triggers or rules to "automagically" redirect inserts/updates/delete from main table to appropriate partition based on the value of partitioning key.

Unfortunately, I didn't document my research, but the result was that triggers were unusable for my purposes, and I ended up with the rules calling functions where using dynamic sql I decide which partition should be used for insert/update/delete (at least on "selects" PG takes care of choosing proper partition, of course with properly set configuration parameter).

These rules (and functions they call) work perfectly for me all these years in many, many, many installations.
So, until PG takes care of the problem I'm solving with the rules (implementing "complete" partitioning feature, and not just on "selects"), please leave rules where they are, they definitely have their use when properly implemented with specific purpose.

Regards,
Igor Neyman

-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux