Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iJJTd-0006GX-BG for pgsql-general@arkaria.postgresql.org; Sat, 12 Oct 2019 15:38:41 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1iJJSe-0005PI-68 for pgsql-general@arkaria.postgresql.org; Sat, 12 Oct 2019 15:37:40 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iJJSd-0005Ow-RN for pgsql-general@lists.postgresql.org; Sat, 12 Oct 2019 15:37:39 +0000 Received: from mx-us-phx-04.bmc.com ([198.147.194.159] helo=mx-us-phx-04-int.bmc.com) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iJJSb-0002oM-Dv for pgsql-general@postgresql.org; Sat, 12 Oct 2019 15:37:39 +0000 Received: from pps.filterd (mx-us-phx-04-int.bmc.com [127.0.0.1]) by mx-us-phx-04-int.bmc.com (8.16.0.27/8.16.0.27) with SMTP id x9CFZrt5026283; Sat, 12 Oct 2019 15:37:34 GMT Received: from phx-exmbprd-02.adprod.bmc.com ([172.24.33.167]) by mx-us-phx-04-int.bmc.com with ESMTP id 2vk7539c22-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Sat, 12 Oct 2019 15:37:34 +0000 Received: from PHX-EXMBPRD-01.adprod.bmc.com (172.24.35.196) by phx-exmbprd-02.adprod.bmc.com (172.24.33.167) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Sat, 12 Oct 2019 10:37:33 -0500 Received: from PHX-EXMBPRD-01.adprod.bmc.com ([172.24.31.226]) by phx-exmbprd-01.adprod.bmc.com ([172.24.31.226]) with mapi id 15.00.1497.000; Sat, 12 Oct 2019 10:37:33 -0500 From: "Abraham, Danny" To: Andrew Gierth CC: "pgsql-general@postgresql.org" , "Abraham, Danny" Thread-Topic: [EXTERNAL] Re: day interval Thread-Index: AdWBEF/ib8cQwVJNQVyYwInayK8HtQAAPBUhAABHhIA= Date: Sat, 12 Oct 2019 15:37:33 +0000 Message-ID: References: <8736fyxa2a.fsf@news-spur.riddles.org.uk> In-Reply-To: <8736fyxa2a.fsf@news-spur.riddles.org.uk> Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [192.168.6.253] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: RE: Re: day interval X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2019-10-12_07:,, signatures=0 X-Proofpoint-Spam-Reason: safe List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Thanks Andrew. My code fails since the expression (In a PG/PG SQL function) which assumes = integer result Now produces the string '8 day'; This has been working for years on all PG community servers. This happens on an EDB PG 9.6.3. I know the fix, but I need the ability to create the bug in my server, and = I do not know how. Thanks Danny -----Original Message----- From: Andrew Gierth =20 Sent: Saturday, October 12, 2019 6:26 PM To: Abraham, Danny Cc: pgsql-general@postgresql.org Subject: [EXTERNAL] Re: day interval >>>>> "Abraham" =3D=3D Abraham, Danny writes: Abraham> Hi Abraham> A question on day interval Abraham> select date('20191001') - date('20190923'); Abraham> Will provide sometimes '8' - an integer , but sometimes '8 Abrah= am> day' - a string No, it'll always return an integer. You will only get an interval result if= you subtract timestamps rather than dates, for example if one of the opera= nds is actually an expression returning a timestamp. Give an example of an actual expression you used that returned an interval = instead, and we may be able to tell you how to fix it. -- Andrew (irc:RhodiumToad)