Does PostgreSQL numeric type support infinity (and -infinity)?
NUMERIC
does not support +-infinity, though it does support NaN. That's rather an unfortunate limitation. Addressing it would probably require changing the on-disk binary format of numeric
which could be challenging...
craig=> SELECT NUMERIC 'NaN';
numeric
---------
NaN
(1 row)
craig=> SELECT NUMERIC '-inf';
ERROR: invalid input syntax for type numeric: "-inf"
LINE 1: SELECT NUMERIC '-inf';
^
craig=> SELECT NUMERIC '+inf';
ERROR: invalid input syntax for type numeric: "+inf"
LINE 1: SELECT NUMERIC '+inf';
craig=> SELECT NUMERIC '+infinity';
ERROR: invalid input syntax for type numeric: "+infinity"
LINE 1: SELECT NUMERIC '+infinity';
^
craig=> SELECT NUMERIC 'infinity';
ERROR: invalid input syntax for type numeric: "infinity"
LINE 1: SELECT NUMERIC 'infinity';
^
craig=> SELECT NUMERIC '-infinity';
ERROR: invalid input syntax for type numeric: "-infinity"
LINE 1: SELECT NUMERIC '-infinity';
PostgreSQL will support numeric +inf/-inf from v14