From 9b5ac366f922cee5bbb73180fe400dffb5c13136 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Fri, 2 Oct 2009 18:13:26 +0000 Subject: Fix erroneous handling of shared dependencies (ie dependencies on roles) in CREATE OR REPLACE FUNCTION. The original code would update pg_shdepend as if a new function was being created, even if it wasn't, with two bad consequences: pg_shdepend might record the wrong owner for the function, and any dependencies for roles mentioned in the function's ACL would be lost. The fix is very easy: just don't touch pg_shdepend at all when doing a function replacement. Also update the CREATE FUNCTION reference page, which never explained exactly what changes and doesn't change in a function replacement. In passing, fix the CREATE VIEW reference page similarly; there's no code bug there, but the docs didn't say what happens. --- doc/src/sgml/ref/create_function.sgml | 10 +++++++++- doc/src/sgml/ref/create_view.sgml | 10 +++++++++- 2 files changed, 18 insertions(+), 2 deletions(-) (limited to 'doc/src') diff --git a/doc/src/sgml/ref/create_function.sgml b/doc/src/sgml/ref/create_function.sgml index 56719b44d18..5f207c7dd27 100644 --- a/doc/src/sgml/ref/create_function.sgml +++ b/doc/src/sgml/ref/create_function.sgml @@ -1,5 +1,5 @@ @@ -424,6 +424,14 @@ CREATE FUNCTION foo(int, out text) ... USAGE privilege on the language. + + 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). + + diff --git a/doc/src/sgml/ref/create_view.sgml b/doc/src/sgml/ref/create_view.sgml index f6e75ce3e2a..dcc6a023d82 100644 --- a/doc/src/sgml/ref/create_view.sgml +++ b/doc/src/sgml/ref/create_view.sgml @@ -1,5 +1,5 @@ @@ -146,6 +146,14 @@ CREATE VIEW vista AS SELECT text 'Hello World' AS hello; used by the view. + + When CREATE OR REPLACE VIEW is used on an + existing view, only the view's defining SELECT rule is changed. + Other view properties, including ownership, permissions, and non-SELECT + rules, remain unchanged. You must own the view + to replace it (this includes being a member of the owning role). + + -- cgit v1.2.3