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 1iJJI7-0005pI-Lx for pgsql-general@arkaria.postgresql.org; Sat, 12 Oct 2019 15:26:47 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1iJJH8-0007W6-IT for pgsql-general@arkaria.postgresql.org; Sat, 12 Oct 2019 15:25:46 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iJJH8-0007Vo-44 for pgsql-general@lists.postgresql.org; Sat, 12 Oct 2019 15:25:46 +0000 Received: from lungold.riddles.org.uk ([82.68.208.19]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1iJJH5-0000eo-Ar for pgsql-general@postgresql.org; Sat, 12 Oct 2019 15:25:44 +0000 Received: from [192.168.127.1] (port=57412 helo=caithnard.riddles.org.uk) by lungold.riddles.org.uk with esmtp (Exim 4.92.3 (FreeBSD)) (envelope-from ) id 1iJJH0-0009KR-VG; Sat, 12 Oct 2019 15:25:38 +0000 Received: from localhost ([127.0.0.1]:21034 helo=caithnard.riddles.org.uk) by caithnard.riddles.org.uk with esmtp (Exim 4.92.1 (FreeBSD)) (envelope-from ) id 1iJJH0-0009Gl-Qx; Sat, 12 Oct 2019 15:25:38 +0000 From: Andrew Gierth To: "Abraham\, Danny" Cc: "pgsql-general\@postgresql.org" Subject: Re: day interval In-Reply-To: (Danny Abraham's message of "Sat, 12 Oct 2019 15:21:26 +0000") Message-ID: <8736fyxa2a.fsf@news-spur.riddles.org.uk> References: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.2 (berkeley-unix) Date: Sat, 12 Oct 2019 16:25:38 +0100 MIME-Version: 1.0 Content-Type: text/plain List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk >>>>> "Abraham" == 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 Abraham> 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 operands 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)