From: | "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com> |
---|---|
To: | Alexander Farber <alexander(dot)farber(at)gmail(dot)com> |
Cc: | pgsql-general <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: How to ensure that a stored function always returns TRUE or FALSE? |
Date: | 2016-03-02 16:08:30 |
Message-ID: | CAKFQuwbsB2g3LD=JUgZsdS10MY=u4zX0r4i=maVFw8+K5MeaXw@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Wed, Mar 2, 2016 at 5:39 AM, Alexander Farber <alexander(dot)farber(at)gmail(dot)com
> wrote:
> Thanks Vitaly, but instead of inverting the IF-condition I would prefer to
> make my function more robust, since it is kind of security-related and I
> might forget about the special IF-condition later when using it elsewhere...
>
>
Merlin's point about inlining and SQL language functions not withstanding:
You should consider writing a variation of the check_user function that
returns VOID or raises an exception and use is like an assertion.
I would consider raising an exception if in_auth is NULL as I'd
potentially consider such a situation to represent mis-usage of the
function which should gets it own error instead of simply indicating that
the validation failed.
David J.
From | Date | Subject | |
---|---|---|---|
Next Message | Rémi Cura | 2016-03-02 16:49:12 | Re: bloated postgres data folder, clean up |
Previous Message | Vitaly Burovoy | 2016-03-02 15:55:36 | Re: How to ensure that a stored function always returns TRUE or FALSE? |