Re: Rules going away

Поиск
Список
Период
Сортировка
От Igor Neyman
Тема Re: Rules going away
Дата
Msg-id F4C27E77F7A33E4CA98C19A9DC6722A2082532E5@EXCHANGE.corp.perceptron.com
обсуждение исходный текст
Ответ на Re: Rules going away  (Ondrej Ivanič <ondrej.ivanic@gmail.com>)
Ответы Re: Rules going away
a dumb question regarding RULES
Список pgsql-general
> -----Original Message-----
> From: Ondrej Ivanič [mailto:ondrej.ivanic@gmail.com]
> Sent: Wednesday, September 28, 2011 6:47 PM
> To: pgsql-general@postgresql.org
> 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@gmail.com)

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

Unfortunately, I didn't document my research, but the result was that triggers were unusable for my purposes, and I
endedup 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
configurationparameter).
 

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
notjust on "selects"), please leave rules where they are, they definitely have their use when properly implemented with
specificpurpose.
 

Regards,
Igor Neyman

В списке pgsql-general по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: PDT but not WEST
Следующее
От: Reid Thompson
Дата:
Сообщение: Re: Solaris 10u9, PG 8.4.6, 'c' lang function, fails on 1 of 5 servers