↑↓ select↵ open⌫ change scopeOpen full search

PG.CENTER connects PostgreSQL documentation, reference, and ecosystem knowledge. Maintained by Pigsty.

Wiki / Functions

format

Formats arguments according to a format string; see Section 9.4.1. This function is similar to the C function sprintf.

English manual coverage begins with PostgreSQL 7.1. Source history and runtime observations have their own recorded version boundaries.

Reading PG 18·Select a recorded version

group
string
group label
字符串函数和操作符
lang
en
layout
table-new
pages
functions-string.html
prose only
false

Definition PG 18

Formats arguments according to a format string; see Section 9.4.1. This function is similar to the C function sprintf.

Signatures and overloads

format ( formatstr text [, formatarg "any" [, ...] ] ) → text → text
Formats arguments according to a format string; see Section 9.4.1. This function is similar to the C function sprintf.
format(formatstr text [, formatarg "any" [, ...] ])
formatstr is a format string that specifies how the result should be formatted. Text in the format string is copied directly to the result, except where format specifiers are used. Format specifiers act as placeholders in the string, defining how subsequent function arguments should be formatted and inserted into the result. Each formatarg argument is converted to text according to the usual output rules for its data type, and then formatted and inserted into the result string according to the format specifier(s).

Compare versions

Complete source facts

documentation revision

{"inputs":[{"file":"functions-string.html","kind":"same-version-reviewed-manual","locale":"en","sha256":"dbe9f91e55c35969d99a8d2697b6f7bd5388a24ccc2b89706a666f176025f1e2","version":"18.7"},{"file":"functions-string.html","kind":"same-version-reviewed-manual","locale":"zh-Hans","sha256":"7eecd3bb343149124be0476a539f3c682476eab2a15489a0e0ad06fbb769ea9e","version":"18.7"}],"release":"18.7","runtime_remeasured":false,"source_revision":"pgdoc:b9f0e7232f60f380d642ac9b99226606c254b552"}

Source references

Full definition and evidence JSON

Definition sources

center · PostgreSQL 18 · wiki-repair-20261023:6b48f95e3d1790b8f05da7cf33187c4a65395bd5df2143261efa33134899e967

Text language: en · wiki-repair-20261023:6b48f95e3d1790b8f05da7cf33187c4a65395bd5df2143261efa33134899e967