Re: Error-safe user functions

From: Andres Freund <andres(at)anarazel(dot)de>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Corey Huinker <corey(dot)huinker(at)gmail(dot)com>, Andrew Dunstan <andrew(at)dunslane(dot)net>, 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 17:34:27
Message-ID: 20221207173427.7jmjd3fsfuydh6th@awork3.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On 2022-12-06 15:21:09 -0500, Tom Lane wrote:
> +{ oid => '8050', descr => 'test whether string is valid input for data type',
> + proname => 'pg_input_is_valid', provolatile => 's', prorettype => 'bool',
> + proargtypes => 'text regtype', prosrc => 'pg_input_is_valid' },
> +{ oid => '8051', descr => 'test whether string is valid input for data type',
> + proname => 'pg_input_is_valid', provolatile => 's', prorettype => 'bool',
> + proargtypes => 'text regtype int4', prosrc => 'pg_input_is_valid_mod' },
> +{ oid => '8052',
> + 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',
> + prosrc => 'pg_input_invalid_message' },
> +{ 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;

Greetings,

Andres Freund

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2022-12-07 17:44:39 Re: [PATCH] pg_dump: lock tables in batches
Previous Message Tom Lane 2022-12-07 17:28:03 Re: [PATCH] pg_dump: lock tables in batches