Re: Conditional INSERT

From: Ken Tanzer <ken(dot)tanzer(at)gmail(dot)com>
To: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
Cc: basti <mailinglist(at)unix-solution(dot)de>, "pgsql-generallists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: Conditional INSERT
Date: 2019-03-16 00:19:38
Message-ID: CAD3a31WC87GcxV=_cJwzoppCjzAe61CZh5XDf5J-xOSi8m4sXw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Fri, Mar 15, 2019 at 4:42 PM Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
wrote:

> > Just curious, but wanted to follow up on whether rules are
> > across-the-board discouraged? I've seen disparaging comments about
> > them, but I don't see any indication of that on the create rule page.
>
> See here:
> https://www.postgresql-archive.org/Deprecating-RULES-td5727689.html
>
> The rumor crops periodically that they will be deprecated. I personally
> do not see that happening any time soon.
>
> My issue with rules is this:
>
> https://www.postgresql.org/docs/11/rules.html
>
> If you can understand what really goes on in the above you are ahead of
> me. Given that my experience is that they do the unexpected as often as
> the expected so I stay away from them. Triggers I understand even when
> they error, which is the important part.
>
> OK, and thanks for the info. I've gleaned that rules are not "deprecated"
in the sense that they are slated for removal, but they are rather
discouraged. Since that's the case, wouldn't it make sense to warn users
about this? That might keep them away from rules, and ease any eventual
deprecation/transition issues you might have by lowering the number of
"rules" in the wild.

In the section on "Rules vs. Triggers" (41.7), it doesn't even hint at
this, and even says:

*"For the things that can be implemented by both, which is best depends on
the usage of the database."*

There _is_ a nice CAUTION box in 41.4 ("Rules on Insert, Update and
Delete"). I would suggest that something like that should go into Rules
vs. Triggers, and then have a short caution box at the top of perhaps every
Rule page (or at the very least for "CREATE RULE") that says something like
"Rules are discouraged. You may be better off with Triggers instead. See
<rules_v_triggers>."

Just my two cents, but that might help more people be aware of the issue
and avoid rules altogether.

Cheers,
Ken

> >
> > --
> > AGENCY Software
> > A Free Software data system
> > By and for non-profits
> > /http://agency-software.org//
> > /https://demo.agency-software.org/client/
> > ken(dot)tanzer(at)agency-software(dot)org <mailto:ken(dot)tanzer(at)agency-software(dot)org>
> > (253) 245-3801
> >
> > Subscribe to the mailing list
> > <mailto:agency-general-request(at)lists(dot)sourceforge(dot)net?body=subscribe> to
> > learn more about AGENCY or
> > follow the discussion.
>
>
> --
> Adrian Klaver
> adrian(dot)klaver(at)aklaver(dot)com
>

--
AGENCY Software
A Free Software data system
By and for non-profits
*http://agency-software.org/ <http://agency-software.org/>*
*https://demo.agency-software.org/client
<https://demo.agency-software.org/client>*
ken(dot)tanzer(at)agency-software(dot)org
(253) 245-3801

Subscribe to the mailing list
<agency-general-request(at)lists(dot)sourceforge(dot)net?body=subscribe> to
learn more about AGENCY or
follow the discussion.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Adrian Klaver 2019-03-16 00:41:20 Re: Conditional INSERT
Previous Message Adrian Klaver 2019-03-15 23:44:27 Re: Permission Read Only User