Re: Bug fix for missing years in make_date()

Поиск
Список
Период
Сортировка
От David Fetter
Тема Re: Bug fix for missing years in make_date()
Дата
Msg-id 20150401154027.GA18201@fetter.org
обсуждение исходный текст
Ответ на Re: Bug fix for missing years in make_date()  (David Fetter <david@fetter.org>)
Список pgsql-hackers
On Tue, Mar 31, 2015 at 12:22:39PM -0700, David Fetter wrote:
> On Tue, Mar 31, 2015 at 12:58:27PM -0400, Tom Lane wrote:
> > David Fetter <david@fetter.org> writes:
> > > On Tue, Mar 31, 2015 at 10:34:45AM -0400, Adam Brightwell wrote:
> > >> Previously, zero was rejected, what does it do now? I'm sure it
> > >> represents 0 AD/CE, however, is that important enough to note
> > >> given that it was not allowed previously?
> >
> > > Now, it's supposed to take 0 as 1 BCE, -1 as 2 BCE, etc.  There
> > > should probably be tests for that.
> >
> > Surely that is *not* what we want?
>
> It is if we're to be consistent with the rest of the system, to wit:
>
> SELECT to_date('YYYY','0000');
>     to_date
> ---------------
>  0001-01-01 BC
> (1 row)

Looking at this further, I think that it should be consistent with
cast rather than with to_date().

SELECT date '0000-01-01';
ERROR:  date/time field value out of range: "0000-01-01"
LINE 1: SELECT date '0000-01-01';

Please find attached the next revision of the patch.

Cheers,
David.
--
David Fetter <david@fetter.org> http://fetter.org/
Phone: +1 415 235 3778  AIM: dfetter666  Yahoo!: dfetter
Skype: davidfetter      XMPP: david.fetter@gmail.com

Remember to vote!
Consider donating to Postgres: http://www.postgresql.org/about/donate

Вложения

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

Предыдущее
От: Robert Haas
Дата:
Сообщение: Re: Tables cannot have INSTEAD OF triggers
Следующее
От: Bruce Momjian
Дата:
Сообщение: Re: Zero-padding and zero-masking fixes for to_char(float)