PostgreSQL TRUNC returns a number cut toward zero, with the extra decimals dropped, not rounded. trunc(189.999, 2) returns 189.99, while round() gives 190.00.
The catch I hit first: the two-argument form only takes numeric. A double precision column fails with “function trunc(double precision, integer) does not exist”.
Five examples follow: cents, negative values, hundreds, that float error, and dates. Tested on PostgreSQL 18.6 with psql in VS Code.
PostgreSQL TRUNC Function Syntax
Here is the syntax:
trunc ( numeric ) → numeric
trunc ( double precision ) → double precision
trunc ( v numeric, s integer ) → numeric
| Argument | Required | What it means |
|---|---|---|
v | Yes | Value to cut. NULL gives NULL. |
s | No | Decimal places (default 0). Negative cuts left of the point. |
Return value: numeric for trunc(v, s); trunc(v) keeps the input type.
Availability: every supported PostgreSQL version. A separate trunc(macaddr) zeroes a MAC address’s last 3 bytes.
When to Use the TRUNC Function in PostgreSQL
Use TRUNC in PostgreSQL when you need to:
- cut prices or rates to cents without rounding up
- get whole dollars from an amount
- bucket amounts into hundreds for a report
The column type decides which form runs, so check PostgreSQL data types if you’re unsure.
Run this once. Every example uses it:
CREATE TABLE price_list (
sku varchar(8) PRIMARY KEY,
item varchar(16),
unit_cost numeric(10,4),
price_chg numeric(8,2),
weight_lb double precision
);
INSERT INTO price_list VALUES
('TX-1001', 'Desk Lamp', 12.3456, -7.89, 3.75),
('OH-2040', 'Office Chair', 189.9990, 15.40, 41.2),
('CA-3300', 'Standing Desk', 1234.5000, -120.55, 88.125),
('NY-0420', 'Monitor Arm', 64.0875, 0.00, 6.6667),
('FL-7788', 'Paper Shredder', 89.4999, NULL, NULL);
Example 1: Truncate a Number to 2 Decimal Places in PostgreSQL
The common job first. I want unit_cost cut to cents, next to round(). Here’s the query:
SELECT sku, unit_cost,
trunc(unit_cost, 2) AS truncated,
round(unit_cost, 2) AS rounded
FROM price_list
WHERE sku IN ('TX-1001', 'OH-2040');
Output:
sku | unit_cost | truncated | rounded
---------+-----------+-----------+---------
TX-1001 | 12.3456 | 12.34 | 12.35
OH-2040 | 189.9990 | 189.99 | 190.00
(2 rows)

For OH-2040, trunc returns 189.99 and round returns 190.00.
Run the SELECT again and you should see the same rows: TRUNC doesn’t touch the stored value. For dollar signs and commas, I have a separate tutorial on how to format numbers in PostgreSQL.
Example 2: Get the Integer Part of a Negative Number
Now the price cuts in price_chg. Say you need their whole-dollar part:
SELECT sku, price_chg,
trunc(price_chg) AS trunc,
floor(price_chg) AS floor
FROM price_list
WHERE price_chg < 0;
Output:
sku | price_chg | trunc | floor
---------+-----------+-------+-------
TX-1001 | -7.89 | -7 | -8
CA-3300 | -120.55 | -120 | -121
(2 rows)

For TX-1001, trunc(-7.89) returns -7, but FLOOR gives -8.
TRUNC moves toward zero, while FLOOR always moves down, and for a negative number down means away from zero. To label cuts and increases, wrap the column in a PostgreSQL CASE expression.
Example 3: Truncate to Tens or Hundreds with a Negative Scale
A negative s works left of the decimal point. The goal is a ballpark cost for the Standing Desk:
SELECT unit_cost,
trunc(unit_cost, -1) AS tens,
trunc(unit_cost, -2) AS hundreds,
trunc(unit_cost, -3) AS thousands
FROM price_list
WHERE sku = 'CA-3300';
Output:
unit_cost | tens | hundreds | thousands
-----------+------+----------+-----------
1234.5000 | 1230 | 1200 | 1000
(1 row)
For CA-3300, this returns 1230, 1200 and 1000. It won’t round up to 1300.
For price bands, group on trunc(unit_cost, -2) with PostgreSQL GROUP BY.
Example 4: Fix “function trunc(double precision, integer) does not exist”
weight_lb is double precision. You want it to 2 decimals:
SELECT sku, trunc(weight_lb, 2) FROM price_list;
Output:
psql:trunc-double-precision-error.sql:1: ERROR: function trunc(double precision, integer) does not exist
LINE 1: SELECT sku, trunc(weight_lb, 2) FROM price_list;
^
HINT: No function matches the given name and argument types. You might need to add explicit type casts.

