Re: Accidentally parallel unsafe functions

From: Andreas Karlsson <andreas(at)proxel(dot)se>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Accidentally parallel unsafe functions
Date: 2016-04-29 23:33:08
Message-ID: 5723EF34.80802@proxel.se
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 04/30/2016 01:19 AM, Tom Lane wrote:
> Alvaro Herrera <alvherre(at)2ndquadrant(dot)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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2016-04-29 23:58:37 Re: [BUGS] Breakage with VACUUM ANALYSE + partitions
Previous Message David G. Johnston 2016-04-29 23:31:31 Re: Accidentally parallel unsafe functions