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.