Cast to numeric and it’s fine:
SELECT sku, weight_lb,
trunc(weight_lb::numeric, 2) AS weight_2dp
FROM price_list
WHERE sku IN ('CA-3300', 'FL-7788');
Output:
sku | weight_lb | weight_2dp
---------+-----------+------------
CA-3300 | 88.125 | 88.12
FL-7788 | |
(2 rows)
The fix returns 88.12 for CA-3300; the NULL weight stays empty.
My PostgreSQL CAST tutorial compares :: with CAST().
Example 5: Truncate a Date or Timestamp (Use date_trunc)
Oracle users type TRUNC(SYSDATE) from habit. You want today without the time, so you try now():
SET TimeZone = 'America/New_York';
SELECT trunc(now());
Output:
psql:trunc-timestamp-error.sql:2: ERROR: function trunc(timestamp with time zone) does not exist
LINE 1: SELECT trunc(now());
^
HINT: No function matches the given name and argument types. You might need to add explicit type casts.

date_trunc does this job:
SET TimeZone = 'America/New_York';
SELECT date_trunc('day', now()) AS day_start,
now()::date AS just_date;
Output:
day_start | just_date
------------------------+------------
2026-11-26 00:00:00-05 | 2026-11-26
(1 row)
On 11/26/2026 this returns midnight as day_start and 2026-11-26 as just_date. My PostgreSQL date_trunc tutorial covers every field.
TRUNC vs ROUND vs FLOOR in PostgreSQL: Which Should You Use?
| Input | trunc | round | floor |
|---|---|---|---|
| 7.89 | 7 | 8 | 7 |
| -7.89 | -7 | -8 | -8 |
My rule of thumb: TRUNC when digits must go, ROUND for money people see. The PostgreSQL ROUND function post covers 2.5 ties.
Tips & Common Mistakes
- NULL in, NULL out:
trunc(1.5, NULL)returns NULL. - The scale must be an integer:
trunc(12.3456, 2.5)gavefunction trunc(numeric, numeric) does not exist. - A bigger scale pads:
trunc(5.1, 3)returns 5.100.
Wrapping Up
PostgreSQL TRUNC drops digits: trunc(value, 2) on numeric. Copy Example 4 for float columns.
Next step: total the cut prices with PostgreSQL SUM. See the complete list of PostgreSQL functions and the PostgreSQL 18 math functions page.
More number tutorials for PostgreSQL users:
Frequently Asked Questions
Is there a TRUNCATE() function in PostgreSQL like MySQL?
No. truncate(12.3456, 2) fails with function truncate(numeric, integer) does not exist. Use trunc().
Does casting to integer truncate decimals in PostgreSQL?
No, it rounds: 7.89::int returned 8.
How do I truncate decimals in SQL Server?
SQL Server doesn’t have a numeric TRUNC. ROUND(189.999, 2, 1) returns 189.990.

Kumar Saurabh is a freelance software engineer who builds web and mobile apps with Next.js, React, Flutter and Python. From 2021 to 2024, Saurabh worked as an IT analyst and developer at TSInfo Technologies, writing technical articles on SQL and PostgreSQL. Saurabh writes the PostgreSQL, MySQL, MariaDB and MongoDB tutorials on DatabaseFAQs.com and holds a Master of Computer Applications (MCA) from Chandigarh University.