ASCII(text)
Returns INTEGER
Returns the first Unicode code point. An empty string returns zero.
SELECT ASCII('A');Source: sql/postgres_function_strings.go:67 · e5e2eb2Function inventory verified against the supplied SlopDB source checkout e5e2eb2. Entries document implemented behavior, including compatibility placeholders and restrictions.
← Search all SQL functions · 165 documented names/forms in this family.
These functions and overrides run in PostgreSQL mode on the same SlopDB engine. They do not imply complete PostgreSQL SQL, types, catalogs, permissions, or extension support. See compatibility coverage and server operation.
The registry includes all listed aliases. NULL rules differ from MySQL for names such as CONCAT. Numeric transcendental functions currently use double precision even for NUMERIC inputs. RANDOM is inherited from the native engine and returns an integer; SETSEED is unsupported. Native functions outside these overrides can retain native behavior. Stored views, triggers, defaults, and CHECK constraints preserve their defining expression dialect when invoked through another frontend. General SQL arrays and set-returning functions are not implemented.
Transaction-clock functions stay stable through statements and savepoints in an explicit transaction. STATEMENT_TIMESTAMP uses statement time; CLOCK_TIMESTAMP and TIMEOFDAY read the wall clock. Most clock output uses UTC. Date templates support common calendar/time fields such as YYYY, MM, DD, HH24, MI, SS, MS, US, and supported timezone fields; broad PostgreSQL numeric/interval formatting, input normalization, locale behavior, and BCE/large-year dates are not promised.
Regex uses RE2 with a supported PostgreSQL flag subset, including i/c and supported newline/expanded controls; g selects global replacement. Unsupported flags and constructs fail. JSON path arguments such as '{a,0}' are textual path arrays, not a general SQL array type. JSON builders preserve SQL booleans and exact numbers and distinguish SQL NULL from JSON null.
ASCII(text)Returns INTEGER
Returns the first Unicode code point. An empty string returns zero.
SELECT ASCII('A');Source: sql/postgres_function_strings.go:67 · e5e2eb2BIT_COUNT(bytes)Returns BIGINT
Counts set bits in all bytes of a BYTEA value. This PostgreSQL overload takes BYTEA rather than the MySQL integer form. NULL returns NULL.
SELECT BIT_COUNT(DECODE('0f', 'hex'));Source: sql/postgres_function_extra.go:40 · e5e2eb2BIT_LENGTH(value)Returns INTEGER
Returns bytes or eight times bytes, respectively, for text or bytea.
SELECT BIT_LENGTH('é');Source: sql/postgres_function_strings.go:67 · e5e2eb2BTRIM(text [, characters])Returns TEXT
Trims a set of characters from both ends, the left end, or the right end. Default trim set is a space.
SELECT BTRIM(' slime ');Source: sql/postgres_function_strings.go:137 · e5e2eb2CHAR_LENGTH(value)Returns INTEGER
Counts Unicode code points in text and bytes in bytea. NULL propagates.
SELECT CHAR_LENGTH('slime');Source: sql/postgres_function_strings.go:67 · e5e2eb2CHARACTER_LENGTH(value)Returns INTEGER
Counts Unicode code points in text and bytes in bytea. NULL propagates.
SELECT CHARACTER_LENGTH('slime');Source: sql/postgres_function_strings.go:67 · e5e2eb2CHR(codepoint)Returns TEXT
Builds one valid Unicode character; zero and invalid Unicode code points fail.
SELECT CHR(65);Source: sql/postgres_function_strings.go:94 · e5e2eb2CONCAT(value [, value, ...])Returns TEXT
Concatenates textual forms while skipping SQL NULL arguments.
SELECT CONCAT('slop', NULL, 'db');Source: sql/postgres_function_strings.go:34 · e5e2eb2CONCAT_WS(separator, value [, value, ...])Returns TEXT
Joins non-NULL values with a separator. A NULL separator produces NULL.
SELECT CONCAT_WS('-', 'slop', NULL, 'db');Source: sql/postgres_function_strings.go:34 · e5e2eb2CONVERT_FROM(bytes, encoding)Returns TEXT
Validates UTF-8 bytes and returns text. Supported names are UTF8, UTF-8, and unicode.
SELECT CONVERT_FROM(DECODE('476f', 'hex'), 'UTF8');Source: sql/postgres_function_strings.go:343 · e5e2eb2CONVERT_TO(text, encoding)Returns BYTEA
Returns UTF-8 bytes for supported UTF8, UTF-8, or unicode encoding names. Other encodings fail.
SELECT CONVERT_TO('Go', 'UTF8');Source: sql/postgres_function_strings.go:359 · e5e2eb2DECODE(text, format)Returns BYTEA
Decodes hex, base64, or escape text into bytea; malformed encodings fail.
SELECT DECODE('476f', 'hex');Source: sql/postgres_function_strings.go:228 · e5e2eb2ENCODE(bytes, format)Returns TEXT
Encodes bytea as hex, base64, or escape text.
SELECT ENCODE(DECODE('476f', 'hex'), 'hex');Source: sql/postgres_function_strings.go:178 · e5e2eb2FORMAT(template [, value, ...])Returns TEXT
Formats with supported %s, %I, %L, positional/width forms, and literal %%. %s renders NULL as empty, %L as SQL NULL, and %I rejects NULL.
SELECT FORMAT('%I = %L', 'name', 'slime');Source: sql/postgres_function_strings.go:547 · e5e2eb2GET_BIT(bytes, offset)Returns INTEGER
Returns a bit at a zero-based offset using the implemented bytea bit numbering; out-of-range offsets fail.
SELECT GET_BIT(DECODE('01', 'hex'), 0);Source: sql/postgres_function_strings.go:311 · e5e2eb2GET_BYTE(bytes, offset)Returns INTEGER
Returns a byte at a zero-based offset. Out-of-range offsets fail.
SELECT GET_BYTE(DECODE('476f', 'hex'), 0);Source: sql/postgres_function_strings.go:279 · e5e2eb2INITCAP(text)Returns TEXT
Uppercases the initial alphanumeric character of each word and lowercases subsequent characters.
SELECT INITCAP('hello slime');Source: sql/postgres_function_strings.go:130 · e5e2eb2IS_NORMALIZED(text [, form])Returns BOOLEAN
Tests whether text is already in the requested NFC (default), NFD, NFKC, or NFKD form. NULL arguments return NULL; invalid forms fail.
SELECT IS_NORMALIZED('é', 'NFC');Source: sql/postgres_function_extra.go:69 · e5e2eb2LEFT(text, count)Returns TEXT
Returns count characters from the requested side. A negative count excludes that many characters from the opposite side.
SELECT LEFT('slopdb', 2);Source: sql/postgres_function_strings.go:130 · e5e2eb2LENGTH(value)Returns INTEGER
Counts Unicode code points in text and bytes in bytea. NULL propagates.
SELECT LENGTH('slime');Source: sql/postgres_function_strings.go:67 · e5e2eb2LPAD(text, length [, padding])Returns TEXT
Pads or truncates by characters. Padding defaults to a space; a nonpositive length returns empty.
SELECT LPAD('go', 5, '.');Source: sql/postgres_function_strings.go:130 · e5e2eb2LTRIM(text [, characters])Returns TEXT
Trims a set of characters from both ends, the left end, or the right end. Default trim set is a space.
SELECT LTRIM(' slime ');Source: sql/postgres_function_strings.go:137 · e5e2eb2NORMALIZE(text [, form])Returns TEXT
Returns Unicode-normalized text. Forms are NFC (default), NFD, NFKC, and NFKD. NULL arguments return NULL; invalid forms fail.
NORMALIZE also accepts the supported unquoted normalization-form syntax. Expanded output is checked against the query memory budget.
SELECT NORMALIZE('é', 'NFD');Source: sql/postgres_function_extra.go:69 · e5e2eb2OCTET_LENGTH(value)Returns INTEGER
Returns bytes or eight times bytes, respectively, for text or bytea.
SELECT OCTET_LENGTH('é');Source: sql/postgres_function_strings.go:67 · e5e2eb2OVERLAY(text PLACING replacement FROM start [FOR count])Returns TEXT
Replaces a one-based span. Omitted count uses the replacement’s character count; negative counts and nonpositive starts fail.
SELECT OVERLAY('slopdb' PLACING 'go' FROM 1 FOR 4);Source: sql/postgres_function_regexp.go:137 · e5e2eb2POSITION(needle IN haystack)Returns INTEGER
Returns a one-based occurrence position, or zero. Two bytea arguments use byte positions.
SELECT POSITION('db' IN 'slopdb');Source: sql/postgres_function_regexp.go:111 · e5e2eb2QUOTE_IDENT(text)Returns TEXT
Quotes a SQL identifier when needed and doubles embedded double quotes.
SELECT QUOTE_IDENT('My Table');Source: sql/postgres_function_strings.go:162 · e5e2eb2QUOTE_LITERAL(value)Returns TEXT
Returns an escaped SQL literal; SQL NULL returns SQL NULL.
SELECT QUOTE_LITERAL('slime');Source: sql/postgres_function_strings.go:162 · e5e2eb2QUOTE_NULLABLE(value)Returns TEXT
Returns an escaped SQL literal, or the text NULL for SQL NULL.
SELECT QUOTE_NULLABLE(NULL);Source: sql/postgres_function_strings.go:162 · e5e2eb2REPEAT(text, count)Returns TEXT
Repeats text; a nonpositive count returns empty. Expanded output is memory-budget checked.
SELECT REPEAT('go', 3);Source: sql/postgres_function_strings.go:130 · e5e2eb2REVERSE(text)Returns TEXT
Reverses Unicode code points.
SELECT REVERSE('slime');Source: sql/postgres_function_strings.go:130 · e5e2eb2RIGHT(text, count)Returns TEXT
Returns count characters from the requested side. A negative count excludes that many characters from the opposite side.
SELECT RIGHT('slopdb', 2);Source: sql/postgres_function_strings.go:130 · e5e2eb2RPAD(text, length [, padding])Returns TEXT
Pads or truncates by characters. Padding defaults to a space; a nonpositive length returns empty.
SELECT RPAD('go', 5, '.');Source: sql/postgres_function_strings.go:130 · e5e2eb2RTRIM(text [, characters])Returns TEXT
Trims a set of characters from both ends, the left end, or the right end. Default trim set is a space.
SELECT RTRIM(' slime ');Source: sql/postgres_function_strings.go:137 · e5e2eb2SET_BIT(bytes, offset, bit)Returns BYTEA
Returns bytea with one bit set to 0 or 1. Out-of-range offsets fail.
SELECT SET_BIT(DECODE('00', 'hex'), 0, 1);Source: sql/postgres_function_strings.go:324 · e5e2eb2SET_BYTE(bytes, offset, value)Returns BYTEA
Returns a bytea copy with one byte changed. Offset is zero-based and value must be 0 through 255.
SELECT SET_BYTE(DECODE('476f', 'hex'), 0, 65);Source: sql/postgres_function_strings.go:292 · e5e2eb2SHA224(bytes)Returns BYTEA
Returns the named SHA-2 digest of a BYTEA input as raw bytes. NULL returns NULL. Use ENCODE for a hexadecimal display.
MySQL SHA2 returns hexadecimal TEXT and selects the digest width with a separate numeric argument.
SELECT ENCODE(SHA224(CONVERT_TO('slime', 'UTF8')), 'hex');Source: sql/postgres_function_extra.go:52 · e5e2eb2SHA256(bytes)Returns BYTEA
Returns the named SHA-2 digest of a BYTEA input as raw bytes. NULL returns NULL. Use ENCODE for a hexadecimal display.
MySQL SHA2 returns hexadecimal TEXT and selects the digest width with a separate numeric argument.
SELECT ENCODE(SHA256(CONVERT_TO('slime', 'UTF8')), 'hex');Source: sql/postgres_function_extra.go:52 · e5e2eb2SHA384(bytes)Returns BYTEA
Returns the named SHA-2 digest of a BYTEA input as raw bytes. NULL returns NULL. Use ENCODE for a hexadecimal display.
MySQL SHA2 returns hexadecimal TEXT and selects the digest width with a separate numeric argument.
SELECT ENCODE(SHA384(CONVERT_TO('slime', 'UTF8')), 'hex');Source: sql/postgres_function_extra.go:52 · e5e2eb2SHA512(bytes)Returns BYTEA
Returns the named SHA-2 digest of a BYTEA input as raw bytes. NULL returns NULL. Use ENCODE for a hexadecimal display.
MySQL SHA2 returns hexadecimal TEXT and selects the digest width with a separate numeric argument.
SELECT ENCODE(SHA512(CONVERT_TO('slime', 'UTF8')), 'hex');Source: sql/postgres_function_extra.go:52 · e5e2eb2SPLIT_PART(text, delimiter, field)Returns TEXT
Returns a one-based split field; negative fields count from the end. Zero is invalid; absent fields return empty.
SELECT SPLIT_PART('a.b.c', '.', 2);Source: sql/postgres_function_strings.go:130 · e5e2eb2STARTS_WITH(text, prefix)Returns BOOLEAN
Returns whether text begins with the prefix using literal case-sensitive matching. NULL arguments return NULL.
SELECT STARTS_WITH('slopdb', 'slop');Source: sql/postgres_function_extra.go:21 · e5e2eb2STRPOS(haystack, needle)Returns INTEGER
Returns the one-based first occurrence or zero if absent, counting Unicode text positions.
SELECT STRPOS('slopdb', 'db');Source: sql/postgres_function_strings.go:107 · e5e2eb2SUBSTR(value, start [, count])Returns TEXT or BYTEA
Returns a one-based substring. Starts before one reduce the effective covered range; a negative count fails. Text counts code points and bytea counts bytes.
SUBSTRING(text, pattern) also supports the implemented regular-expression form, returning the first capture when present. General SQL regex escape syntax is unsupported.
SELECT SUBSTR('slopdb', 2, 3);Source: sql/postgres_function_regexp.go:44 · e5e2eb2SUBSTRING(value, start [, count])Returns TEXT or BYTEA
Returns a one-based substring. Starts before one reduce the effective covered range; a negative count fails. Text counts code points and bytea counts bytes.
SUBSTRING(text, pattern) also supports the implemented regular-expression form, returning the first capture when present. General SQL regex escape syntax is unsupported.
SELECT SUBSTRING('slopdb', 2, 3);Source: sql/postgres_function_regexp.go:44 · e5e2eb2TO_HEX(integer)Returns TEXT
Formats an integer as lowercase hexadecimal. Negative INTEGER inputs use 32-bit two’s-complement width; BIGINT inputs use 64-bit width. NULL returns NULL.
SELECT TO_HEX(255::bigint);Source: sql/postgres_function_extra.go:27 · e5e2eb2TRANSLATE(text, from, to)Returns TEXT
Maps characters by position; source characters beyond the replacement set are deleted.
SELECT TRANSLATE('abc', 'ac', 'XY');Source: sql/postgres_function_strings.go:130 · e5e2eb2UNISTR(text)Returns TEXT
Decodes supported Unicode escapes: four-digit forms, u-prefixed four digits, plus-prefixed six digits, and U-prefixed eight digits. Surrogate pairs are combined; invalid pairs, zero, and invalid code points fail.
A doubled backslash represents a literal backslash. PostgreSQL string syntax retains the escapes for this function to process.
SELECT UNISTR('sl\0069me');Source: sql/postgres_function_extra.go:104 · e5e2eb2REGEXP_COUNT(text, pattern [, start [, flags]])Returns INTEGER
Counts matches from a one-based character position.
SELECT REGEXP_COUNT('slime slime', 'slime');Source: sql/postgres_function_regexp.go:27 · e5e2eb2REGEXP_INSTR(text, pattern [, start [, occurrence [, end_option [, flags [, subexpression]]]]])Returns INTEGER
Returns the selected match or capture position, or zero. end_option chooses start versus end.
SELECT REGEXP_INSTR('slime', 'im');Source: sql/postgres_function_regexp.go:27 · e5e2eb2REGEXP_LIKE(text, pattern [, flags])Returns BOOLEAN
Tests a RE2 pattern using supported PostgreSQL-style flags. NULL propagates.
SELECT REGEXP_LIKE('slime', '^s');Source: sql/postgres_function_regexp.go:27 · e5e2eb2REGEXP_REPLACE(text, pattern, replacement [, flags]) or REGEXP_REPLACE(text, pattern, replacement, start [, occurrence [, flags]])Returns TEXT
Replaces the first match by default; flag g or occurrence zero selects all. Supported replacement captures are expanded.
RE2 cannot implement all PostgreSQL regex constructs, lookarounds, backreferences in patterns, or collating elements. Unsupported features fail explicitly.
SELECT REGEXP_REPLACE('slime slime', 'slime', 'go', 'g');Source: sql/postgres_function_regexp.go:27 · e5e2eb2REGEXP_SUBSTR(text, pattern [, start [, occurrence [, flags [, subexpression]]]])Returns TEXT
Returns a selected match/capture or NULL when absent.
SELECT REGEXP_SUBSTR('slime', 'im');Source: sql/postgres_function_regexp.go:27 · e5e2eb2JSON_ARRAY_LENGTH(document)Returns INTEGER
Returns the array element count. A non-array input fails; NULL propagates.
SELECT JSON_ARRAY_LENGTH('[1,2]'::jsonb);Source: sql/postgres_function_json.go:99 · e5e2eb2JSON_BUILD_ARRAY([value, ...])Returns JSON or JSONB
Builds JSON/JSONB arrays, preserving booleans and exact numeric values. SQL NULL elements become JSON null.
SELECT JSON_BUILD_ARRAY(1, 'slime', NULL);Source: sql/postgres_function_json.go:25 · e5e2eb2JSON_BUILD_OBJECT([key, value, ...])Returns JSON or JSONB
Builds an object from an even number of arguments. NULL or JSON-valued object keys fail.
SELECT JSON_BUILD_OBJECT('name', 'slime', 'count', 2);Source: sql/postgres_function_json.go:25 · e5e2eb2JSON_EXTRACT_PATH(document [, path_component, ...])Returns JSON or JSONB
Traverses object keys or array indices and returns JSON/JSONB. Negative array indices count from the end. Missing paths return SQL NULL.
SELECT JSON_EXTRACT_PATH('{"a":[1,2]}'::jsonb, 'a', '0');Source: sql/postgres_function_json.go:120 · e5e2eb2JSON_EXTRACT_PATH_TEXT(document [, path_component, ...])Returns TEXT
Traverses a path and returns unquoted scalar text or serialized container text. Missing paths and JSON null return SQL NULL.
SELECT JSON_EXTRACT_PATH_TEXT('{"a":"slime"}'::jsonb, 'a');Source: sql/postgres_function_json.go:120 · e5e2eb2JSON_STRIP_NULLS(document)Returns JSON
Recursively removes JSON object fields with JSON null values. Array null elements are retained. SQL NULL returns SQL NULL.
This is the JSON counterpart of JSONB_STRIP_NULLS; the optional strip-array-nulls extension is not implemented.
SELECT JSON_STRIP_NULLS('{"a":null,"b":1}'::json);Source: sql/postgres_function_json.go:235 · e5e2eb2JSON_TYPEOF(document)Returns TEXT
Returns object, array, string, number, boolean, or null as a lowercase type label. SQL NULL stays SQL NULL.
SELECT JSON_TYPEOF('{"a":1}'::jsonb);Source: sql/postgres_function_json.go:74 · e5e2eb2JSONB_ARRAY_LENGTH(document)Returns INTEGER
Returns the array element count. A non-array input fails; NULL propagates.
SELECT JSONB_ARRAY_LENGTH('[1,2]'::jsonb);Source: sql/postgres_function_json.go:99 · e5e2eb2JSONB_BUILD_ARRAY([value, ...])Returns JSON or JSONB
Builds JSON/JSONB arrays, preserving booleans and exact numeric values. SQL NULL elements become JSON null.
SELECT JSONB_BUILD_ARRAY(1, 'slime', NULL);Source: sql/postgres_function_json.go:25 · e5e2eb2JSONB_BUILD_OBJECT([key, value, ...])Returns JSON or JSONB
Builds an object from an even number of arguments. NULL or JSON-valued object keys fail.
SELECT JSONB_BUILD_OBJECT('name', 'slime', 'count', 2);Source: sql/postgres_function_json.go:25 · e5e2eb2JSONB_EXTRACT_PATH(document [, path_component, ...])Returns JSON or JSONB
Traverses object keys or array indices and returns JSON/JSONB. Negative array indices count from the end. Missing paths return SQL NULL.
SELECT JSONB_EXTRACT_PATH('{"a":[1,2]}'::jsonb, 'a', '0');Source: sql/postgres_function_json.go:120 · e5e2eb2JSONB_EXTRACT_PATH_TEXT(document [, path_component, ...])Returns TEXT
Traverses a path and returns unquoted scalar text or serialized container text. Missing paths and JSON null return SQL NULL.
SELECT JSONB_EXTRACT_PATH_TEXT('{"a":"slime"}'::jsonb, 'a');Source: sql/postgres_function_json.go:120 · e5e2eb2JSONB_INSERT(document, path, value [, insert_after])Returns JSONB
Inserts into an array or an absent object key. insert_after defaults to false; existing object keys cannot be replaced by this function.
SELECT JSONB_INSERT('[1,3]'::jsonb, '{1}', '2'::jsonb);Source: sql/postgres_function_json.go:167 · e5e2eb2JSONB_PRETTY(document)Returns TEXT
Returns the implemented indented JSONB display text.
SELECT JSONB_PRETTY('{"a":1}'::jsonb);Source: sql/postgres_function_json.go:218 · e5e2eb2JSONB_SET(document, path, replacement [, create_if_missing])Returns JSONB
Replaces a path or adds a final missing component when allowed; create_if_missing defaults to true. Path is a textual array such as {a,0}.
Textual JSON paths do not provide general SQL array types. Missing intermediate components are not synthesized.
SELECT JSONB_SET('{"a":1}'::jsonb, '{a}', '2'::jsonb);Source: sql/postgres_function_json.go:167 · e5e2eb2JSONB_SET_LAX(document, path, replacement [, create_if_missing [, null_value_treatment]])Returns JSONB
Updates JSONB like JSONB_SET when the replacement is non-NULL. For SQL NULL replacements, the supported treatments are use_json_null (default), delete_key, return_target, and raise_exception.
create_if_missing defaults to true. SQL NULL target, path, or explicit creation flag returns SQL NULL. A NULL treatment is invalid. Paths use textual array notation and do not provide general SQL arrays.
SELECT JSONB_SET_LAX('{"a":1}'::jsonb, '{a}', NULL, true, 'delete_key');Source: sql/postgres_function_json.go:246 · e5e2eb2JSONB_STRIP_NULLS(document)Returns JSONB
Recursively removes object fields whose value is JSON null; array null elements are retained.
SELECT JSONB_STRIP_NULLS('{"a":null,"b":1}'::jsonb);Source: sql/postgres_function_json.go:208 · e5e2eb2JSONB_TYPEOF(document)Returns TEXT
Returns object, array, string, number, boolean, or null as a lowercase type label. SQL NULL stays SQL NULL.
SELECT JSONB_TYPEOF('{"a":1}'::jsonb);Source: sql/postgres_function_json.go:74 · e5e2eb2TO_JSON(value)Returns JSON or JSONB
Converts an SQL value to JSON/JSONB; SQL NULL returns SQL NULL. Native boolean declarations keep JSON boolean values.
SELECT TO_JSON(42);Source: sql/postgres_function_json.go:62 · e5e2eb2TO_JSONB(value)Returns JSON or JSONB
Converts an SQL value to JSON/JSONB; SQL NULL returns SQL NULL. Native boolean declarations keep JSON boolean values.
SELECT TO_JSONB(42);Source: sql/postgres_function_json.go:62 · e5e2eb2ABS(number)Returns numeric
Returns absolute numeric value. Integer and NUMERIC paths retain exact arithmetic; floating inputs retain floating representation.
SELECT ABS(-12);Source: sql/postgres_function_math.go:114 · e5e2eb2CEIL(number)Returns numeric
Rounds toward positive infinity for CEIL/CEILING, or negative infinity for FLOOR. NUMERIC paths stay exact.
SELECT CEIL(12.3);Source: sql/postgres_function_math.go:114 · e5e2eb2CEILING(number)Returns numeric
Rounds toward positive infinity for CEIL/CEILING, or negative infinity for FLOOR. NUMERIC paths stay exact.
SELECT CEILING(12.3);Source: sql/postgres_function_math.go:114 · e5e2eb2DIV(a, b)Returns NUMERIC
Returns the integer quotient truncated toward zero as an exact NUMERIC value. Division by zero fails.
SELECT DIV(7, 3);Source: sql/postgres_function_math.go:162 · e5e2eb2FACTORIAL(integer)Returns NUMERIC
Returns exact factorial as NUMERIC. Negative inputs fail; work and output are bounded and cancellation is checked.
SELECT FACTORIAL(5);Source: sql/postgres_function_math.go:220 · e5e2eb2FLOOR(number)Returns numeric
Rounds toward positive infinity for CEIL/CEILING, or negative infinity for FLOOR. NUMERIC paths stay exact.
SELECT FLOOR(12.3);Source: sql/postgres_function_math.go:114 · e5e2eb2GCD(a, b)Returns numeric
Computes greatest common divisor or least common multiple using the exact numeric implementation; supported integer inputs retain integer results.
SELECT GCD(12, 18);Source: sql/postgres_function_math.go:162 · e5e2eb2LCM(a, b)Returns numeric
Computes greatest common divisor or least common multiple using the exact numeric implementation; supported integer inputs retain integer results.
SELECT LCM(12, 18);Source: sql/postgres_function_math.go:162 · e5e2eb2MIN_SCALE(number)Returns INTEGER
Returns the minimum decimal scale after removing trailing fractional zeros.
SELECT MIN_SCALE(12.340::numeric);Source: sql/postgres_function_math.go:133 · e5e2eb2MOD(a, b)Returns numeric
Returns the exact remainder. Division by zero fails.
SELECT MOD(7, 3);Source: sql/postgres_function_math.go:162 · e5e2eb2ROUND(number [, scale])Returns numeric
Rounds to a decimal scale, including negative scales. NUMERIC ties round away from zero; the floating overload uses its floating-point path.
SELECT ROUND(12.345::numeric, 2);Source: sql/postgres_function_math.go:114 · e5e2eb2SCALE(number)Returns INTEGER
Returns the stored decimal scale of a NUMERIC value.
SELECT SCALE(12.340::numeric);Source: sql/postgres_function_math.go:133 · e5e2eb2SIGN(number)Returns numeric
Returns numeric -1, 0, or 1.
SELECT SIGN(-12);Source: sql/postgres_function_math.go:114 · e5e2eb2TRIM_SCALE(number)Returns NUMERIC
Removes trailing fractional zeros from the numeric representation.
SELECT TRIM_SCALE(12.340::numeric);Source: sql/postgres_function_math.go:133 · e5e2eb2TRUNC(number [, scale])Returns numeric
Truncates toward zero at the requested scale, retaining exact NUMERIC arithmetic.
SELECT TRUNC(12.345::numeric, 2);Source: sql/postgres_function_math.go:114 · e5e2eb2WIDTH_BUCKET(value, low, high, count)Returns INTEGER
Returns a one-based equal-width bucket number. Zero and count+1 represent values beyond the bounds; reversed bounds are supported. Equal bounds or a nonpositive count fail.
The array-boundaries overload is not implemented.
SELECT WIDTH_BUCKET(5, 0, 10, 5);Source: sql/postgres_function_math.go:248 · e5e2eb2ACOS(number)Returns DOUBLE PRECISION
Inverse cosine, radians. Uses double precision; NULL propagates and invalid/nonfinite results fail.
SELECT ACOS(1);Source: sql/postgres_function_math.go:19 · e5e2eb2ACOSD(number)Returns DOUBLE PRECISION
Inverse cosine, result in degrees. Uses double precision; NULL propagates and invalid/nonfinite results fail.
SELECT ACOSD(1);Source: sql/postgres_function_math.go:32 · e5e2eb2ACOSH(number)Returns DOUBLE PRECISION
Inverse hyperbolic cosine. Uses double precision; NULL propagates and invalid/nonfinite results fail.
SELECT ACOSH(1);Source: sql/postgres_function_math.go:19 · e5e2eb2ASIN(number)Returns DOUBLE PRECISION
Inverse sine, radians. Uses double precision; NULL propagates and invalid/nonfinite results fail.
SELECT ASIN(0);Source: sql/postgres_function_math.go:19 · e5e2eb2ASIND(number)Returns DOUBLE PRECISION
Inverse sine, result in degrees. Uses double precision; NULL propagates and invalid/nonfinite results fail.
SELECT ASIND(0);Source: sql/postgres_function_math.go:32 · e5e2eb2ASINH(number)Returns DOUBLE PRECISION
Inverse hyperbolic sine. Uses double precision; NULL propagates and invalid/nonfinite results fail.
SELECT ASINH(0);Source: sql/postgres_function_math.go:19 · e5e2eb2ATAN(number)Returns DOUBLE PRECISION
Inverse tangent, radians. Uses double precision; NULL propagates and invalid/nonfinite results fail.
SELECT ATAN(1);Source: sql/postgres_function_math.go:19 · e5e2eb2ATAN2(y, x)Returns DOUBLE PRECISION
Returns quadrant-aware inverse tangent in radians (ATAN2) or degrees (ATAN2D).
SELECT ATAN2(1, 1);Source: sql/postgres_function_math.go:78 · e5e2eb2ATAN2D(y, x)Returns DOUBLE PRECISION
Returns quadrant-aware inverse tangent in radians (ATAN2) or degrees (ATAN2D).
SELECT ATAN2D(1, 1);Source: sql/postgres_function_math.go:78 · e5e2eb2ATAND(number)Returns DOUBLE PRECISION
Inverse tangent, result in degrees. Uses double precision; NULL propagates and invalid/nonfinite results fail.
SELECT ATAND(1);Source: sql/postgres_function_math.go:32 · e5e2eb2ATANH(number)Returns DOUBLE PRECISION
Inverse hyperbolic tangent. Uses double precision; NULL propagates and invalid/nonfinite results fail.
SELECT ATANH(0);Source: sql/postgres_function_math.go:19 · e5e2eb2CBRT(number)Returns DOUBLE PRECISION
Cube root. Uses double precision; NULL propagates and invalid/nonfinite results fail.
SELECT CBRT(8);Source: sql/postgres_function_math.go:19 · e5e2eb2COS(number)Returns DOUBLE PRECISION
Cosine, radians. Uses double precision; NULL propagates and invalid/nonfinite results fail.
SELECT COS(0);Source: sql/postgres_function_math.go:19 · e5e2eb2COSD(number)Returns DOUBLE PRECISION
Cosine, degrees. Uses double precision; NULL propagates and invalid/nonfinite results fail.
SELECT COSD(60);Source: sql/postgres_function_math.go:32 · e5e2eb2COSH(number)Returns DOUBLE PRECISION
Hyperbolic cosine. Uses double precision; NULL propagates and invalid/nonfinite results fail.
SELECT COSH(0);Source: sql/postgres_function_math.go:19 · e5e2eb2COT(number)Returns DOUBLE PRECISION
Cotangent, radians. Uses double precision; NULL propagates and invalid/nonfinite results fail.
SELECT COT(1);Source: sql/postgres_function_math.go:19 · e5e2eb2COTD(number)Returns DOUBLE PRECISION
Cotangent, degrees. Uses double precision; NULL propagates and invalid/nonfinite results fail.
SELECT COTD(45);Source: sql/postgres_function_math.go:32 · e5e2eb2DEGREES(number)Returns DOUBLE PRECISION
Radians to degrees. Uses double precision; NULL propagates and invalid/nonfinite results fail.
SELECT DEGREES(1);Source: sql/postgres_function_math.go:19 · e5e2eb2EXP(number)Returns DOUBLE PRECISION
Base-e exponential. Uses double precision; NULL propagates and invalid/nonfinite results fail.
SELECT EXP(1);Source: sql/postgres_function_math.go:19 · e5e2eb2LN(number)Returns DOUBLE PRECISION
Natural logarithm. Uses double precision; NULL propagates and invalid/nonfinite results fail.
SELECT LN(2);Source: sql/postgres_function_math.go:19 · e5e2eb2LOG(value) or LOG(base, value)Returns DOUBLE PRECISION
One argument computes base-10 logarithm. Two arguments select the base. Invalid logarithm domains fail.
Unlike MySQL LOG(value), this is not a natural logarithm.
SELECT LOG(100);Source: sql/postgres_function_math.go:78 · e5e2eb2LOG10(number)Returns DOUBLE PRECISION
Base-10 logarithm. Uses double precision; NULL propagates and invalid/nonfinite results fail.
SELECT LOG10(100);Source: sql/postgres_function_math.go:19 · e5e2eb2PI()Returns DOUBLE PRECISION
Returns double-precision pi.
SELECT PI();Source: sql/postgres_function_math.go:71 · e5e2eb2POW(base, exponent)Returns DOUBLE PRECISION
Returns base raised to exponent using double precision, including NUMERIC transcendental inputs. Invalid domains and nonfinite results fail.
SELECT POW(2, 3);Source: sql/postgres_function_math.go:78 · e5e2eb2POWER(base, exponent)Returns DOUBLE PRECISION
Returns base raised to exponent using double precision, including NUMERIC transcendental inputs. Invalid domains and nonfinite results fail.
SELECT POWER(2, 3);Source: sql/postgres_function_math.go:78 · e5e2eb2RADIANS(number)Returns DOUBLE PRECISION
Degrees to radians. Uses double precision; NULL propagates and invalid/nonfinite results fail.
SELECT RADIANS(180);Source: sql/postgres_function_math.go:19 · e5e2eb2SIN(number)Returns DOUBLE PRECISION
Sine, radians. Uses double precision; NULL propagates and invalid/nonfinite results fail.
SELECT SIN(0);Source: sql/postgres_function_math.go:19 · e5e2eb2SIND(number)Returns DOUBLE PRECISION
Sine, degrees. Uses double precision; NULL propagates and invalid/nonfinite results fail.
SELECT SIND(30);Source: sql/postgres_function_math.go:32 · e5e2eb2SINH(number)Returns DOUBLE PRECISION
Hyperbolic sine. Uses double precision; NULL propagates and invalid/nonfinite results fail.
SELECT SINH(0);Source: sql/postgres_function_math.go:19 · e5e2eb2SQRT(number)Returns DOUBLE PRECISION
Square root. Uses double precision; NULL propagates and invalid/nonfinite results fail.
SELECT SQRT(9);Source: sql/postgres_function_math.go:19 · e5e2eb2TAN(number)Returns DOUBLE PRECISION
Tangent, radians. Uses double precision; NULL propagates and invalid/nonfinite results fail.
SELECT TAN(0);Source: sql/postgres_function_math.go:19 · e5e2eb2TAND(number)Returns DOUBLE PRECISION
Tangent, degrees. Uses double precision; NULL propagates and invalid/nonfinite results fail.
SELECT TAND(45);Source: sql/postgres_function_math.go:32 · e5e2eb2TANH(number)Returns DOUBLE PRECISION
Hyperbolic tangent. Uses double precision; NULL propagates and invalid/nonfinite results fail.
SELECT TANH(0);Source: sql/postgres_function_math.go:19 · e5e2eb2CLOCK_TIMESTAMP()Returns TIMESTAMPTZ
Reads wall-clock time at evaluation, so it can change within one statement.
SELECT CLOCK_TIMESTAMP();Source: sql/postgres_function_clock.go:13 · e5e2eb2CURRENT_DATEReturns DATE
Returns the UTC calendar date of the transaction clock.
SELECT CURRENT_DATE;Source: sql/postgres_function_clock.go:13 · e5e2eb2CURRENT_TIME[(precision)]Returns TIMETZ
Returns the transaction clock’s UTC time with timezone.
SELECT CURRENT_TIME;Source: sql/postgres_function_clock.go:13 · e5e2eb2CURRENT_TIMESTAMP[(precision)]Returns TIMESTAMPTZ
Returns the transaction clock as a timestamp with timezone. Optional precision is validated and capped at microsecond precision.
SELECT CURRENT_TIMESTAMP;Source: sql/postgres_function_clock.go:13 · e5e2eb2DATE_PART(field, value)Returns DOUBLE PRECISION
Returns a supported calendar or time component as double precision.
SELECT DATE_PART('year', '2026-01-02'::timestamp);Source: sql/postgres_function_clock.go:13 · e5e2eb2DATE_TRUNC(field, value [, timezone])Returns TIMESTAMP or TIMESTAMPTZ
Truncates to a supported date/time unit. A timezone argument requires TIMESTAMPTZ; TIMESTAMP input retains TIMESTAMP output.
SELECT DATE_TRUNC('month', '2026-01-15 12:00:00'::timestamp);Source: sql/postgres_function_clock.go:256 · e5e2eb2ISFINITE(value)Returns BOOLEAN
Returns false for supported infinity temporal values, true for finite parsed dates/times. Invalid temporal text fails.
SELECT ISFINITE('2026-01-02'::date);Source: sql/postgres_function_clock.go:13 · e5e2eb2LOCALTIME[(precision)]Returns TIME
Returns the transaction clock’s UTC time without a timezone component.
SELECT LOCALTIME;Source: sql/postgres_function_clock.go:13 · e5e2eb2LOCALTIMESTAMP[(precision)]Returns TIMESTAMP
Returns the transaction clock’s UTC date-time without a timezone component.
SELECT LOCALTIMESTAMP;Source: sql/postgres_function_clock.go:13 · e5e2eb2MAKE_DATE(year, month, day)Returns DATE
Builds a valid DATE from integer components.
SELECT MAKE_DATE(2026, 1, 2);Source: sql/postgres_function_clock.go:13 · e5e2eb2MAKE_TIME(hour, minute, second)Returns TIME
Builds a TIME, including supported fractional seconds.
SELECT MAKE_TIME(12, 34, 56);Source: sql/postgres_function_clock.go:13 · e5e2eb2MAKE_TIMESTAMP(year, month, day, hour, minute, second)Returns TIMESTAMP
Builds a TIMESTAMP without timezone from components.
SELECT MAKE_TIMESTAMP(2026, 1, 2, 12, 34, 56);Source: sql/postgres_function_clock.go:13 · e5e2eb2NOW()Returns TIMESTAMPTZ
Returns the transaction-start timestamp, stable across statements and savepoints within an explicit transaction. Outside a transaction it uses statement time.
SELECT NOW();Source: sql/postgres_function_clock.go:13 · e5e2eb2PG_SLEEP(seconds)Returns TEXT
Waits for a duration and returns empty TEXT on completion. Nonpositive durations return immediately; cancellation interrupts the wait.
Unlike PostgreSQL’s void result, the current engine returns TEXT. NULL input returns NULL.
SELECT PG_SLEEP(0);Source: sql/postgres_function_clock.go:13 · e5e2eb2STATEMENT_TIMESTAMP()Returns TIMESTAMPTZ
Returns the current statement’s initial timestamp.
SELECT STATEMENT_TIMESTAMP();Source: sql/postgres_function_clock.go:13 · e5e2eb2TIMEOFDAY()Returns TEXT
Returns a wall-clock display string rather than a typed timestamp.
SELECT TIMEOFDAY();Source: sql/postgres_function_clock.go:13 · e5e2eb2TO_CHAR(value, template)Returns TEXT
Formats the implemented temporal value/template subset. It does not implement the full PostgreSQL numeric/interval formatter.
SELECT TO_CHAR('2026-01-02'::date, 'YYYY-MM-DD');Source: sql/postgres_function_clock.go:13 · e5e2eb2TO_DATE(text, template)Returns DATE
Parses the implemented date-template subset to a DATE. Invalid and unsupported templates fail.
SELECT TO_DATE('2026-01-02', 'YYYY-MM-DD');Source: sql/postgres_function_clock.go:13 · e5e2eb2TO_TIMESTAMP(epoch_seconds) or TO_TIMESTAMP(text, template)Returns TIMESTAMPTZ
Converts Unix seconds to TIMESTAMPTZ or parses the supported date-template subset.
SELECT TO_TIMESTAMP(0);Source: sql/postgres_function_clock.go:13 · e5e2eb2TRANSACTION_TIMESTAMP()Returns TIMESTAMPTZ
Returns the transaction-start timestamp, stable across statements and savepoints within an explicit transaction. Outside a transaction it uses statement time.
SELECT TRANSACTION_TIMESTAMP();Source: sql/postgres_function_clock.go:13 · e5e2eb2CURRENT_DATABASE()Returns TEXT · requires session or schema setup
Returns the database name from PostgreSQL session context.
SELECT CURRENT_DATABASE();Source: sql/postgres_function_clock.go:13 · e5e2eb2CURRENT_SCHEMA()Returns TEXT
Returns the first existing namespace in the current search path. The native main namespace appears as public.
SELECT CURRENT_SCHEMA();Source: sql/postgres_function_clock.go:13 · e5e2eb2CURRENT_SETTING(name [, missing_ok])Returns TEXT
Returns an implemented session/server setting. Unknown settings fail unless missing_ok is true, in which case NULL is returned.
Supported keys include versions, encodings, DateStyle, TimeZone, standard_conforming_strings, integer_datetimes, isolation, search_path, and selected application settings.
SELECT CURRENT_SETTING('server_encoding');Source: sql/postgres_catalog_functions.go:12 · e5e2eb2CURRENT_USERReturns TEXT · requires session or schema setup
Returns the user name from PostgreSQL session context.
Identity labels do not provide PostgreSQL authorization or role enforcement.
SELECT CURRENT_USER;Source: sql/postgres_function_clock.go:13 · e5e2eb2FORMAT_TYPE(type_oid, typmod)Returns TEXT
Formats a supported type OID and type modifier. Unknown OIDs produce ???; supported varchar/numeric modifiers are formatted.
SELECT FORMAT_TYPE(23, -1);Source: sql/postgres_catalog_functions.go:12 · e5e2eb2PG_BACKEND_PID()Returns INTEGER · requires session or schema setup
Returns the backend ID supplied by the protocol session.
SELECT PG_BACKEND_PID();Source: sql/postgres_function_clock.go:13 · e5e2eb2PG_CLIENT_ENCODING()Returns TEXT
Returns UTF8; broader client-encoding transcoding is unsupported.
SELECT PG_CLIENT_ENCODING();Source: sql/postgres_catalog_functions.go:12 · e5e2eb2PG_ENCODING_TO_CHAR(encoding_id)Returns TEXT
Maps 6 to UTF8 and 0 to SQL_ASCII. Other IDs return an empty string.
SELECT PG_ENCODING_TO_CHAR(6);Source: sql/postgres_catalog_functions.go:12 · e5e2eb2PG_GET_CONSTRAINTDEF(constraint_oid [, pretty])Returns TEXT
Returns the native SQL declaration for a known constraint, or NULL.
SELECT PG_GET_CONSTRAINTDEF(0);Source: sql/postgres_catalog_functions.go:12 · e5e2eb2PG_GET_EXPR(expression, relation_oid [, pretty])Returns TEXT
Returns stored native SQL expression text as supplied. It does not decode PostgreSQL internal expression-node trees.
SELECT PG_GET_EXPR('1 + 2', 0);Source: sql/postgres_catalog_functions.go:12 · e5e2eb2PG_GET_INDEXDEF(index_oid [, column [, pretty]])Returns TEXT
Returns implemented index SQL or a selected indexed-column expression. Supports the catalog’s synthetic primary index projection; unknown OIDs return NULL.
SELECT PG_GET_INDEXDEF(0);Source: sql/postgres_catalog_functions.go:12 · e5e2eb2PG_GET_SERIAL_SEQUENCE(table_name, column_name)Returns TEXT or NULL
Currently returns NULL. SERIAL uses the native ID allocator and has no separate sequence object to name.
SELECT PG_GET_SERIAL_SEQUENCE('items', 'id');Source: sql/postgres_catalog_functions.go:12 · e5e2eb2PG_GET_USERBYID(role_oid)Returns TEXT
Returns the implemented catalog/session user display label for a role OID; it does not establish ownership or privileges.
SELECT PG_GET_USERBYID(10);Source: sql/postgres_catalog_functions.go:12 · e5e2eb2PG_GET_VIEWDEF(view [, pretty])Returns TEXT
Returns stored native SQL for a known view by OID/name; unknown views return NULL. The optional pretty argument does not provide full PostgreSQL deparsing.
SELECT PG_GET_VIEWDEF(0);Source: sql/postgres_catalog_functions.go:12 · e5e2eb2PG_TABLE_IS_VISIBLE(oid)Returns BOOLEAN
Checks relation resolution against the session’s search path. Unrecognized relation OIDs return NULL.
SELECT PG_TABLE_IS_VISIBLE(TO_REGCLASS('missing_table'));Source: sql/postgres_catalog_functions.go:12 · e5e2eb2SESSION_USERReturns TEXT · requires session or schema setup
Returns the user name from PostgreSQL session context.
Identity labels do not provide PostgreSQL authorization or role enforcement.
SELECT SESSION_USER;Source: sql/postgres_function_clock.go:13 · e5e2eb2TO_REGCLASS(name)Returns BIGINT
Resolves a relation in the session’s namespace/catalog view to an OID, or NULL when absent.
SELECT TO_REGCLASS('pg_catalog.pg_class');Source: sql/postgres_catalog_functions.go:12 · e5e2eb2TO_REGNAMESPACE(name)Returns BIGINT
Resolves an existing namespace to its catalog OID, or NULL.
SELECT TO_REGNAMESPACE('public');Source: sql/postgres_catalog_functions.go:12 · e5e2eb2USERReturns TEXT · requires session or schema setup
Returns the user name from PostgreSQL session context.
Identity labels do not provide PostgreSQL authorization or role enforcement.
SELECT USER;Source: sql/postgres_function_clock.go:13 · e5e2eb2VERSION()Returns TEXT
Returns the server’s PostgreSQL compatibility identification string, not a separate PostgreSQL storage engine version.
SELECT VERSION();Source: sql/postgres_function_clock.go:13 · e5e2eb2NUM_NONNULLS(value [, value, ...])Returns INTEGER
Counts SQL NULL arguments (NUM_NULLS) or non-NULL arguments (NUM_NONNULLS). At least one argument is required; SQL NULLs are counted rather than propagated.
SELECT NUM_NONNULLS(1, NULL, 2);Source: sql/postgres_function_extra.go:112 · e5e2eb2NUM_NULLS(value [, value, ...])Returns INTEGER
Counts SQL NULL arguments (NUM_NULLS) or non-NULL arguments (NUM_NONNULLS). At least one argument is required; SQL NULLs are counted rather than propagated.
SELECT NUM_NULLS(1, NULL, 2);Source: sql/postgres_function_extra.go:112 · e5e2eb2GEN_RANDOM_UUID()Returns UUID
Generates a cryptographically random version-4 UUID and returns a typed UUID value. Calls are volatile.
SELECT GEN_RANDOM_UUID();Source: sql/postgres_function_extra.go:122 · e5e2eb2