Re: A little RULE help? - Mailing list pgsql-general

From Achilleas Mantzios
Subject Re: A little RULE help?
Date
Msg-id 37bb1acf-d4bb-0557-846e-11393645dd4d@matrix.gatewaynet.com
Whole thread Raw
In response to Re: A little RULE help?  ("David G. Johnston" <david.g.johnston@gmail.com>)
List pgsql-general
On 31/01/2018 18:02, David G. Johnston wrote:
On Wed, Jan 31, 2018 at 8:39 AM, Steven Winfield <Steven.Winfield@cantabcapital.com> wrote:


Don't use RULEs.
--
Vik Fearing +33 6 46 75 15 36
http://2ndQuadrant.fr PostgreSQL : Expertise, Formation et Support

 

 

Repeating this, as if I should already know this, is less helpful though. It’s not as if the docs tells users to steer clear of RULEs.

If there is something I don’t understand, such as RULEs, I prefer to experiment with it and ask questions if there is something I still don’t follow. I thought this was the correct forum for those questions.

 


​The docs do suggest that rules are more difficult to do correctly.​

Few people use them which means they generally get less exposure to a variety of circumstances during feature testing and use and the long-term maintenance dynamics are larger.

That all said, if you can justify your use of them in a particular context you should probably just ignore those saying not to use them without the same knowledge of your situation.  The reward may be worth the risk/cost but the people yelling out for you to be careful are not doing so for the fun of it.  You should at least heed it to the point of saying, "yes, I'm sure I want to do this".

We have used RULEs to handle insertions / deletions from non-trivial views. And I can give this example if anyone wants.

Also we have used views to ignite smth like :
CREATE RULE account_credit_ins AS
    ON INSERT TO account_credit DO INSTEAD  SELECT public.rule_disable('INSERT'::text) AS rule_disable;
where rule_disable is a function that just raises an exception with some diagnostic text.

We dont make heavey use of RULEs, but I think they have their place.


David J.


-- 
Achilleas Mantzios
IT DEV Lead
IT DEPT
Dynacom Tankers Mgmt

pgsql-general by date:

Previous
From: "David G. Johnston"
Date:
Subject: Re: A little RULE help?
Next
From: Thiemo Kellner
Date:
Subject: Re: [solved] Setting up streaming replication problems