PostgreSQL
PrevNext

Chapter 31. Extending SQL: Functions

Table of Contents
Query Language (SQL) Functions
Programming Language Functions

As it turns out, part of defining a new type is the definition of functions that describe its behavior. Consequently, while it is possible to define a new function without defining a new type, the reverse is not true. We therefore describe how to add new functions to Postgres before describing how to add new types. Postgres SQL provides two types of functions: query language functions (functions written in SQL and programming language functions (functions written in a compiled programming language such as C.) Either kind of function can take a base type, a composite type or some combination as arguments (parameters). In addition, both kinds of functions can return a base type or a composite type. It's easier to define SQL functions, so we'll start with those. Examples in this section can also be found in funcs.sql and C-code/funcs.c.


PrevHomeNext
About the Postgres System CatalogsUpQuery Language (SQL) Functions