From: Bruce Momjian Date: Wed, 3 Mar 2010 03:14:08 +0000 (+0000) Subject: Restructure CREATE FUNCTION "NOTES" section to be shorter; move items X-Git-Tag: REL9_0_ALPHA5~143 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d859b17f0f262c39d9e1041bab75d34e0559e7e5;p=postgresql Restructure CREATE FUNCTION "NOTES" section to be shorter; move items into proper sections, per suggestion from Tom. --- diff --git a/doc/src/sgml/ref/create_function.sgml b/doc/src/sgml/ref/create_function.sgml index 3d7eadcaf8..258ef936ee 100644 --- a/doc/src/sgml/ref/create_function.sgml +++ b/doc/src/sgml/ref/create_function.sgml @@ -1,5 +1,5 @@ @@ -46,6 +46,10 @@ CREATE [ OR REPLACE ] FUNCTION CREATE FUNCTION defines a new function. CREATE OR REPLACE FUNCTION will either create a new function, or replace an existing definition. + To be able to define a function, the user must have the + USAGE privilege on the language. + + @@ -69,6 +73,14 @@ CREATE [ OR REPLACE ] FUNCTION OUT parameters except by dropping the function.) + + 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). + + If you drop and then recreate a function, the new function is not the same entity as the old; you will have to drop existing rules, views, @@ -400,6 +412,18 @@ CREATE [ OR REPLACE ] FUNCTION the parameter as the value to be applied when the function is entered. + + If a SET clause is attached to a function, then + the effects of a SET LOCAL command executed inside the + function for the same variable are restricted to the function: the + configuration parameter's prior value is still restored at function exit. + However, an ordinary + SET command (without LOCAL) overrides the + SET clause, much as it would do for a previous SET + LOCAL command: the effects of such a command will persist after + function exit, unless the current transaction is rolled back. + + See and @@ -417,6 +441,15 @@ CREATE [ OR REPLACE ] FUNCTION language. It can be an internal function name, the path to an object file, an SQL command, or text in a procedural language. + + + It is often helpful to use dollar quoting (see ) to write the function definition + string, rather than the normal single quote syntax. Without dollar + quoting, any single quotes or backslashes in the function definition must + be escaped by doubling them. + + @@ -436,6 +469,14 @@ CREATE [ OR REPLACE ] FUNCTION language source code. If the link symbol is omitted, it is assumed to be the same as the name of the SQL function being defined. + + + When repeated CREATE FUNCTION calls refer to + the same object file, the file is only loaded once per session. + To unload and + reload the file (perhaps during development), start a new session. + + @@ -479,23 +520,13 @@ CREATE [ OR REPLACE ] FUNCTION - - Notes - - - Refer to for further information on writing - functions. - + + Refer to for further information on writing + functions. + - - The full SQL type syntax is allowed for - input arguments and return value. However, some details of the - type specification (e.g., the precision field for - type numeric) are the responsibility of the - underlying function implementation and are silently swallowed - (i.e., not recognized or - enforced) by the CREATE FUNCTION command. - + + Overloading PostgreSQL allows function @@ -529,50 +560,19 @@ CREATE FUNCTION foo(int, int default 42) ... function should be called. - - When repeated CREATE FUNCTION calls refer to - the same object file, the file is only loaded once per session. - To unload and - reload the file (perhaps during development), start a new session. - - - - Use to remove user-defined - functions. - - - - It is often helpful to use dollar quoting (see ) to write the function definition - string, rather than the normal single quote syntax. Without dollar - quoting, any single quotes or backslashes in the function definition must - be escaped by doubling them. - - - - If a SET clause is attached to a function, then - the effects of a SET LOCAL command executed inside the - function for the same variable are restricted to the function: the - configuration parameter's prior value is still restored at function exit. - However, an ordinary - SET command (without LOCAL) overrides the - SET clause, much as it would do for a previous SET - LOCAL command: the effects of such a command will persist after - function exit, unless the current transaction is rolled back. - + - - To be able to define a function, the user must have the - USAGE privilege on the language. - + + Notes - 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). + The full SQL type syntax is allowed for + input arguments and return value. However, some details of the + type specification (e.g., the precision field for + type numeric) are the responsibility of the + underlying function implementation and are silently swallowed + (i.e., not recognized or + enforced) by the CREATE FUNCTION command.