> ## Documentation Index
> Fetch the complete documentation index at: https://docs.formal.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# SQL functions

> Categories the SQL parser attaches to every function it recognizes, used by Rego policies that branch on column.in_functions[].categories.

## OverviewThe Formal SQL parser tags every column reference with the list of
functions it passes through (`column.in_functions` in policy input).
Each function carries one or more **categories** sourced from the
catalogues below, so policies can branch on category instead of name.The catalogue is split per dialect: a single `Common` file holds names
shared across every supported dialect with the same meaning, and each
technology has its own file for entries that are dialect-specific or
have a different interpretation in that dialect.There are **845** entries across all dialects.## How policies use thisRead the categories off `column.in_functions[].categories` in Rego.
For example, aggregates are a common way to slip past row limits and rate limits by packing many rows into one cell. Hashing aggregated columns closes that gap:```rego theme={"languages":{"custom":["/languages/cel.json","/languages/rego.json"]}}
package formal.v2

import future.keywords.if
import future.keywords.in

in_aggregate(column) if {
  some func in column.in_functions
  "aggregate" in func.categories
}

response := {
  "action": "mask",
  "type": "hash.no_salt",
  "columns": columns,
} if {
  columns := [c |
    c := input.row[_]
    in_aggregate(c)
  ]
  columns != []
}
```## CategoriesEach function is tagged with one or more **categories**, organized in two
groups.### Shape categoriesDescribes how the function participates in SQL evaluation. Every
catalogued function carries at least one shape category.| Category | Definition |
| - | - |
| `scalar` | Operates on individual values: one input row produces one output value. The default shape for non-aggregate, non-window functions. |
| `aggregate` | Reduces multiple input rows to a single output value (`SUM`, `COUNT`, `STRING_AGG`, `ARRAY_AGG`). |
| `window` | Computes a value per row using a window of related rows, typically with an `OVER` clause (`ROW_NUMBER`, `LAG`, `RANK`). |
| `table` | Returns a set of rows; called in a `FROM` clause (`UNNEST`, `GENERATE_SUBSCRIPTS`, `JSON_TABLE`). |### Domain categoriesDescribes the kind of data the function operates on or returns. A
function can have zero, one, or several domain categories.| Category | Definition |
| - | - |
| `numeric` | Produces or operates on numeric values (`ABS`, `ROUND`, `SQRT`, `MOD`). |
| `string_and_binary` | Operates on character strings or byte strings (`CONCAT`, `SUBSTRING`, `REGEXP_REPLACE`, `HEX`). |
| `date_time` | Operates on date, time, or timestamp values (`EXTRACT`, `DATE_PART`, `AGE`, `DATE_FORMAT`). |
| `conditional` | Returns one of several values based on a condition (`CASE`, `COALESCE`, `NULLIF`, `IFNULL`). |
| `conversion` | Coerces a value from one type to another (`CAST`, `TO_DATE`, `CONVERT`, `INET_ATON`). |
| `bitwise` | Operates on bit-level representations (`BITAND`, `BITOR`, `BITXOR`). |
| `hash` | Computes a hash digest of its input (`MD5`, `SHA1`, `SHA2`, Snowflake `HASH`). |
| `encryption` | Encrypts or decrypts data (`AES_ENCRYPT`, `AES_DECRYPT`, Snowflake `ENCRYPT`). |
| `semi_structured` | Operates on nested formats: JSON, JSONB, VARIANT, OBJECT, ARRAY, XML. |
| `geospatial` | Operates on geographic or geometric values (Snowflake `ST_*`). |
| `vector_similarity` | Computes similarity or distance between vectors (Snowflake `VECTOR_*`). |
| `file` | Operates on staged-file references (Snowflake `FL_*`, `BUILD_*_FILE_URL`). |
| `context` | Returns information about the current session, user, role, database, or transaction (`CURRENT_USER`, `CURRENT_TIMESTAMP`). |
| `metadata` | Returns metadata about database objects (Snowflake `GET_DDL`, `GENERATE_COLUMN_DESCRIPTION`). |
| `notification` | Used for messaging integrations (Snowflake `EMAIL_INTEGRATION_CONFIG`, `TEXT_PLAIN`). |
| `system` | Engine-level operations exposed as functions (`BENCHMARK`, `SLEEP`, `EXPLAIN_JSON`, Snowflake `SYSTEM$*`). |
| `data_generation` | Generates random or sequence values (`RANDOM`, `UUID_STRING`, `RANDOM_BYTES`). |
| `locking` | Manages explicit advisory locks (MySQL `GET_LOCK`, `RELEASE_LOCK`). |
| `differential_privacy` | Differential-privacy operations (Snowflake `ESTIMATE_REMAINING_DP_AGGREGATES`). |## CatalogueFor canonical upstream documentation see [Snowflake](https://docs.snowflake.com/en/sql-reference/functions-all), [PostgreSQL / Redshift](https://www.postgresql.org/docs/current/functions.html), and [MySQL / MariaDB](https://dev.mysql.com/doc/refman/8.0/en/built-in-function-reference.html).Use the search box to find a function by name, and click category pills
to narrow the list to entries that carry the selected categories.

Filter by source:


      
      

Filter by category (must match all selected):


      
      

Showing  of


      \<table><thead><tr><th>Function</th>
            \<th>Categories</th>
            \<th>Source</th></tr></thead>
        \<tbody /></table>



## Related topics

- [Policy Evaluation](https://docs.formal.ai/docs/guides/policies/evaluation.md)
- [Rego Built-in Functions](https://docs.formal.ai/docs/guides/policies/rego-builtins.md)
- [ClickHouse](https://docs.formal.ai/docs/guides/core-concepts/resources/clickhouse.md)
- [Dial Configuration](https://docs.formal.ai/docs/guides/core-concepts/resources/dial.md)
- [Log Schemas](https://docs.formal.ai/docs/guides/observability/log-schemas.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.