Re: Error-safe user functions

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Andrew Dunstan <andrew(at)dunslane(dot)net>, Corey Huinker <corey(dot)huinker(at)gmail(dot)com>, Andres Freund <andres(at)anarazel(dot)de>, Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>, Joe Conway <mail(at)joeconway(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, Nikita Glukhov <n(dot)gluhov(at)postgrespro(dot)ru>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Error-safe user functions
Date: 2022-12-07 16:15:31
Message-ID: CAKFQuwaEvXTNxS5RHmMkvr9nJELaz51VkrEN4XsPFGHd5vwe3g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Dec 7, 2022 at 9:06 AM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:

> "David G. Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com> writes:
> > Why not do away with two separate functions and define a composite type
> > (boolean, text) for is_valid to return?
>
> I don't see any advantage to that. It would be harder to use in both
> use-cases.
>

I don't really see a use case for either of them individually. If all you
are doing is printing them out in a test and checking the result in what
situation wouldn't you want to check that both the true/false and message
are as expected? Plus, you don't have to figure out a name for the second
function.

>
> >> BTW, does anyone else agree that 9.26 is desperately in need of some
> >> <sect2> subdivisions? It seems to have gotten a lot longer since
> >> I looked at it last.
>
> > I'd be inclined to do something like what we are attempting for Chapter
> 28
> > Monitoring Database Activity; introduce pagination through refentry and
> > build our own table of contents into it.
>
> I'd prefer to follow the model that already exists in 9.27,
> ie break it up with <sect2>'s, which provide a handy
> sub-table-of-contents.
>
>
I have a bigger issue with the non-pagination myself; the extra bit of
effort to manually create a tabular ToC (where we can add descriptions)
seems like a worthy price to pay.

Are you suggesting we should not go down the path that v8-0003 does in the
monitoring section cleanup thread? I find the usability of Chapter 54
System Views to be superior to these two run-on chapters and would rather
we emulate it in both these places - for what is in the end very little
additional effort, all mechanical in nature.

David J.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message David G. Johnston 2022-12-07 16:26:12 Re: [DOCS] Stats views and functions not in order?
Previous Message Peter Eisentraut 2022-12-07 16:11:52 Re: Think-o in foreign key comments