Re: BUG #16216: the result of to_date function with negative yearnumber not same as BC year number
| От | Fabien COELHO |
|---|---|
| Тема | Re: BUG #16216: the result of to_date function with negative yearnumber not same as BC year number |
| Дата | |
| Msg-id | alpine.DEB.2.21.2001171503400.31891@pseudo обсуждение исходный текст |
| Ответ на | BUG #16216: the result of to_date function with negative year number not same as BC year number (PG Bug reporting form <noreply@postgresql.org>) |
| Ответы |
Re: BUG #16216: the result of to_date function with negative year number not same as BC year number
|
| Список | pgsql-bugs |
Hello,
> example:
> postgres=# select to_date('-120', 'yyyy');
> to_date
> ---------------
> 0121-01-01 BC
> (1 row)
>
> postgres=# select to_date('120bc', 'yyyybc');
> to_date
> ---------------
> 0120-01-01 BC
> (1 row)
>
> I think -120 means 120bc, however, the output is 121bc not 120bc.
ISTM that the documentation does not say that -120 is supported as meaning
BC.
Given that there are no year 0 (zero was invented much later), history
skips form year -1 to year 1. If -120 means in the implementation "year as
an integer", then skipping zero would mean that it indeed represents year
121 BC, i.e. 120 years before "Jan 1, 1 AD". So there is a logic.
BTW I found another oddity while trying strange date patterns:
sql> SELECT DATE 'Jan 1, 0001 AD';
# 0001-01-01
But:
sql> SELECT DATE 'Jan 1, 1 AD';
# 2001-01-01 # WT*?
I'll try to have a look over the week-end.
--
Fabien.
В списке pgsql-bugs по дате отправления: