pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Andrew Gierth <andrew@tao11.riddles.org.uk>
To: Abraham\, Danny <danny_abraham@bmc.com>
Cc: pgsql-general\@postgresql.org <pgsql-general@postgresql.org>
Subject: Re: day interval
Date: Sat, 12 Oct 2019 16:25:38 +0100
Message-ID: <8736fyxa2a.fsf@news-spur.riddles.org.uk> (raw)
In-Reply-To: <a95dd36dcc5d4e7380550a727716cfe0@phx-exmbprd-01.adprod.bmc.com>
References: <a95dd36dcc5d4e7380550a727716cfe0@phx-exmbprd-01.adprod.bmc.com>

>>>>> "Abraham" == Abraham, Danny <danny_abraham@bmc.com> 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)





view thread (13+ messages)  latest in thread

Message-ID: <8736fyxa2a.fsf@news-spur.riddles.org.uk>
Permalink:  ../8736fyxa2a.fsf@news-spur.riddles.org.uk/
Also on:    postgresql.org/message-id/8736fyxa2a.fsf@news-spur.riddles.org.uk

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: andrew@tao11.riddles.org.uk, danny_abraham@bmc.com
  Subject: Re: day interval
  In-Reply-To: <8736fyxa2a.fsf@news-spur.riddles.org.uk>
  References: <a95dd36dcc5d4e7380550a727716cfe0@phx-exmbprd-01.adprod.bmc.com> <8736fyxa2a.fsf@news-spur.riddles.org.uk>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox