select open change scope Open full search

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

Unsupported versions: 7.0
Historical version. PostgreSQL 7.0 reached end of support in May 2005. See the current manual for supported releases.

Numerical Operators

Table 4-3. Postgres Numerical Operators

Operator Description Usage
! Factorial 3 !
!! Factorial (left operator) !! 3
% Modulo 5 % 4
% Truncate % 4.5
* Multiplication 2 * 3
+ Addition 2 + 3
- Subtraction 2 - 3
/ Division 4 / 2
: Natural Exponentiation : 3.0
@ Absolute value @ -5.0
^ Exponentiation 2.0 ^ 3.0
|/ Square root |/ 25.0
||/ Cube root ||/ 27.0

Note: Two operators, ":" and ";", are now deprecated and will be removed in the next release. Use the equivalent functions exp() and ln() instead.

Report a documentation issue

Read the upstream documentation. For corrections, first check the current manual.