Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oDkvh-0003mH-8e for pgsql-general@arkaria.postgresql.org; Tue, 19 Jul 2022 10:58:17 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1oDkvg-0004XP-36 for pgsql-general@arkaria.postgresql.org; Tue, 19 Jul 2022 10:58:16 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oDkvf-0004Wn-Kj for pgsql-general@lists.postgresql.org; Tue, 19 Jul 2022 10:58:15 +0000 Received: from hermes.gatewaynet.com ([193.92.121.98]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oDkvc-00024J-7w for pgsql-general@lists.postgresql.org; Tue, 19 Jul 2022 10:58:14 +0000 Received: from smadev.internal.net (pc131.internal.net [10.9.200.131]) by hermes.gatewaynet.com (8.15.2/8.15.2/Debian-8+deb9u1) with ESMTPS id 26JAw2vP002738 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 19 Jul 2022 13:58:07 +0300 Received: from [10.9.200.131] (smadev [10.9.200.131]) by smadev.internal.net (8.16.1/8.16.1) with ESMTP id 26JAcXa8072798 for ; Tue, 19 Jul 2022 13:38:33 +0300 (EEST) (envelope-from achill@matrix.gatewaynet.com) Content-Type: multipart/alternative; boundary="------------DcSBcGFG8ozJNHbW3w4maIJc" Message-ID: <1c9f27e7-459e-2e05-7129-e9e14ca503b7@matrix.gatewaynet.com> Date: Tue, 19 Jul 2022 13:38:33 +0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:91.0) Gecko/20100101 Thunderbird/91.10.0 To: "pgsql-general@lists.postgresql.org" Content-Language: en-US From: Achilleas Mantzios Subject: pgsql 10.19 : "ERROR: cannot convert infinity to numeric" except there is no infinity X-Virus-Scanned: clamav-milter 0.103.4 at hermes X-Virus-Status: Clean X-Spam-Status: No, score=-33.5 required=5.0 tests=ALL_TRUSTED,DYN_HAM_COORD, DYN_HAM_IT,DYN_HAM_NAUTICAL,DYN_HAM_SHORT_BODY,DYN_HAM_VMA_BODY, HTML_MESSAGE,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on hermes.gatewaynet.com List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk This is a multi-part message in MIME format. --------------DcSBcGFG8ozJNHbW3w4maIJc Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit dynacom=# 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 < -100 ORDER BY 1; id | val | range ----+-----+------- (0 rows) 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::numeric>'-1' ORDER BY 1; 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) -- still has problem testing the range 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  numrange(ceptl.min_alarm::numeric,ceptl.max_alarm::numeric,'()') @> cept.value::numeric ORDER BY 1; ERROR:  cannot convert infinity to numeric -- no problem if the query goes into its barrier and the test done outside with bar as (select it.id ,cept.value::numeric as val, numrange(ceptl.min_alarm::numeric,ceptl.max_a larm::numeric,'()') as range from items it, cept_report cept , dynacom.vessels vsl, machdefs md, cept_reportli mits ceptl where it.id=cept.id AND md.defid=ceptl.defid AND it.defid=md.defid AND it.vslwhid=vsl.id AND vsl.vs lstatus='Active' and md.application = 'Critical Equipment Performance Test' AND cept.systemdate>= (now()-'1 ye ar'::interval)  ORDER BY 1) select * from bar where NOT range @> val; -- good data here -- Achilleas Mantzios DBA, Analyst, IT Lead IT DEPT Dynacom Tankers Mgmt --------------DcSBcGFG8ozJNHbW3w4maIJc Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 8bit dynacom=# 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 < -100 ORDER BY 1;   
id | val | range  
----+-----+-------
(0 rows)


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::numeric>'-1' ORDER BY 1;            
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)

-- still has problem testing the range

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  numrange(ceptl.min_alarm::numeric,ceptl.max_alarm::numeric,'()') @> cept.value::numeric ORDER BY 1;     
ERROR:  cannot convert infinity to numeric


-- no problem if the query goes into its barrier and the test done outside
with bar as (select it.id ,cept.value::numeric as val, numrange(ceptl.min_alarm::numeric,ceptl.max_a
larm::numeric,'()') as range from items it, cept_report cept , dynacom.vessels vsl, machdefs md, cept_reportli
mits ceptl where it.id=cept.id AND md.defid=ceptl.defid AND it.defid=md.defid AND it.vslwhid=vsl.id AND vsl.vs
lstatus='Active' and md.application = 'Critical Equipment Performance Test' AND cept.systemdate>= (now()-'1 ye
ar'::interval)  ORDER BY 1)  
select * from bar where NOT range @> val;
-- good data here

-- 
Achilleas Mantzios
DBA, Analyst, IT Lead
IT DEPT
Dynacom Tankers Mgmt
--------------DcSBcGFG8ozJNHbW3w4maIJc--