{"Entry":{"collection":"func","key":"trunc","name":"trunc","aliases":[],"metadata":{"changed_in":["7.3","8.1","10"],"changes":[{"descriptions_changed":false,"doc_overhaul":false,"from":"7.2","group_changed":null,"signatures":{"added":["trunc ( dp or numeric ) → (same as input)","trunc ( v numeric, s integer ) → numeric"],"removed":["trunc ( dp ) → dp","trunc ( numeric, s integer ) → numeric"]},"status":"changed","to":"7.3"},{"descriptions_changed":false,"doc_overhaul":false,"from":"8.0","group_changed":null,"signatures":{"added":["trunc ( v numeric, s int ) → numeric"],"removed":["trunc ( v numeric, s integer ) → numeric"]},"status":"changed","to":"8.1"},{"descriptions_changed":false,"doc_overhaul":false,"from":"9.6","group_changed":null,"signatures":{"added":["trunc ( macaddr8 ) → macaddr8"],"removed":[]},"status":"changed","to":"10"},{"descriptions_changed":false,"doc_overhaul":true,"from":"12","group_changed":null,"signatures":{"added":[],"removed":[]},"status":"changed","to":"13"}],"content_hash":"50bc94d6fbe623c7f8ba9950af68708f65f865b015f23f3831bd616f51121f52","derived_content_hash":"e3b8aff7f62e2d3b1f6951840d08b4083635330c0a7dfcad7f4e7dff0664b5b6","documentation_refresh":{"batch":"20261113","original_source_rev":"wiki-repair-20261023:9754f939793b5680eab5fe7f1eb64a8738b08eefea6a2fc0d5bed6ea365efc5f","versions":{"14":"14.25","15":"15.20","16":"16.16","17":"17.12","18":"18.7","19":"19rc2"}},"first_version":"7.1","group":"math","group_label":"Mathematical Functions And Operators","groups":["math","net"],"imported_at":"2026-09-27T17:57:28.294368+08:00","last_version":"20","name":"trunc","name_key":"trunc","position":2054,"present_in":["7.1","7.2","7.3","7.4","8.0","8.1","8.2","8.3","8.4","9.0","9.1","9.2","9.3","9.4","9.5","9.6","10","11","12","13","14","15","16","17","18","19","20"],"repair_provenance":{"original_source_revision":"wiki-repair-20261023:c1d6b95eec348c50bdf64c8c613bb59b7aa9f3db3af2e134a41455b1e9ef3072","receipt_sha256":"3a7fed604c12ca3ed5ca0781515b97410cb6de189f846954702e6376058cfda6","repair":"wiki-repair-20261023"},"signature":"trunc ( numeric ) → numeric","signature_count":5,"slug":"trunc","source_rev":"wiki-repair-20261023:9754f939793b5680eab5fe7f1eb64a8738b08eefea6a2fc0d5bed6ea365efc5f","summary":"Truncates to integer (towards zero)","summary_zh":""}},"Definition":{"Collection":"func","Key":"trunc","SourceDatabase":"center","Version":"18","SourceTable":"func","SourceKey":"trunc","SourceRevision":"wiki-repair-20261023:9754f939793b5680eab5fe7f1eb64a8738b08eefea6a2fc0d5bed6ea365efc5f","Facts":{"description":"Truncates to integer (towards zero)","description_html":"Truncates to integer (towards zero)","description_zh":"向零截断为整数","description_zh_html":"向零截断为整数","doc":{"anchor":"FUNCTIONS-MATH-FUNC-TABLE","file":"functions-math.html","sha256":"80bdcd3a2c7112aadf400e832cc7c8ee55e389d9b3c12e767c3fbb2b3364ef7b","slug":"18"},"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"},"group":"math","group_label":"数学函数和操作符","lang":"en","layout":"table-new","pages":["functions-math.html","functions-net.html"],"prose_only":false,"signatures":[{"description":"Truncates to integer (towards zero)","description_html":"Truncates to integer (towards zero)","description_zh":"向零截断为整数","description_zh_html":"向零截断为整数","examples":[{"expr":"trunc(42.8)","result":"42"},{"expr":"trunc(-42.8)","result":"-42"}],"html":"\u003ccode class=\"function\"\u003etrunc\u003c/code\u003e ( \u003ccode class=\"type\"\u003enumeric\u003c/code\u003e ) → \u003ccode class=\"returnvalue\"\u003enumeric\u003c/code\u003e","returns":"numeric","text":"trunc ( numeric ) → numeric","zh_from":"same-version-manual"},{"description":"Truncates to integer (towards zero)","description_html":"Truncates to integer (towards zero)","description_zh":"向零截断为整数","description_zh_html":"向零截断为整数","examples":[{"expr":"trunc(42.8)","result":"42"},{"expr":"trunc(-42.8)","result":"-42"}],"html":"\u003ccode class=\"function\"\u003etrunc\u003c/code\u003e ( \u003ccode class=\"type\"\u003edouble precision\u003c/code\u003e ) → \u003ccode class=\"returnvalue\"\u003edouble precision\u003c/code\u003e","returns":"double precision","text":"trunc ( double precision ) → double precision","zh_from":"same-version-manual"},{"description":"Truncates v to s decimal places","description_html":"Truncates \u003cem class=\"parameter\"\u003e\u003ccode\u003ev\u003c/code\u003e\u003c/em\u003e to \u003cem class=\"parameter\"\u003e\u003ccode\u003es\u003c/code\u003e\u003c/em\u003e decimal places","description_zh":"将 v 截断到 s 位小数","description_zh_html":"将 \u003cem class=\"parameter\"\u003e\u003ccode\u003ev\u003c/code\u003e\u003c/em\u003e 截断到 \u003cem class=\"parameter\"\u003e\u003ccode\u003es\u003c/code\u003e\u003c/em\u003e 位小数","examples":[{"expr":"trunc(42.4382, 2)","result":"42.43"}],"html":"\u003ccode class=\"function\"\u003etrunc\u003c/code\u003e ( \u003cem class=\"parameter\"\u003e\u003ccode\u003ev\u003c/code\u003e\u003c/em\u003e \u003ccode class=\"type\"\u003enumeric\u003c/code\u003e, \u003cem class=\"parameter\"\u003e\u003ccode\u003es\u003c/code\u003e\u003c/em\u003e \u003ccode class=\"type\"\u003einteger\u003c/code\u003e ) → \u003ccode class=\"returnvalue\"\u003enumeric\u003c/code\u003e","returns":"numeric","text":"trunc ( v numeric, s integer ) → numeric","zh_from":"same-version-manual"},{"description":"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).","description_html":"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 \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e).","description_zh":"将地址的最后 3 个字节设置为零。其余的前缀可以与特定的制造商关联（使用 PostgreSQL 中没有包含的数据）。","description_zh_html":"将地址的最后 3 个字节设置为零。其余的前缀可以与特定的制造商关联（使用 \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e 中没有包含的数据）。","examples":[{"expr":"trunc(macaddr '12:34:56:78:90:ab')","result":"12:34:56:00:00:00"}],"html":"\u003ccode class=\"function\"\u003etrunc\u003c/code\u003e ( \u003ccode class=\"type\"\u003emacaddr\u003c/code\u003e ) → \u003ccode class=\"returnvalue\"\u003emacaddr\u003c/code\u003e","returns":"macaddr","text":"trunc ( macaddr ) → macaddr","zh_from":"same-version-manual"},{"description":"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).","description_html":"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 \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e).","description_zh":"将地址的最后 5 个字节设置为零。其余的前缀可以与特定的制造商关联（使用 PostgreSQL 中没有包含的数据）。","description_zh_html":"将地址的最后 5 个字节设置为零。其余的前缀可以与特定的制造商关联（使用 \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e 中没有包含的数据）。","examples":[{"expr":"trunc(macaddr8 '12:34:56:78:90:ab:cd:ef')","result":"12:34:56:00:00:00:00:00"}],"html":"\u003ccode class=\"function\"\u003etrunc\u003c/code\u003e ( \u003ccode class=\"type\"\u003emacaddr8\u003c/code\u003e ) → \u003ccode class=\"returnvalue\"\u003emacaddr8\u003c/code\u003e","returns":"macaddr8","text":"trunc ( macaddr8 ) → macaddr8","zh_from":"same-version-manual"}],"translation_provenance":{"inputs":[{"kind":"current-pgdoc-translation","path":"/Users/vonng/pgsty/pgdoc/zh/18/html/functions-math.html","sha256":"b5f393c537ea29401867ea8b97292650ee67b0dd9e8cde535aae77bc594b3736"}],"kind":"same-version-pgdoc","locale":"zh-Hans","source_revision":"b1b500221dbe5437cfca004d6b04d3f6e422765d","version":"18"},"zh_from":"same-version-manual"},"ManualEvidence":{"doc":{"anchor":"FUNCTIONS-MATH-FUNC-TABLE","file":"functions-math.html","sha256":"80bdcd3a2c7112aadf400e832cc7c8ee55e389d9b3c12e767c3fbb2b3364ef7b","slug":"18"}},"MeasuredEvidence":{}},"Text":{"Collection":"func","Key":"trunc","SourceDatabase":"center","Version":"18","Locale":"en","Title":"trunc","Summary":"Truncates to integer (towards zero)","BodyHTML":"Truncates to integer (towards zero)","SourceRevision":"wiki-repair-20261023:9754f939793b5680eab5fe7f1eb64a8738b08eefea6a2fc0d5bed6ea365efc5f","ContentHash":"622066e0f1ecefe0cefb32902d4afb515ee7903ffbd2433ceee212f2521a8b68","Payload":{"description":"Truncates to integer (towards zero)","description_html":"Truncates to integer (towards zero)","signatures":[{"description":"Truncates to integer (towards zero)","description_html":"Truncates to integer (towards zero)","description_zh":"向零截断为整数","description_zh_html":"向零截断为整数","examples":[{"expr":"trunc(42.8)","result":"42"},{"expr":"trunc(-42.8)","result":"-42"}],"html":"\u003ccode class=\"function\"\u003etrunc\u003c/code\u003e ( \u003ccode class=\"type\"\u003enumeric\u003c/code\u003e ) → \u003ccode class=\"returnvalue\"\u003enumeric\u003c/code\u003e","returns":"numeric","text":"trunc ( numeric ) → numeric","zh_from":"same-version-manual"},{"description":"Truncates to integer (towards zero)","description_html":"Truncates to integer (towards zero)","description_zh":"向零截断为整数","description_zh_html":"向零截断为整数","examples":[{"expr":"trunc(42.8)","result":"42"},{"expr":"trunc(-42.8)","result":"-42"}],"html":"\u003ccode class=\"function\"\u003etrunc\u003c/code\u003e ( \u003ccode class=\"type\"\u003edouble precision\u003c/code\u003e ) → \u003ccode class=\"returnvalue\"\u003edouble precision\u003c/code\u003e","returns":"double precision","text":"trunc ( double precision ) → double precision","zh_from":"same-version-manual"},{"description":"Truncates v to s decimal places","description_html":"Truncates \u003cem class=\"parameter\"\u003e\u003ccode\u003ev\u003c/code\u003e\u003c/em\u003e to \u003cem class=\"parameter\"\u003e\u003ccode\u003es\u003c/code\u003e\u003c/em\u003e decimal places","description_zh":"将 v 截断到 s 位小数","description_zh_html":"将 \u003cem class=\"parameter\"\u003e\u003ccode\u003ev\u003c/code\u003e\u003c/em\u003e 截断到 \u003cem class=\"parameter\"\u003e\u003ccode\u003es\u003c/code\u003e\u003c/em\u003e 位小数","examples":[{"expr":"trunc(42.4382, 2)","result":"42.43"}],"html":"\u003ccode class=\"function\"\u003etrunc\u003c/code\u003e ( \u003cem class=\"parameter\"\u003e\u003ccode\u003ev\u003c/code\u003e\u003c/em\u003e \u003ccode class=\"type\"\u003enumeric\u003c/code\u003e, \u003cem class=\"parameter\"\u003e\u003ccode\u003es\u003c/code\u003e\u003c/em\u003e \u003ccode class=\"type\"\u003einteger\u003c/code\u003e ) → \u003ccode class=\"returnvalue\"\u003enumeric\u003c/code\u003e","returns":"numeric","text":"trunc ( v numeric, s integer ) → numeric","zh_from":"same-version-manual"},{"description":"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).","description_html":"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 \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e).","description_zh":"将地址的最后 3 个字节设置为零。其余的前缀可以与特定的制造商关联（使用 PostgreSQL 中没有包含的数据）。","description_zh_html":"将地址的最后 3 个字节设置为零。其余的前缀可以与特定的制造商关联（使用 \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e 中没有包含的数据）。","examples":[{"expr":"trunc(macaddr '12:34:56:78:90:ab')","result":"12:34:56:00:00:00"}],"html":"\u003ccode class=\"function\"\u003etrunc\u003c/code\u003e ( \u003ccode class=\"type\"\u003emacaddr\u003c/code\u003e ) → \u003ccode class=\"returnvalue\"\u003emacaddr\u003c/code\u003e","returns":"macaddr","text":"trunc ( macaddr ) → macaddr","zh_from":"same-version-manual"},{"description":"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).","description_html":"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 \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e).","description_zh":"将地址的最后 5 个字节设置为零。其余的前缀可以与特定的制造商关联（使用 PostgreSQL 中没有包含的数据）。","description_zh_html":"将地址的最后 5 个字节设置为零。其余的前缀可以与特定的制造商关联（使用 \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e 中没有包含的数据）。","examples":[{"expr":"trunc(macaddr8 '12:34:56:78:90:ab:cd:ef')","result":"12:34:56:00:00:00:00:00"}],"html":"\u003ccode class=\"function\"\u003etrunc\u003c/code\u003e ( \u003ccode class=\"type\"\u003emacaddr8\u003c/code\u003e ) → \u003ccode class=\"returnvalue\"\u003emacaddr8\u003c/code\u003e","returns":"macaddr8","text":"trunc ( macaddr8 ) → macaddr8","zh_from":"same-version-manual"}]}},"RequestedLocale":"en","Fallback":false,"Versions":["10","11","12","13","14","15","16","17","18","19","20","7.1","7.2","7.3","7.4","8.0","8.1","8.2","8.3","8.4","9.0","9.1","9.2","9.3","9.4","9.5","9.6"],"Locales":["en","zh-Hans"],"Signatures":[{"Version":"18","Ordinal":0,"Hash":"f181281fbdf75235bf587319a9f68d341ebaa8c8a12bd4ecacbe08ad73734f9f","Text":"trunc ( numeric ) → numeric","Returns":"numeric","Payload":{"description":"Truncates to integer (towards zero)","description_html":"Truncates to integer (towards zero)","description_zh":"向零截断为整数","description_zh_html":"向零截断为整数","examples":[{"expr":"trunc(42.8)","result":"42"},{"expr":"trunc(-42.8)","result":"-42"}],"html":"\u003ccode class=\"function\"\u003etrunc\u003c/code\u003e ( \u003ccode class=\"type\"\u003enumeric\u003c/code\u003e ) → \u003ccode class=\"returnvalue\"\u003enumeric\u003c/code\u003e","returns":"numeric","text":"trunc ( numeric ) → numeric","zh_from":"same-version-manual"}},{"Version":"18","Ordinal":1,"Hash":"a683d58a3fe0958c78fc5159e057053d975dde3a9b5e8047f1abb4eea9fcadec","Text":"trunc ( double precision ) → double precision","Returns":"double precision","Payload":{"description":"Truncates to integer (towards zero)","description_html":"Truncates to integer (towards zero)","description_zh":"向零截断为整数","description_zh_html":"向零截断为整数","examples":[{"expr":"trunc(42.8)","result":"42"},{"expr":"trunc(-42.8)","result":"-42"}],"html":"\u003ccode class=\"function\"\u003etrunc\u003c/code\u003e ( \u003ccode class=\"type\"\u003edouble precision\u003c/code\u003e ) → \u003ccode class=\"returnvalue\"\u003edouble precision\u003c/code\u003e","returns":"double precision","text":"trunc ( double precision ) → double precision","zh_from":"same-version-manual"}},{"Version":"18","Ordinal":2,"Hash":"1987feb42e3596a2122b4d75cadf314f20f5cd7d889cfe5532ed95e93a420e52","Text":"trunc ( v numeric, s integer ) → numeric","Returns":"numeric","Payload":{"description":"Truncates v to s decimal places","description_html":"Truncates \u003cem class=\"parameter\"\u003e\u003ccode\u003ev\u003c/code\u003e\u003c/em\u003e to \u003cem class=\"parameter\"\u003e\u003ccode\u003es\u003c/code\u003e\u003c/em\u003e decimal places","description_zh":"将 v 截断到 s 位小数","description_zh_html":"将 \u003cem class=\"parameter\"\u003e\u003ccode\u003ev\u003c/code\u003e\u003c/em\u003e 截断到 \u003cem class=\"parameter\"\u003e\u003ccode\u003es\u003c/code\u003e\u003c/em\u003e 位小数","examples":[{"expr":"trunc(42.4382, 2)","result":"42.43"}],"html":"\u003ccode class=\"function\"\u003etrunc\u003c/code\u003e ( \u003cem class=\"parameter\"\u003e\u003ccode\u003ev\u003c/code\u003e\u003c/em\u003e \u003ccode class=\"type\"\u003enumeric\u003c/code\u003e, \u003cem class=\"parameter\"\u003e\u003ccode\u003es\u003c/code\u003e\u003c/em\u003e \u003ccode class=\"type\"\u003einteger\u003c/code\u003e ) → \u003ccode class=\"returnvalue\"\u003enumeric\u003c/code\u003e","returns":"numeric","text":"trunc ( v numeric, s integer ) → numeric","zh_from":"same-version-manual"}},{"Version":"18","Ordinal":3,"Hash":"aed5f8c450a2e21916466e607bcaa46e3c47160608e66be1496883028960526d","Text":"trunc ( macaddr ) → macaddr","Returns":"macaddr","Payload":{"description":"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).","description_html":"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 \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e).","description_zh":"将地址的最后 3 个字节设置为零。其余的前缀可以与特定的制造商关联（使用 PostgreSQL 中没有包含的数据）。","description_zh_html":"将地址的最后 3 个字节设置为零。其余的前缀可以与特定的制造商关联（使用 \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e 中没有包含的数据）。","examples":[{"expr":"trunc(macaddr '12:34:56:78:90:ab')","result":"12:34:56:00:00:00"}],"html":"\u003ccode class=\"function\"\u003etrunc\u003c/code\u003e ( \u003ccode class=\"type\"\u003emacaddr\u003c/code\u003e ) → \u003ccode class=\"returnvalue\"\u003emacaddr\u003c/code\u003e","returns":"macaddr","text":"trunc ( macaddr ) → macaddr","zh_from":"same-version-manual"}},{"Version":"18","Ordinal":4,"Hash":"8a28c3f566eb5718a49b5b48fb28ab124bfe41637ac790ff1e08baba868a1826","Text":"trunc ( macaddr8 ) → macaddr8","Returns":"macaddr8","Payload":{"description":"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).","description_html":"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 \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e).","description_zh":"将地址的最后 5 个字节设置为零。其余的前缀可以与特定的制造商关联（使用 PostgreSQL 中没有包含的数据）。","description_zh_html":"将地址的最后 5 个字节设置为零。其余的前缀可以与特定的制造商关联（使用 \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e 中没有包含的数据）。","examples":[{"expr":"trunc(macaddr8 '12:34:56:78:90:ab:cd:ef')","result":"12:34:56:00:00:00:00:00"}],"html":"\u003ccode class=\"function\"\u003etrunc\u003c/code\u003e ( \u003ccode class=\"type\"\u003emacaddr8\u003c/code\u003e ) → \u003ccode class=\"returnvalue\"\u003emacaddr8\u003c/code\u003e","returns":"macaddr8","text":"trunc ( macaddr8 ) → macaddr8","zh_from":"same-version-manual"}}],"Spellings":null,"SQLState":null,"Evidence":null}
