gooderp18绿色标准版
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

42 lines
4.7KB

  1. <?xml version="1.0" encoding="UTF-8" standalone="no"?>
  2. <!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>
  3. <span class="productname">PostgreSQL</span> provides four kinds of
  4. functions:
  5. </p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
  6. query language functions (functions written in
  7. <acronym class="acronym">SQL</acronym>) (<a class="xref" href="xfunc-sql.html" title="37.5. Query Language (SQL) Functions">Section 37.5</a>)
  8. </p></li><li class="listitem"><p>
  9. procedural language functions (functions written in, for
  10. example, <span class="application">PL/pgSQL</span> or <span class="application">PL/Tcl</span>)
  11. (<a class="xref" href="xfunc-pl.html" title="37.8. Procedural Language Functions">Section 37.8</a>)
  12. </p></li><li class="listitem"><p>
  13. internal functions (<a class="xref" href="xfunc-internal.html" title="37.9. Internal Functions">Section 37.9</a>)
  14. </p></li><li class="listitem"><p>
  15. C-language functions (<a class="xref" href="xfunc-c.html" title="37.10. C-Language Functions">Section 37.10</a>)
  16. </p></li></ul></div><p>
  17. </p><p>
  18. Every kind
  19. of function can take base types, composite types, or
  20. combinations of these as arguments (parameters). In addition,
  21. every kind of function can return a base type or
  22. a composite type. Functions can also be defined to return
  23. sets of base or composite values.
  24. </p><p>
  25. Many kinds of functions can take or return certain pseudo-types
  26. (such as polymorphic types), but the available facilities vary.
  27. Consult the description of each kind of function for more details.
  28. </p><p>
  29. It's easiest to define <acronym class="acronym">SQL</acronym>
  30. functions, so we'll start by discussing those.
  31. Most of the concepts presented for <acronym class="acronym">SQL</acronym> functions
  32. will carry over to the other types of functions.
  33. </p><p>
  34. Throughout this chapter, it can be useful to look at the reference
  35. page of the <a class="xref" href="sql-createfunction.html" title="CREATE FUNCTION"><span class="refentrytitle">CREATE FUNCTION</span></a> command to
  36. understand the examples better. Some examples from this chapter
  37. can be found in <code class="filename">funcs.sql</code> and
  38. <code class="filename">funcs.c</code> in the <code class="filename">src/tutorial</code>
  39. directory in the <span class="productname">PostgreSQL</span> source
  40. distribution.
  41. </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>
上海开阖软件有限公司 沪ICP备12045867号-1