]> begriffs open source - ai-pg/blob - full-docs/txt/xfunc.txt
Convert HTML docs to more streamlined TXT
[ai-pg] / full-docs / txt / xfunc.txt
1
2 36.3. User-Defined Functions #
3
4    PostgreSQL provides four kinds of functions:
5      * query language functions (functions written in SQL) (Section 36.5)
6      * procedural language functions (functions written in, for example,
7        PL/pgSQL or PL/Tcl) (Section 36.8)
8      * internal functions (Section 36.9)
9      * C-language functions (Section 36.10)
10
11    Every kind of function can take base types, composite types, or
12    combinations of these as arguments (parameters). In addition, every
13    kind of function can return a base type or a composite type. Functions
14    can also be defined to return sets of base or composite values.
15
16    Many kinds of functions can take or return certain pseudo-types (such
17    as polymorphic types), but the available facilities vary. Consult the
18    description of each kind of function for more details.
19
20    It's easiest to define SQL functions, so we'll start by discussing
21    those. Most of the concepts presented for SQL functions will carry over
22    to the other types of functions.
23
24    Throughout this chapter, it can be useful to look at the reference page
25    of the CREATE FUNCTION command to understand the examples better. Some
26    examples from this chapter can be found in funcs.sql and funcs.c in the
27    src/tutorial directory in the PostgreSQL source distribution.