|
- <?xml version="1.0" encoding="UTF-8" standalone="no"?>
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>37.3. User-Defined Functions</title><link rel="stylesheet" type="text/css" href="stylesheet.css" /><link rev="made" href="pgsql-docs@lists.postgresql.org" /><meta name="generator" content="DocBook XSL Stylesheets V1.79.1" /><link rel="prev" href="extend-type-system.html" title="37.2. The PostgreSQL Type System" /><link rel="next" href="xproc.html" title="37.4. User-Defined Procedures" /></head><body><div xmlns="http://www.w3.org/TR/xhtml1/transitional" class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="5" align="center">37.3. User-Defined Functions</th></tr><tr><td width="10%" align="left"><a accesskey="p" href="extend-type-system.html" title="37.2. The PostgreSQL Type System">Prev</a> </td><td width="10%" align="left"><a accesskey="u" href="extend.html" title="Chapter 37. Extending SQL">Up</a></td><th width="60%" align="center">Chapter 37. Extending <acronym xmlns="http://www.w3.org/1999/xhtml" class="acronym">SQL</acronym></th><td width="10%" align="right"><a accesskey="h" href="index.html" title="PostgreSQL 12.4 Documentation">Home</a></td><td width="10%" align="right"> <a accesskey="n" href="xproc.html" title="37.4. User-Defined Procedures">Next</a></td></tr></table><hr></hr></div><div class="sect1" id="XFUNC"><div class="titlepage"><div><div><h2 class="title" style="clear: both">37.3. User-Defined Functions</h2></div></div></div><a id="id-1.8.3.6.2" class="indexterm"></a><p>
- <span class="productname">PostgreSQL</span> provides four kinds of
- functions:
-
- </p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
- query language functions (functions written in
- <acronym class="acronym">SQL</acronym>) (<a class="xref" href="xfunc-sql.html" title="37.5. Query Language (SQL) Functions">Section 37.5</a>)
- </p></li><li class="listitem"><p>
- procedural language functions (functions written in, for
- example, <span class="application">PL/pgSQL</span> or <span class="application">PL/Tcl</span>)
- (<a class="xref" href="xfunc-pl.html" title="37.8. Procedural Language Functions">Section 37.8</a>)
- </p></li><li class="listitem"><p>
- internal functions (<a class="xref" href="xfunc-internal.html" title="37.9. Internal Functions">Section 37.9</a>)
- </p></li><li class="listitem"><p>
- C-language functions (<a class="xref" href="xfunc-c.html" title="37.10. C-Language Functions">Section 37.10</a>)
- </p></li></ul></div><p>
- </p><p>
- Every kind
- of function can take base types, composite types, or
- combinations of these as arguments (parameters). In addition,
- every kind of function can return a base type or
- a composite type. Functions can also be defined to return
- sets of base or composite values.
- </p><p>
- Many kinds of functions can take or return certain pseudo-types
- (such as polymorphic types), but the available facilities vary.
- Consult the description of each kind of function for more details.
- </p><p>
- It's easiest to define <acronym class="acronym">SQL</acronym>
- functions, so we'll start by discussing those.
- Most of the concepts presented for <acronym class="acronym">SQL</acronym> functions
- will carry over to the other types of functions.
- </p><p>
- Throughout this chapter, it can be useful to look at the reference
- page of the <a class="xref" href="sql-createfunction.html" title="CREATE FUNCTION"><span class="refentrytitle">CREATE FUNCTION</span></a> command to
- understand the examples better. Some examples from this chapter
- can be found in <code class="filename">funcs.sql</code> and
- <code class="filename">funcs.c</code> in the <code class="filename">src/tutorial</code>
- directory in the <span class="productname">PostgreSQL</span> source
- distribution.
- </p></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="extend-type-system.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="extend.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="xproc.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">37.2. The <span class="productname">PostgreSQL</span> Type System </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> 37.4. User-Defined Procedures</td></tr></table></div></body></html>
|