pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Achilleas Mantzios <achill@matrix.gatewaynet.com>
To: pgsql-general@lists.postgresql.org
Subject: Re: A little RULE help?
Date: Wed, 31 Jan 2018 18:17:48 +0200
Message-ID: <37bb1acf-d4bb-0557-846e-11393645dd4d@matrix.gatewaynet.com> (raw)
In-Reply-To: <CAKFQuwY-nOhazBq-cXEqwtbp0K9zmNE8vhAJ7q2ypX4a8PN0_Q@mail.gmail.com>
References: <E9FA92C2921F31408041863B74EE4C2001A47847D0@CCPMAILDAG03.cantab.local>
	<a607457c-e7af-5b93-c0c5-444805318da2@commandprompt.com>
	<E9FA92C2921F31408041863B74EE4C2001A4784E8C@CCPMAILDAG03.cantab.local>
	<e104e516-70b7-d035-50fa-11fae18160aa@commandprompt.com>
	<E9FA92C2921F31408041863B74EE4C2001A478A720@CCPMAILDAG03.cantab.local>
	<4e9b5b67-8966-4dfb-dcf9-6023c3b8fff1@2ndquadrant.com>
	<E9FA92C2921F31408041863B74EE4C2001A47A36A0@CCPMAILDAG03.cantab.local>
	<CAKFQuwY-nOhazBq-cXEqwtbp0K9zmNE8vhAJ7q2ypX4a8PN0_Q@mail.gmail.com>

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 <mailto:Steven.Winfield@cantabcapital.com>>wrote:
>
>
>     Don't use RULEs.
>     -- 
>     Vik Fearing +33 6 46 75 15 36 <tel:+33%206%2046%2075%2015%2036>
>     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.​
>
> ​https://www.postgresql.org/docs/10/static/rules-triggers.html​
>
> 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

view thread (12+ messages)

Message-ID: <37bb1acf-d4bb-0557-846e-11393645dd4d@matrix.gatewaynet.com>
Permalink:  ../37bb1acf-d4bb-0557-846e-11393645dd4d@matrix.gatewaynet.com/
Also on:    postgresql.org/message-id/37bb1acf-d4bb-0557-846e-11393645dd4d@matrix.gatewaynet.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: achill@matrix.gatewaynet.com
  Subject: Re: A little RULE help?
  In-Reply-To: <37bb1acf-d4bb-0557-846e-11393645dd4d@matrix.gatewaynet.com>
  References: <E9FA92C2921F31408041863B74EE4C2001A47847D0@CCPMAILDAG03.cantab.local> <a607457c-e7af-5b93-c0c5-444805318da2@commandprompt.com> <E9FA92C2921F31408041863B74EE4C2001A4784E8C@CCPMAILDAG03.cantab.local> <e104e516-70b7-d035-50fa-11fae18160aa@commandprompt.com> <E9FA92C2921F31408041863B74EE4C2001A478A720@CCPMAILDAG03.cantab.local> <4e9b5b67-8966-4dfb-dcf9-6023c3b8fff1@2ndquadrant.com> <E9FA92C2921F31408041863B74EE4C2001A47A36A0@CCPMAILDAG03.cantab.local> <CAKFQuwY-nOhazBq-cXEqwtbp0K9zmNE8vhAJ7q2ypX4a8PN0_Q@mail.gmail.com> <37bb1acf-d4bb-0557-846e-11393645dd4d@matrix.gatewaynet.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox