Re: pgsql 10.19 : "ERROR: cannot convert infinity to numeric" except there is no infinity - Mailing list pgsql-general

From David G. Johnston
Subject Re: pgsql 10.19 : "ERROR: cannot convert infinity to numeric" except there is no infinity
Date
Msg-id CAKFQuwZ6o+ZLKmAsnD2gGj+qxRvtQRs7JOQrn8jW9tP=M2N0MA@mail.gmail.com
Whole thread Raw
In response to pgsql 10.19 : "ERROR: cannot convert infinity to numeric" except there is no infinity  (Achilleas Mantzios <achill@matrix.gatewaynet.com>)
Responses Re: pgsql 10.19 : "ERROR: cannot convert infinity to numeric" except there is no infinity  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: pgsql 10.19 : "ERROR: cannot convert infinity to numeric" except there is no infinity  (Achilleas Mantzios <achill@matrix.gatewaynet.com>)
List pgsql-general
On Tuesday, July 19, 2022, Achilleas Mantzios <achill@matrix.gatewaynet.com> wrote:

ERROR:  cannot convert infinity to numeric

-- has no problem testing against infinity

select it.id ,cept.value::numeric as val, numrange(ceptl.min_alarm::numeric,ceptl.max_alarm::numeric
,'()') as range from items it, cept_report cept , dynacom.vessels vsl, machdefs md, cept_reportlimits ceptl wh
ere it.id=cept.id AND md.defid=ceptl.defid AND it.defid=md.defid AND it.vslwhid=vsl.id AND vsl.vslstatus='Acti
ve' and md.application = 'Critical Equipment Performance Test' AND cept.systemdate>= (now()-'1 year'::interval
) AND  cept.value='inf' ORDER BY 1;             
id | val | range  
----+-----+-------
(0 rows)


The column cept.value contains an infinity.  I see nothing unusual in any of these queries given that fact.  If you try to cast the infinity to numeric it will fail.  If that doesn’t happen the query won’t fail.

David J.

pgsql-general by date:

Previous
From: "David G. Johnston"
Date:
Subject: Re: How to handle failed COMMIT
Next
From: Tom Lane
Date:
Subject: Re: pgsql 10.19 : "ERROR: cannot convert infinity to numeric" except there is no infinity