↑↓ select↵ open⌫ change scopeOpen full search

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

Wiki / Functions

trunc

Truncates to integer (towards zero)

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
math
group label
数学函数和操作符
lang
en
layout
table-new
pages
functions-math.html, functions-net.html
prose only
false

Definition PG 18

Truncates to integer (towards zero)

Signatures and overloads

trunc ( numeric ) → numeric → numeric
Truncates to integer (towards zero)
trunc ( double precision ) → double precision → double precision
Truncates to integer (towards zero)
trunc ( v numeric, s integer ) → numeric → numeric
Truncates v to s decimal places
trunc ( macaddr ) → macaddr → macaddr
Sets the last 3 bytes of the address to zero. The remaining prefix can be associated with a particular manufacturer (using data not included in PostgreSQL).
trunc ( macaddr8 ) → macaddr8 → macaddr8
Sets the last 5 bytes of the address to zero. The remaining prefix can be associated with a particular manufacturer (using data not included in PostgreSQL).

Compare versions

Complete source facts

documentation revision

{"inputs":[{"file":"functions-math.html","kind":"same-version-reviewed-manual","locale":"en","sha256":"80bdcd3a2c7112aadf400e832cc7c8ee55e389d9b3c12e767c3fbb2b3364ef7b","version":"18.7"},{"file":"functions-net.html","kind":"same-version-reviewed-manual","locale":"en","sha256":"68d9f05d5a4254ad69f62af59eef6d7a3acc8329e3df4c1d25c1c7400eff9bbf","version":"18.7"},{"file":"functions-math.html","kind":"same-version-reviewed-manual","locale":"zh-Hans","sha256":"b48c7e1d8abf0f030ad0ef2aa1403db7015a96af265d49a15eaa2f1945a13a5f","version":"18.7"},{"file":"functions-net.html","kind":"same-version-reviewed-manual","locale":"zh-Hans","sha256":"e63995c3c24654476f618a0cc0f6c16612a97a831a774e62d5482ca05d43bb85","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:9754f939793b5680eab5fe7f1eb64a8738b08eefea6a2fc0d5bed6ea365efc5f

Text language: en · wiki-repair-20261023:9754f939793b5680eab5fe7f1eb64a8738b08eefea6a2fc0d5bed6ea365efc5f