Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
postgres-lambda-diff
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jakob Huber
postgres-lambda-diff
Commits
d859b17f
Commit
d859b17f
authored
15 years ago
by
Bruce Momjian
Browse files
Options
Downloads
Patches
Plain Diff
Restructure CREATE FUNCTION "NOTES" section to be shorter; move items
into proper sections, per suggestion from Tom.
parent
77e0d7b3
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
doc/src/sgml/ref/create_function.sgml
+58
-58
58 additions, 58 deletions
doc/src/sgml/ref/create_function.sgml
with
58 additions
and
58 deletions
doc/src/sgml/ref/create_function.sgml
+
58
−
58
View file @
d859b17f
<!--
<!--
$PostgreSQL: pgsql/doc/src/sgml/ref/create_function.sgml,v 1.9
1
2010/0
2/25 22:2
4:0
0
momjian Exp $
$PostgreSQL: pgsql/doc/src/sgml/ref/create_function.sgml,v 1.9
2
2010/0
3/03 03:1
4:0
8
momjian Exp $
-->
-->
<refentry id="SQL-CREATEFUNCTION">
<refentry id="SQL-CREATEFUNCTION">
...
@@ -46,6 +46,10 @@ CREATE [ OR REPLACE ] FUNCTION
...
@@ -46,6 +46,10 @@ CREATE [ OR REPLACE ] FUNCTION
<command>CREATE FUNCTION</command> defines a new function.
<command>CREATE FUNCTION</command> defines a new function.
<command>CREATE OR REPLACE FUNCTION</command> will either create a
<command>CREATE OR REPLACE FUNCTION</command> will either create a
new function, or replace an existing definition.
new function, or replace an existing definition.
To be able to define a function, the user must have the
<literal>USAGE</literal> privilege on the language.
</para>
</para>
</para>
<para>
<para>
...
@@ -69,6 +73,14 @@ CREATE [ OR REPLACE ] FUNCTION
...
@@ -69,6 +73,14 @@ CREATE [ OR REPLACE ] FUNCTION
<literal>OUT</> parameters except by dropping the function.)
<literal>OUT</> parameters except by dropping the function.)
</para>
</para>
<para>
When <command>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).
</para>
<para>
<para>
If you drop and then recreate a function, the new function is not
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,
the same entity as the old; you will have to drop existing rules, views,
...
@@ -400,6 +412,18 @@ CREATE [ OR REPLACE ] FUNCTION
...
@@ -400,6 +412,18 @@ CREATE [ OR REPLACE ] FUNCTION
the parameter as the value to be applied when the function is entered.
the parameter as the value to be applied when the function is entered.
</para>
</para>
<para>
If a <literal>SET</> clause is attached to a function, then
the effects of a <command>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
<command>SET</> command (without <literal>LOCAL</>) overrides the
<literal>SET</> clause, much as it would do for a previous <command>SET
LOCAL</> command: the effects of such a command will persist after
function exit, unless the current transaction is rolled back.
</para>
<para>
<para>
See <xref linkend="sql-set" endterm="sql-set-title"> and
See <xref linkend="sql-set" endterm="sql-set-title"> and
<xref linkend="runtime-config">
<xref linkend="runtime-config">
...
@@ -417,6 +441,15 @@ CREATE [ OR REPLACE ] FUNCTION
...
@@ -417,6 +441,15 @@ CREATE [ OR REPLACE ] FUNCTION
language. It can be an internal function name, the path to an
language. It can be an internal function name, the path to an
object file, an SQL command, or text in a procedural language.
object file, an SQL command, or text in a procedural language.
</para>
</para>
<para>
It is often helpful to use dollar quoting (see <xref
linkend="sql-syntax-dollar-quoting">) 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.
</para>
</listitem>
</listitem>
</varlistentry>
</varlistentry>
...
@@ -436,6 +469,14 @@ CREATE [ OR REPLACE ] FUNCTION
...
@@ -436,6 +469,14 @@ CREATE [ OR REPLACE ] FUNCTION
language source code. If the link symbol is omitted, it is assumed
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.
to be the same as the name of the SQL function being defined.
</para>
</para>
<para>
When repeated <command>CREATE FUNCTION</command> 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.
</para>
</listitem>
</listitem>
</varlistentry>
</varlistentry>
...
@@ -479,23 +520,13 @@ CREATE [ OR REPLACE ] FUNCTION
...
@@ -479,23 +520,13 @@ CREATE [ OR REPLACE ] FUNCTION
</refsect1>
</refsect1>
<refsect1 id="sql-createfunction-notes">
<para>
<title>Notes</title>
Refer to <xref linkend="xfunc"> for further information on writing
functions.
<para>
</para>
Refer to <xref linkend="xfunc"> for further information on writing
functions.
</para>
<para>
<refsect1 id="sql-createfunction-overloading">
The full <acronym>SQL</acronym> type syntax is allowed for
<title>Overloading</title>
input arguments and return value. However, some details of the
type specification (e.g., the precision field for
type <type>numeric</type>) are the responsibility of the
underlying function implementation and are silently swallowed
(i.e., not recognized or
enforced) by the <command>CREATE FUNCTION</command> command.
</para>
<para>
<para>
<productname>PostgreSQL</productname> allows function
<productname>PostgreSQL</productname> allows function
...
@@ -529,50 +560,19 @@ CREATE FUNCTION foo(int, int default 42) ...
...
@@ -529,50 +560,19 @@ CREATE FUNCTION foo(int, int default 42) ...
function should be called.
function should be called.
</para>
</para>
<para>
</refsect1>
When repeated <command>CREATE FUNCTION</command> 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.
</para>
<para>
Use <xref linkend="sql-dropfunction"
endterm="sql-dropfunction-title"> to remove user-defined
functions.
</para>
<para>
It is often helpful to use dollar quoting (see <xref
linkend="sql-syntax-dollar-quoting">) 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.
</para>
<para>
If a <literal>SET</> clause is attached to a function, then
the effects of a <command>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
<command>SET</> command (without <literal>LOCAL</>) overrides the
<literal>SET</> clause, much as it would do for a previous <command>SET
LOCAL</> command: the effects of such a command will persist after
function exit, unless the current transaction is rolled back.
</para>
<para>
<refsect1 id="sql-createfunction-notes">
To be able to define a function, the user must have the
<title>Notes</title>
<literal>USAGE</literal> privilege on the language.
</para>
<para>
<para>
When <command>CREATE OR REPLACE FUNCTION</> is used to replace an
The full <acronym>SQL</acronym> type syntax is allowed for
existing function, the ownership and permissions of the function
input arguments and return value. However, some details of the
do not change. All other function properties are assigned the
type specification (e.g., the precision field for
values specified or implied in the command. You must own the function
type <type>numeric</type>) are the responsibility of the
to replace it (this includes being a member of the owning role).
underlying function implementation and are silently swallowed
(i.e., not recognized or
enforced) by the <command>CREATE FUNCTION</command> command.
</para>
</para>
<para>
<para>
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment