Re: Error-safe user functions - Mailing list pgsql-hackers

From David G. Johnston
Subject Re: Error-safe user functions
Date
Msg-id CAKFQuwYEBZw5UrPSa6U5=A+a82dagAYBfoZLYb4CuBxbE1vTmA@mail.gmail.com
Whole thread Raw
In response to Re: Error-safe user functions  (Andres Freund <andres@anarazel.de>)
List pgsql-hackers
On Wed, Dec 7, 2022 at 10:34 AM Andres Freund <andres@anarazel.de> wrote:
> +{ oid => '8053',
> +  descr => 'get error message if string is not valid input for data type',
> +  proname => 'pg_input_invalid_message', provolatile => 's',
> +  prorettype => 'text', proargtypes => 'text regtype int4',
> +  prosrc => 'pg_input_invalid_message_mod' },
> +

Is there a guarantee that input functions are stable or immutable? We don't
have any volatile input functions in core PG:

SELECT provolatile, count(*) FROM pg_proc WHERE oid IN (SELECT typinput FROM pg_type) GROUP BY provolatile;


Effectively yes, though I'm not sure if it is formally documented or otherwise enforced by the system.

The fact we allow stable is a bit of a sore spot, volatile would be a terrible property for an I/O function.

David J.

pgsql-hackers by date:

Previous
From: Andres Freund
Date:
Subject: Re: [PATCH] pg_dump: lock tables in batches
Next
From: Andres Freund
Date:
Subject: Re: XID formatting and SLRU refactorings (was: Add 64-bit XIDs into PostgreSQL 15)