(TIL) PSQL: Limit Execution Time Of StatementsSpecial Math Operators

less than 1 minute read

Postgres has all the mathematical operators you might expect in any programming language (e.g. +,-,*,/,%). It also has a few extras that you might not be expecting.

Factorial Operator:

> select 5!;
 ?column?
----------
      120
(1 row)

Square Root Operator:

> select |/81;
 ?column?
----------
        9
(1 row)

Absolute Value Operator:

> select @ -23.4;
 ?column?
----------
     23.4
(1 row)

Via jbranchaud/til.

Comments