From: | "Abraham, Danny" <danny_abraham(at)bmc(dot)com> |
---|---|
To: | Andrew Gierth <andrew(at)tao11(dot)riddles(dot)org(dot)uk> |
Cc: | Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>, "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>, "Abraham, Danny" <danny_abraham(at)bmc(dot)com> |
Subject: | RE: Re: day interval |
Date: | 2019-10-12 17:36:29 |
Message-ID: | b4daa2a10d4d403c97a917faca8bb4c7@phx-exmbprd-01.adprod.bmc.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Thanks for the clarification.
The problem is still this:
select date('20191001') - date('20190101') ;
in my servers it is always '273'.
In the customer's DB it is '273 days';
Thanks
Danny
-----Original Message-----
From: Andrew Gierth <andrew(at)tao11(dot)riddles(dot)org(dot)uk>
Sent: Saturday, October 12, 2019 7:53 PM
To: Abraham, Danny <danny_abraham(at)bmc(dot)com>
Cc: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>; pgsql-general(at)postgresql(dot)org
Subject: [EXTERNAL] Re: day interval
>>>>> "Abraham" == Abraham, Danny <danny_abraham(at)bmc(dot)com> writes:
Abraham> The problematic code is:
Abraham> select date(cm_curr_date) - date(CM_DATE) into diff_days from CMS_SYSPRM;
This will always return an integer, unless either the date() cast or the
-(date,date) operator have been redefined or modified.
Abraham> The fix is:
Abraham> select date_part ('day', age( date(cm_curr_date), date(CM_DATE))) into diff_days from CMS_SYSPRM;
This doesn't do the same thing, it will give a different result if the dates differ by a month or more.
Abraham> The problem:
Abraham> How to recreate the problem. (You know - QA).
Abraham> Tried changing lc_time, timezone and datestyle .. but nothing Abraham> seems to work
None of these things can affect data types.
--
Andrew (irc:RhodiumToad)
From | Date | Subject | |
---|---|---|---|
Next Message | Adrian Klaver | 2019-10-12 17:39:31 | Re: day interval |
Previous Message | Andrew Gierth | 2019-10-12 16:53:11 | Re: day interval |