Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Appropriate values for -Infinity & Infinity in Postgres

Tags:

sql

postgresql

In one of the cases we have to feed values for +infinity & -infinity in Postgres DB?

What should be appropriate value that should be considered.

If there is not 1, then please suggest the best suited.

Thank You

like image 660
rahul s Avatar asked Sep 19 '14 06:09

rahul s


People also ask

What is an appropriate value?

appropriate value means the best price which would be available on a sale which is consistent with the achievement of the objective of the postal administration, Sample 1.

What is value system?

Definition of value system : the system of established values, norms, or goals existing in a society.


1 Answers

You can actually use +infinity and -infinity for FLOAT4 and FLOAT8 (i.e. float and double precision) data types, and for timestamps.

regress=> SELECT FLOAT8 '+infinity', FLOAT8 '-infinity';
  float8  |  float8   
----------+-----------
 Infinity | -Infinity
(1 row)

For other types, either use a separate column, use the minimum/maximum values for the type, or (where logically appropriate) use null.

like image 170
Craig Ringer Avatar answered Oct 18 '22 21:10

Craig Ringer