PostgreSQL 7.4beta4 Documentation
Prev | Fast Backward | Chapter 33. Extending SQL | Fast Forward | Next

# 33.3. User-Defined Functions

PostgreSQL provides four kinds of functions:

- query language functions (functions written in SQL) (Section 33.4)

- procedural language functions (functions written in, for example, PL/Tcl or PL/pgSQL) (Section 33.5)

- internal functions (Section 33.6)

- C-language functions (Section 33.7)

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.

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.

It's easiest to define SQL functions, so we'll start by discussing those.

Throughout this chapter, it can be useful to look at the reference page of the `CREATE FUNCTION` command to understand the examples better. Some examples from this chapter can be found in `funcs.sql` and `funcs.c` in the tutorial directory.

Prev | Home | Next
The PostgreSQL Type System | Up | Query Language (SQL) Functions