Re: Removing WITH clause support in CREATE FUNCTION, for isCachable and isStrict - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Removing WITH clause support in CREATE FUNCTION, for isCachable and isStrict
Date
Msg-id 11283.1516923004@sss.pgh.pa.us
Whole thread Raw
In response to Re: Removing WITH clause support in CREATE FUNCTION, for isCachable and isStrict  (Daniel Gustafsson <daniel@yesql.se>)
Responses Re: Removing WITH clause support in CREATE FUNCTION, for isCachableand isStrict
List pgsql-hackers
Daniel Gustafsson <daniel@yesql.se> writes:
>> On 15 Jan 2018, at 03:27, Michael Paquier <michael.paquier@gmail.com> wrote:
>> As noticed by Daniel here:
>> https://www.postgresql.org/message-id/D5F34C9D-3AB7-4419-AF2E-12F67581D71D@yesql.se

> In that thread I proposed a patch to fix this, but I certainly don’t object to
> just removing it to make both syntax and code clearer. +1

I poked into the git log and confirmed Michael's statement that
CREATE FUNCTION ... WITH has been documented as deprecated since
7.3 (commit 94bdc4855 to be exact).

I think the original intention was that we'd keep it for PG-specific
function attributes (ie those not found in the SQL spec), so as to
avoid creating keywords for every attribute we thought of.  That
intention has been roundly ignored since then, though, since COST
and ROWS and LEAKPROOF and PARALLEL (UN)SAFE have all been implemented
as separate keywords not WITH options.  I'm dubious that that was a good
plan, but it's probably too late to change direction now.

The only other argument I can see for keeping it is that pre-7.3
dump files could contain CREATE FUNCTION commands with the old
spelling.  But, even assuming somebody is still running <= 7.2
and wants to migrate to >= 11 in one jump, they could use some
intermediate version of pg_dump to produce a dump with the modern
spelling, or just whip out their trusty text editor.  Maintaining
backwards compatibility is good, but 15 years seems like enough.

In short, I'm on board with removing the WITH clause.  I've not
reviewed the patch in detail, but will do so and push it if there's
not objections pretty soon.

            regards, tom lane


pgsql-hackers by date:

Previous
From: Daniel Gustafsson
Date:
Subject: Re: [HACKERS] GnuTLS support
Next
From: Thomas Munro
Date:
Subject: Documentation of pgcrypto AES key sizes