Removing WITH clause support in CREATE FUNCTION, for isCachable and isStrict

From: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
To: Postgres hackers <pgsql-hackers(at)postgresql(dot)org>
Cc: daniel(at)yesql(dot)se
Subject: Removing WITH clause support in CREATE FUNCTION, for isCachable and isStrict
Date: 2018-01-15 02:27:48
Message-ID: 20180115022748.GB1724@paquier.xyz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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 Content-Type Size
0001-Remove-support-for-WITH-clause-in-CREATE-FUNCTION.patch text/x-diff 8.1 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Stephen Frost 2018-01-15 02:28:18 Re: [HACKERS] Useless code in ExecInitModifyTable
Previous Message Edmund Horner 2018-01-15 01:44:01 Re: PATCH: psql tab completion for SELECT