From: | "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, Andreas Karlsson <andreas(at)proxel(dot)se>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Accidentally parallel unsafe functions |
Date: | 2016-04-29 23:31:31 |
Message-ID: | CAKFQuwYyd6cOzbBjfgWg+wx_HSjGOCekHNnb8=DKsD0CouwkXw@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Fri, Apr 29, 2016 at 4:19 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Alvaro Herrera <alvherre(at)2ndquadrant(dot)com> writes:
> > Andreas Karlsson wrote:
> >> I am currently looking into adding the correct parallel options to all
> >> functions in the extensions and I noticed that some built-in functions
> seems
> >> to have been marked as unsafe by accident. The main culprit is
> >> system_views.sql which redefines these functions and removes the
> parallel
> >> safe flag.
>
> > 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.
>
To whit:
http://www.postgresql.org/docs/current/static/sql-createfunction.html
"""
When CREATE OR REPLACE FUNCTION is used to replace an existing function,
the ownership and permissions of the function do not change. All other
function properties are assigned the values specified or implied in the
command. You must own the function to replace it (this includes being a
member of the owning role).
"""
I'd interpret "specified or implied in the command" to mean exactly what
Tom said - and it applies to "all [other] function properties".
The ownership bit is a nice side-effect since you can use superuser to
replace existing functions that are already owned by another user. Those
are the only implied dynamic of function creation that exists within the
CREATE FUNCTION command - everything else is contained within the CREATE
FUNCTION DDL.
David J.
From | Date | Subject | |
---|---|---|---|
Next Message | Andreas Karlsson | 2016-04-29 23:33:08 | Re: Accidentally parallel unsafe functions |
Previous Message | Tom Lane | 2016-04-29 23:19:46 | Re: Accidentally parallel unsafe functions |