From 55a7cf80a0769d38f03bd728717da855902041b1 Mon Sep 17 00:00:00 2001
From: Tom Lane
Date: Mon, 26 Mar 2007 16:58:41 +0000
Subject: Allow non-superuser database owners to create procedural languages. A
DBA is allowed to create a language in his database if it's marked
"tmpldbacreate" in pg_pltemplate. The factory default is that this is set
for all standard trusted languages, but of course a superuser may adjust the
settings. In service of this, add the long-foreseen owner column to
pg_language; renaming, dropping, and altering owner of a PL now follow normal
ownership rules instead of being superuser-only. Jeremy Drake, with some
editorialization by Tom Lane.
---
doc/src/sgml/catalogs.sgml | 17 +++++++++++++++--
doc/src/sgml/ref/alter_language.sgml | 19 +++++++++++++++----
doc/src/sgml/ref/create_language.sgml | 20 ++++++++++++++++----
doc/src/sgml/ref/drop_language.sgml | 6 ++++--
4 files changed, 50 insertions(+), 12 deletions(-)
(limited to 'doc/src')
diff --git a/doc/src/sgml/catalogs.sgml b/doc/src/sgml/catalogs.sgml
index d89cd8a4984..7d325d1dde5 100644
--- a/doc/src/sgml/catalogs.sgml
+++ b/doc/src/sgml/catalogs.sgml
@@ -1,4 +1,4 @@
-
+
@@ -2655,6 +2655,13 @@
Name of the language
+
+ lanowner
+ oid
+ pg_authid.oid
+ Owner of the language
+
+
lanisplbool
@@ -3265,7 +3272,7 @@
pg_pltemplate> Columns
-
+ Name
@@ -3287,6 +3294,12 @@
True if language is considered trusted
+
+ tmpldbacreate
+ boolean
+ True if language may be created by a database owner
+
+
tmplhandlertext
diff --git a/doc/src/sgml/ref/alter_language.sgml b/doc/src/sgml/ref/alter_language.sgml
index 9c336f163bf..e0cdb9d5a56 100644
--- a/doc/src/sgml/ref/alter_language.sgml
+++ b/doc/src/sgml/ref/alter_language.sgml
@@ -1,5 +1,5 @@
@@ -20,7 +20,8 @@ PostgreSQL documentation
-ALTER LANGUAGE name RENAME TO newname
+ALTER [ PROCEDURAL ] LANGUAGE name RENAME TO newname
+ALTER [ PROCEDURAL ] LANGUAGE name OWNER TO new_owner
@@ -29,8 +30,9 @@ ALTER LANGUAGE name RENAME TO newname
ALTER LANGUAGE changes the definition of a
- language. The only functionality is to rename the language. Only
- a superuser can rename languages.
+ procedural language. The only functionality is to rename the language or
+ assign a new owner. You must be superuser or owner of the language to
+ use ALTER LANGUAGE.
@@ -55,6 +57,15 @@ ALTER LANGUAGE name RENAME TO newname
+
+
+ new_owner
+
+
+ The new owner of the language
+
+
+
diff --git a/doc/src/sgml/ref/create_language.sgml b/doc/src/sgml/ref/create_language.sgml
index b09b38bee99..bb853feb19c 100644
--- a/doc/src/sgml/ref/create_language.sgml
+++ b/doc/src/sgml/ref/create_language.sgml
@@ -1,5 +1,5 @@
@@ -34,9 +34,7 @@ CREATE [ TRUSTED ] [ PROCEDURAL ] LANGUAGE name
PostgreSQL user can register a new
procedural language with a PostgreSQL
database. Subsequently, functions and trigger procedures can be
- defined in this new language. The user must have the
- PostgreSQL superuser privilege to
- register a new language.
+ defined in this new language.
@@ -64,6 +62,20 @@ CREATE [ TRUSTED ] [ PROCEDURAL ] LANGUAGE name
old dump files, which are likely to contain out-of-date information
about language support functions.
+
+
+ Ordinarily, the user must have the
+ PostgreSQL superuser privilege to
+ register a new language. However, the owner of a database can register
+ a new language within that database if the language is listed in
+ the pg_pltemplate catalog and is marked
+ as allowed to be created by database owners (tmpldbacreate>
+ is true). The default is that trusted languages can be created
+ by database owners, but this can be adjusted by superusers by modifying
+ the contents of pg_pltemplate.
+ The creator of a language becomes its owner and can later
+ drop it, rename it, or assign it to a new owner.
+
diff --git a/doc/src/sgml/ref/drop_language.sgml b/doc/src/sgml/ref/drop_language.sgml
index ad37287da67..1e3c960a720 100644
--- a/doc/src/sgml/ref/drop_language.sgml
+++ b/doc/src/sgml/ref/drop_language.sgml
@@ -1,5 +1,5 @@
@@ -31,6 +31,8 @@ DROP [ PROCEDURAL ] LANGUAGE [ IF EXISTS ] name
DROP LANGUAGE will remove the definition
of the previously registered procedural language called
name.
+ You must be superuser or owner of the language to
+ use DROP LANGUAGE.
@@ -43,7 +45,7 @@ DROP [ PROCEDURAL ] LANGUAGE [ IF EXISTS ] name
IF EXISTS
- Do not throw an error if the function does not exist. A notice is issued
+ Do not throw an error if the language does not exist. A notice is issued
in this case.
--
cgit v1.2.3