# Пользовательские функции

В PostgreSQL представлены функции четырёх видов (подробнее про функции можно почитать по [ссылке](https://postgrespro.ru/docs/enterprise/15/xfunc)), но мы в проектах используем только два:

* [функции на языке запросов (SQL)](/wt-knowledge-base/sql/custom-functions/sql-functions.md)
* [функции на процедурных языках (PL/pgSQL)](/wt-knowledge-base/sql/custom-functions/pl-functions.md)

Функции любых видов могут принимать в качестве аргументов базовые типы, составные типы или их сочетания. Кроме того, функции могут возвращать значения базового или составного типа. Также можно определить функции, возвращающие наборы базовых или составных значений.

Проще всего определить функции на языке SQL, поэтому сначала мы рассмотрим их. Многие концепции, касающиеся функций на SQL, затем распространятся и на другие виды функций.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://wfsys.gitbook.io/wt-knowledge-base/sql/custom-functions.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
