From: | PG Bug reporting form <noreply(at)postgresql(dot)org> |
---|---|
To: | pgsql-bugs(at)lists(dot)postgresql(dot)org |
Cc: | martin(dot)varady(at)gmail(dot)com |
Subject: | BUG #15445: Difference between two dates is not an integer |
Date: | 2018-10-19 13:14:47 |
Message-ID: | 15445-f8f5a4e67e9eb3d4@postgresql.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
The following bug has been logged on the website:
Bug reference: 15445
Logged by: Martin Varady
Email address: martin(dot)varady(at)gmail(dot)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
From | Date | Subject | |
---|---|---|---|
Next Message | Sergei Kornilov | 2018-10-19 13:26:27 | Re: BUG #15445: Difference between two dates is not an integer |
Previous Message | PG Bug reporting form | 2018-10-19 12:37:21 | BUG #15444: Problem running post-install step autostart |