From: PG Bug reporting form <noreply@postgresql.org>
To: pgsql-bugs@lists.postgresql.org
Cc: martin.varady@gmail.com
Subject: BUG #15445: Difference between two dates is not an integer
Date: Fri, 19 Oct 2018 13:14:47 +0000
Message-ID: <15445-f8f5a4e67e9eb3d4@postgresql.org> (raw)
The following bug has been logged on the website:
Bug reference: 15445
Logged by: Martin Varady
Email address: martin.varady@gmail.com
PostgreSQL version: 10.4
Operating system: Windows Server 2012
Description:
I've been using Postgres 9.3 and am recently testing moving to Postgres 10.
Testing Postgres 10 I've noticed that the difference between two dates gives
me an interval when it is documented as giving a integer. This is how it
worked in Postgres 9.3.
From Documentation of Postgres 10:
https://www.postgresql.org/docs/10/static/functions-datetime.html
date '2001-10-01' - date '2001-09-28' integer '3' (days)
Test Case:
I'm casting the result to an int to prove my point.
select (date '2001-10-01' - date '2001-09-28')::int
In Postgres 9.3 provides a result of 3 Integer type
In Postgres 10 gives error:
ERROR: cannot cast type interval to integer
LINE 1: select (date '2001-10-01' - date '2001-09-28')::int
^
SQL state: 42846
Character: 47
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-bugs@postgresql.org
Cc: noreply@postgresql.org, martin.varady@gmail.com
Subject: Re: BUG #15445: Difference between two dates is not an integer
In-Reply-To: <15445-f8f5a4e67e9eb3d4@postgresql.org>
References: <15445-f8f5a4e67e9eb3d4@postgresql.org>
* 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