BUG #15445: Difference between two dates is not an integer - Mailing list pgsql-bugs

From PG Bug reporting form
Subject BUG #15445: Difference between two dates is not an integer
Date
Msg-id 15445-f8f5a4e67e9eb3d4@postgresql.org
Whole thread Raw
Responses Re: BUG #15445: Difference between two dates is not an integer
List pgsql-bugs
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


pgsql-bugs by date:

Previous
From: PG Bug reporting form
Date:
Subject: BUG #15444: Problem running post-install step autostart
Next
From: Sergei Kornilov
Date:
Subject: Re: BUG #15445: Difference between two dates is not an integer