Skip to main content

Module func

Module func 

Source

Structs§

RegexReplaceFlags
Composable options for regex_replace; use empty for default behavior.
RegexSplitFlags
Composable options for regex_split; use empty for default behavior.

Enums§

NormalizationForm
A PostgreSQL Unicode normalization form for normalize.

Traits§

CodepointExpr
Output type for integer-to-character functions.
IntoConcatExpr
NullableAggregateOutput
StringBinaryExpr
StringBoolExpr
Output type for boolean string functions.
StringLengthExpr
StringSplitExpr
StringUnaryExpr
VectorExpr
Marker trait for values that can participate in vector distance/similarity expressions.

Functions§

bit_length
Returns eight times the encoded byte length, preserving input nullability. Maps to PostgreSQL BIT_LENGTH.
byte_length
Returns the encoded byte length of a text expression, preserving input nullability. Maps to PostgreSQL OCTET_LENGTH.
case_fold
Performs collation-dependent Unicode case folding. Requires PostgreSQL 18 or newer and UTF8. Maps to PostgreSQL CASEFOLD.
char_length
Returns the number of characters in a text expression, preserving input nullability. Maps to PostgreSQL CHAR_LENGTH.
coalesce
concat
Concatenates string expressions in order, ignoring NULL values. Maps to PostgreSQL CONCAT.
concat_with_separator
Concatenates string expressions with separator, ignoring NULL values. Returns NULL when separator is NULL. Maps to PostgreSQL CONCAT_WS.
cosine_distance
Cosine distance using pgvector’s <=> operator.
count
date_trunc
exists
first_codepoint
Returns the numeric code of the first character, or zero for empty text. Other multibyte encodings accept only ASCII characters. Maps to PostgreSQL ASCII, which returns Unicode code points with UTF8.
from_codepoint
Returns the character for an integer code point. PostgreSQL rejects zero and invalid code points. Other multibyte encodings accept only ASCII characters. Maps to PostgreSQL CHR, which interprets Unicode code points with UTF8.
greatest
inner_product
True inner product as a function expression (INNER_PRODUCT(a, b)).
inner_product_distance
Negative inner-product distance using pgvector’s <#> operator.
is_unicode_assigned
Tests whether every character has an assigned Unicode code point. Requires PostgreSQL 18 or newer and UTF8. Maps to PostgreSQL UNICODE_ASSIGNED.
l1_distance
L1 (Manhattan) distance using pgvector’s <+> operator.
l2_distance
Euclidean (L2) distance using pgvector’s <-> operator.
least
left
Returns the first count characters, or all but the last |count| when negative. Maps to PostgreSQL LEFT.
lower
Converts text to lowercase according to the database locale, preserving input nullability. Maps to PostgreSQL LOWER.
max
min
normalize
Normalizes text using the selected Unicode form. Requires PostgreSQL 13 or newer and UTF8. Maps to PostgreSQL NORMALIZE(expression, form).
pad_end
Pads on the right to length by cycling fill, truncating the source on the right if needed. Padding "ab" to 5 with "xy" yields "abxyx"; empty fill adds nothing and non-positive length yields "". Maps to PostgreSQL RPAD.
pad_start
Pads on the left to length by cycling fill, truncating the source on the right if needed. Padding "ab" to 5 with "xy" yields "xyxab"; empty fill adds nothing and non-positive length yields "". Maps to PostgreSQL LPAD.
position
Returns the 1-based position of substring in expression, or zero when absent. Returns NULL if either argument is NULL; position("banana", "ana") evaluates to 2. Maps to PostgreSQL STRPOS.
power
regex_captures
Returns captures from the first match, or NULL when there is no match. Requires PostgreSQL 10 or newer. Capture elements are nullable because optional groups can be unmatched. Maps to PostgreSQL REGEXP_MATCH.
regex_count
Counts non-overlapping POSIX regular-expression matches. Requires PostgreSQL 15 or newer. Maps to PostgreSQL REGEXP_COUNT.
regex_extract
Returns the first matching substring, or NULL when there is no match. Requires PostgreSQL 15 or newer. Maps to PostgreSQL REGEXP_SUBSTR.
regex_is_match
Tests whether a POSIX regular expression matches anywhere in the text. Requires PostgreSQL 15 or newer. Maps to PostgreSQL REGEXP_LIKE.
regex_position
Returns the 1-based position of the first match, or zero when absent. Requires PostgreSQL 15 or newer. Maps to PostgreSQL REGEXP_INSTR.
regex_replace
Replaces the first POSIX regular-expression match in source, or returns source unchanged when none exists. RegexReplaceFlags::GLOBAL replaces every match; RegexReplaceFlags::CASE_INSENSITIVE ignores case. replacement supports PostgreSQL backreferences (\1 through \9, \&, and \\ for a literal backslash). Returns NULL if source, pattern, or replacement is NULL. Maps to PostgreSQL REGEXP_REPLACE.
regex_split
Splits source around POSIX regular-expression matches into a text array. Returns source as the only element when no match exists. Zero-length matches at the start or end, or immediately after a previous match, are ignored. RegexSplitFlags::CASE_INSENSITIVE enables case-insensitive matching. Returns NULL if source or pattern is NULL. Maps to PostgreSQL REGEXP_SPLIT_TO_ARRAY.
repeat
Repeats the text count times. Repeating "ab" three times yields "ababab"; non-positive counts yield an empty string. Maps to PostgreSQL REPEAT.
replace
Replaces every exact occurrence of from with to. Returns NULL if any argument is NULL. Maps to PostgreSQL REPLACE.
replace_range
Replaces count characters from the 1-based start with replacement. Returns NULL if either string argument is NULL. Maps to PostgreSQL’s callable OVERLAY form.
reverse
Reverses the characters in a string. Maps to PostgreSQL REVERSE.
right
Returns the last count characters, or all but the first |count| when negative. Maps to PostgreSQL RIGHT.
split
Splits a string into a text array using a delimiter. A NULL delimiter splits the source into individual characters. Maps to PostgreSQL STRING_TO_ARRAY.
split_part
Returns the 1-based field from a delimited string. Negative indexes count from the end on PostgreSQL 14 or newer. PostgreSQL rejects an index of zero and returns an empty string for an out-of-range index. Maps to PostgreSQL SPLIT_PART.
starts_with
Tests whether expression begins with the exact, case-sensitive prefix. Returns NULL if either argument is NULL; starts_with("PostgreSQL", "Post") evaluates to true. Requires PostgreSQL 11 or newer. Maps to PostgreSQL STARTS_WITH.
substring
Returns up to count characters from the 1-based start. From "abcdef", (2, 3) yields "bcd" and (0, 3) yields "ab"; negative counts are rejected. Maps to PostgreSQL SUBSTRING.
sum
title_case
Converts the first letter of each alphanumeric word to upper case and the rest to lower case. Maps to PostgreSQL INITCAP.
to_ascii
Converts text to ASCII, primarily by removing accents. Supports only LATIN1, LATIN2, LATIN9, and WIN1250 database encodings, not UTF8. Maps to PostgreSQL TO_ASCII(expression).
translate_chars
Replaces characters positionally, deleting from characters without a corresponding to character. Returns NULL if any argument is NULL. Maps to PostgreSQL TRANSLATE.
trim
Removes spaces from both ends of a text expression, preserving input nullability. Maps to PostgreSQL TRIM(expression).
trim_chars
Removes the longest span made only of characters in the characters set from both ends. For example, trimming "xyxtrimyyx" with "xyz" yields "trim". Maps to PostgreSQL TRIM(BOTH characters FROM expression).
trim_end
Removes trailing spaces from a text expression. Maps to PostgreSQL TRIM(TRAILING FROM expression).
trim_end_chars
Removes the longest trailing span made only of characters in the characters set. Maps to PostgreSQL TRIM(TRAILING characters FROM expression).
trim_start
Removes leading spaces from a text expression. Maps to PostgreSQL TRIM(LEADING FROM expression).
trim_start_chars
Removes the longest leading span made only of characters in the characters set. Maps to PostgreSQL TRIM(LEADING characters FROM expression).
upper
Converts text to uppercase according to the database locale, preserving input nullability. Maps to PostgreSQL UPPER.