From: Abraham, Danny <danny_abraham@bmc.com>
To: Andrew Gierth <andrew@tao11.riddles.org.uk>
Cc: Adrian Klaver <adrian.klaver@aklaver.com>
Cc: pgsql-general@postgresql.org <pgsql-general@postgresql.org>
Cc: Abraham, Danny <danny_abraham@bmc.com>
Subject: RE: Re: day interval
Date: Sat, 12 Oct 2019 17:36:29 +0000
Message-ID: <b4daa2a10d4d403c97a917faca8bb4c7@phx-exmbprd-01.adprod.bmc.com> (raw)
In-Reply-To: <87mue5x60l.fsf@news-spur.riddles.org.uk>
References: <a95dd36dcc5d4e7380550a727716cfe0@phx-exmbprd-01.adprod.bmc.com>
<8736fyxa2a.fsf@news-spur.riddles.org.uk>
<e8d3c7014a2d43f4b1cfe780d61ccde5@phx-exmbprd-01.adprod.bmc.com>
<279cfb68-22c7-c5c6-95ec-8234831faf38@aklaver.com>
<0e252354f16a45dfa672d5346089a224@phx-exmbprd-01.adprod.bmc.com>
<87mue5x60l.fsf@news-spur.riddles.org.uk>
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@tao11.riddles.org.uk>
Sent: Saturday, October 12, 2019 7:53 PM
To: Abraham, Danny <danny_abraham@bmc.com>
Cc: Adrian Klaver <adrian.klaver@aklaver.com>; pgsql-general@postgresql.org
Subject: [EXTERNAL] Re: day interval
>>>>> "Abraham" == Abraham, Danny <danny_abraham@bmc.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)
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: danny_abraham@bmc.com, andrew@tao11.riddles.org.uk, adrian.klaver@aklaver.com
Subject: Re: day interval
In-Reply-To: <b4daa2a10d4d403c97a917faca8bb4c7@phx-exmbprd-01.adprod.bmc.com>
References: <a95dd36dcc5d4e7380550a727716cfe0@phx-exmbprd-01.adprod.bmc.com> <8736fyxa2a.fsf@news-spur.riddles.org.uk> <e8d3c7014a2d43f4b1cfe780d61ccde5@phx-exmbprd-01.adprod.bmc.com> <279cfb68-22c7-c5c6-95ec-8234831faf38@aklaver.com> <0e252354f16a45dfa672d5346089a224@phx-exmbprd-01.adprod.bmc.com> <87mue5x60l.fsf@news-spur.riddles.org.uk> <b4daa2a10d4d403c97a917faca8bb4c7@phx-exmbprd-01.adprod.bmc.com>
* 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