Removing WITH clause support in CREATE FUNCTION, for isCachable and isStrict
Michael Paquier <michael.paquier@gmail.com>
From: Michael Paquier <michael.paquier@gmail.com>
To: Postgres hackers <pgsql-hackers@postgresql.org>
Cc: daniel@yesql.se
Date: 2018-01-15T02:27:48Z
Lists: pgsql-hackers
Attachments
- 0001-Remove-support-for-WITH-clause-in-CREATE-FUNCTION.patch (text/x-diff) patch 0001
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
Commits
-
Remove the obsolete WITH clause of CREATE FUNCTION.
- 4971d2a32209 11.0 landed
-
Extend syntax of CREATE FUNCTION to resemble SQL99.
- 94bdc4855cf8 7.3.1 cited