Re: Accidentally parallel unsafe functions - Mailing list pgsql-hackers

From Andreas Karlsson
Subject Re: Accidentally parallel unsafe functions
Date
Msg-id 5723EF34.80802@proxel.se
Whole thread Raw
In response to Re: Accidentally parallel unsafe functions  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
On 04/30/2016 01:19 AM, Tom Lane wrote:
> Alvaro Herrera <alvherre@2ndquadrant.com> writes:
>> Surely CREATE OR REPLACE should keep whatever the flag was, rather than
>> ovewrite it with a bogus value if not specified?  In other words IMO the
>> CREATE OR REPLACE code needs changing, not system_views.sql.
>
> Absolutely not!  The definition of CREATE OR REPLACE is that at the end,
> the state of the object is predictable from only what the command says.
> This is not open for renegotiation.

An example to support Tom is that it already works like the for other 
options.

postgres=# CREATE FUNCTION f() RETURNS int LANGUAGE sql AS $$ SELECT 1 
$$ SECURITY DEFINER;
CREATE FUNCTION
postgres=# SELECT pg_get_functiondef('f'::regproc);          pg_get_functiondef
--------------------------------------- CREATE OR REPLACE FUNCTION public.f()+  RETURNS integer                     +
LANGUAGEsql                        +  SECURITY DEFINER                    + AS $function$ SELECT 1 $function$    +
 

(1 row)

postgres=# CREATE OR REPLACE FUNCTION f() RETURNS int LANGUAGE sql AS $$ 
SELECT 1 $$;
CREATE FUNCTION
postgres=# SELECT pg_get_functiondef('f'::regproc);          pg_get_functiondef
--------------------------------------- CREATE OR REPLACE FUNCTION public.f()+  RETURNS integer                     +
LANGUAGEsql                        + AS $function$ SELECT 1 $function$    +
 

(1 row)

Andreas



pgsql-hackers by date:

Previous
From: "David G. Johnston"
Date:
Subject: Re: Accidentally parallel unsafe functions
Next
From: Andres Freund
Date:
Subject: Re: [BUGS] Breakage with VACUUM ANALYSE + partitions