RE: Re: day interval

Поиск
Список
Период
Сортировка
От Abraham, Danny
Тема RE: Re: day interval
Дата
Msg-id e8d3c7014a2d43f4b1cfe780d61ccde5@phx-exmbprd-01.adprod.bmc.com
обсуждение исходный текст
Ответ на Re: day interval  (Andrew Gierth <andrew@tao11.riddles.org.uk>)
Ответы Re: day interval  (Ron <ronljohnsonjr@gmail.com>)
Re: day interval  (Adrian Klaver <adrian.klaver@aklaver.com>)
Список pgsql-general
Thanks Andrew.

My code fails since the expression (In a PG/PG SQL function) which assumes integer result
Now produces the string '8 day';

This has been working for years on all PG community servers.

This happens on an EDB PG 9.6.3.

I know the fix, but I need the ability to create the bug in my server, and I do not know how.

Thanks

Danny


-----Original Message-----
From: Andrew Gierth <andrew@tao11.riddles.org.uk>
Sent: Saturday, October 12, 2019 6:26 PM
To: Abraham, Danny <danny_abraham@bmc.com>
Cc: pgsql-general@postgresql.org
Subject: [EXTERNAL] Re: day interval

>>>>> "Abraham" == Abraham, Danny <danny_abraham@bmc.com> writes:

 Abraham> Hi
 Abraham> A question on day interval

 Abraham> select date('20191001') - date('20190923');

 Abraham> Will provide sometimes '8' - an integer , but sometimes '8  Abraham> day' - a string

No, it'll always return an integer. You will only get an interval result if you subtract timestamps rather than dates,
forexample if one of the operands is actually an expression returning a timestamp. 

Give an example of an actual expression you used that returned an interval instead, and we may be able to tell you how
tofix it. 

--
Andrew (irc:RhodiumToad)



В списке pgsql-general по дате отправления:

Предыдущее
От: Andrew Gierth
Дата:
Сообщение: Re: day interval
Следующее
От: Ron
Дата:
Сообщение: Re: day interval