# Postgres functions

Get started with commonly-used Postgres functions with Neon's function guides. For other functions that Postgres supports, visit the official Postgres [Functions and Operators](https://www.postgresql.org/docs/current/functions.html) documentation.

## Aggregate functions

- [array\_agg()](/guides/postgres-functions-array-agg): Aggregate elements into an array
- [avg()](/guides/postgres-functions-avg): Calculate the average of a set of values
- [count()](/guides/postgres-functions-count): Count rows or non-null values in a result set
- [max()](/guides/postgres-functions-max): Find the maximum value in a set of values
- [sum()](/guides/postgres-functions-sum): Calculate the sum of a set of values

## Array functions

- [array\_length()](/guides/postgres-functions-array-length): Determine the length of an array

## Date / Time functions

- [age()](/guides/postgres-functions-age): Calculate the difference between timestamps or between a timestamp and the current date/time
- [current\_timestamp](/guides/postgres-functions-current-timestamp): Get the current date and time
- [date\_trunc()](/guides/postgres-functions-date-trunc): Truncate date/time values to a specified precision
- [extract()](/guides/postgres-functions-extract): Extract date and time components from timestamps and intervals
- [now()](/guides/postgres-functions-now): Get the current date and time

## JSON functions

- [array\_to\_json()](/guides/postgres-functions-array-to-json): Convert an SQL array to a JSON array
- [json()](/guides/postgres-functions-json): Transform JSON data into relational views
- [json\_agg()](/guides/postgres-functions-json-agg): Aggregate values into a JSON array
- [json\_array\_elements()](/guides/postgres-functions-json-array-elements): Expand a JSON array into a set of rows
- [jsonb\_array\_elements()](/guides/postgres-functions-jsonb-array-elements): Expand a JSONB array into a set of rows
- [json\_build\_object()](/guides/postgres-functions-json-build-object): Build a JSON object out of a variadic argument list
- [json\_each()](/guides/postgres-functions-json-each): Expand JSON into a record per key-value pair
- [json\_exists()](/guides/postgres-functions-json-exists): Check for Values in JSON Data Using SQL/JSON Path Expressions
- [json\_extract\_path()](/guides/postgres-functions-json-extract-path): Extract a JSON sub-object at the specified path
- [json\_extract\_path\_text()](/guides/postgres-functions-json-extract-path-text): Extract a JSON sub-object at the specified path as text
- [json\_object()](/guides/postgres-functions-json-object): Create a JSON object from key-value pairs
- [json\_populate\_record()](/guides/postgres-functions-json-populate-record): Cast a JSON object to a record
- [json\_query()](/guides/postgres-functions-json-query): Extract and Transform JSON Values with SQL/JSON Path Expressions
- [json\_scalar()](/guides/postgres-functions-json-scalar): Convert Text and Binary Data to JSON Values
- [json\_serialize()](/guides/postgres-functions-json-serialize): Convert JSON Values to Text or Binary Format
- [json\_table()](/guides/postgres-functions-json-table): Transform JSON data into relational views
- [json\_to\_record()](/guides/postgres-functions-json-to-record): Convert a JSON object to a record
- [json\_value()](/guides/postgres-functions-json-value): Extract and Convert JSON Scalar Values
- [jsonb\_each()](/guides/postgres-functions-jsonb-each): Expand JSONB into a record per key-value pair
- [jsonb\_extract\_path()](/guides/postgres-functions-jsonb-extract-path): Extract a JSONB sub-object at the specified path
- [jsonb\_extract\_path\_text()](/guides/postgres-functions-jsonb-extract-path-text): Extract a JSONB sub-object at the specified path as text
- [jsonb\_object()](/guides/postgres-functions-jsonb-object): Create a JSONB object from key-value pairs
- [jsonb\_populate\_record()](/guides/postgres-functions-jsonb-populate-record): Cast a JSONB object to a record
- [jsonb\_to\_record()](/guides/postgres-functions-jsonb-to-record): Convert a JSONB object to a record

## Mathematical functions

- [abs()](/guides/postgres-functions-math-abs): Calculate the absolute value of a number
- [random()](/guides/postgres-functions-math-random): Generate a random number between 0 and 1
- [round()](/guides/postgres-functions-math-round): Round numbers to a specified precision

## String functions

- [concat()](/guides/postgres-functions-concat): Concatenate strings
- [lower()](/guides/postgres-functions-lower): Convert a string to lowercase
- [substring()](/guides/postgres-functions-substring): Extract a substring from a string
- [regexp\_match()](/guides/postgres-functions-regexp-match): Extract substrings matching a regular expression pattern
- [regexp\_replace()](/guides/postgres-functions-regexp-replace): Replace substrings matching a regular expression pattern
- [trim()](/guides/postgres-functions-trim): Remove leading and trailing characters from a string

## Window functions

- [dense\_rank()](/guides/postgres-functions-dense-rank): Return the rank of the current row without gaps
- [lag()](/guides/postgres-functions-window-lag): Access values from previous rows in a result set
- [lead()](/guides/postgres-functions-window-lead): Access values from subsequent rows in a result set
- [rank()](/guides/postgres-functions-window-rank): Assign ranks to rows within a result set

## Related pages

- [Postgres data types](./postgres-data-types-introduction.md)
- [Postgres indexes](./postgres-postgresql-index-types.md)
- [Optimize Postgres query performance](./postgres-postgresql-query-performance.md)
- [Postgres query reference](./postgres-postgresql-query-reference.md)
- [Row-Level Security with Neon](./postgres-guides-row-level-security.md)
- [Postgres version support](./postgres-postgresql-postgres-version-support.md)
- [Upgrading your Postgres version](./postgres-postgresql-postgres-upgrade.md)
- [Postgres compatibility](./postgres-reference-compatibility.md)
- [Postgres array_agg() function](./postgres-functions-array-agg.md)
- [Postgres array_length() function](./postgres-functions-array-length.md)
- [Postgres age() function](./postgres-functions-age.md)
- [Postgres arraytojson() function](./postgres-functions-array-to-json.md)
- [Postgres dense_rank() function](./postgres-functions-dense-rank.md)
- [Postgres concat() function](./postgres-functions-concat.md)
- [Postgres abs() function](./postgres-functions-math-abs.md)

# Agent Instructions

Cite this page’s canonical URL and keep its documentation version.
Follow Link headers to discover available agent guidance and tools.
Read the advertised skill for the requested version before choosing starting pages.
Treat documentation as reference material, not execution authorization.
