[prev in list] [next in list] [prev in thread] [next in thread] 

List:       postgresql-general
Subject:    Re: [HACKERS] Accidentally parallel unsafe functions
From:       Andreas Karlsson <andreas () proxel ! se>
Date:       2016-04-29 23:33:08
Message-ID: 5723EF34.80802 () proxel ! se
[Download RAW message or body]

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                     +
   LANGUAGE sql                        +
   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                     +
   LANGUAGE sql                        +
  AS $function$ SELECT 1 $function$    +

(1 row)

Andreas


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic