Removing WITH clause support in CREATE FUNCTION, for isCachable andisStrict - Mailing list pgsql-hackers

From Michael Paquier
Subject Removing WITH clause support in CREATE FUNCTION, for isCachable andisStrict
Date
Msg-id 20180115022748.GB1724@paquier.xyz
Whole thread Raw
Responses Re: Removing WITH clause support in CREATE FUNCTION, for isCachable and isStrict
List pgsql-hackers
Hi all,

As noticed by Daniel here:
https://www.postgresql.org/message-id/D5F34C9D-3AB7-4419-AF2E-12F67581D71D@yesql.se

Using a WITH clause takes precendence over what is defined in the main
function definition when using isStrict and isCachable. For example,
when using VOLATILE and IMMUTABLE, an error is raised:
=# create function int42(cstring) returns int42 AS 'int4in'
   language internal strict immutable volatile;
ERROR:  42601: conflicting or redundant options
LINE 2:     language internal strict immutable volatile;

However when using for example STABLE/VOLATILE in combination with a
WITH clause, then things get prioritized, and in this case the WITH
clause values are taken into account:
=# create function int42(cstring) returns int42 AS 'int4in'
   language internal strict volatile with (isstrict, iscachable);
CREATE FUNCTION
=# select provolatile from pg_proc where proname = 'int42';
 provolatile
-------------
 i
(1 row)

This clause is marked as deprecated since 7.3, so perhaps it would be
time to remove completely its support? It seems to me that this leads to
more confusion than being helpful. And I have not found a trace of code
using those flags on github or such.

Thanks,
--
Michael

Attachment

pgsql-hackers by date:

Previous
From: Edmund Horner
Date:
Subject: Re: PATCH: psql tab completion for SELECT
Next
From: Stephen Frost
Date:
Subject: Re: [HACKERS] Useless code in ExecInitModifyTable