type
NUMERIC
PostgreSQL treats NUMERIC and DECIMAL equivalently. A declared precision can reject a value after rounding if its integral part is too large. Example target: PostgreSQL 17. Run in a disposable database; examples need no existing tables.
Formal Syntax & Structure
sql syntaxsql
NUMERIC(p,s)Working Example
Example Snippetsql
SELECT CAST(CAST(0.1 AS NUMERIC(4,2)) + CAST(0.2 AS NUMERIC(4,2)) AS TEXT);