IvorySQL / IvorySQL

Open Source Oracle Compatible PostgreSQL.
https://ivorysql.org
Apache License 2.0
838 stars 144 forks source link

BC Dates giving wrong output. #187

Closed imranzaheer612 closed 1 year ago

imranzaheer612 commented 1 year ago

Bug Report

Date Datatype with BC shows a decremented year (astronomical year).

postgres=# SELECT date '4714-11-24 BC';
         date         
----------------------
 -4713-11-24 00:00:00
(1 row)

While timestamps work fine.

postgres=# SELECT timestamp '4714-11-24 BC';
      timestamp       
----------------------
 -4714-11-24 00:00:00
(1 row)

IvorySQL Version

1.5

OS Version (uname -a)

Linux ubuntu2004 5.15.0-58-generic #64~20.04.1-Ubuntu SMP Fri Jan 6 16:42:31 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux

Configuration options ( config.status --config )

Current Behavior

postgres=# SELECT date '4714-11-24 BC';
         date         
----------------------
 -4713-11-24 00:00:00
(1 row)

Expected behavior/code

The year shouldn't be decremented.

postgres=# SELECT date '4714-11-24 BC';
         date         
----------------------
 -4714-11-24 00:00:00
(1 row)

Step to reproduce

set datestyle='ISO,MDY';
set compatible_mode = 'oracle';

SELECT date '4714-11-24 BC';

Additional context that can be helpful for identifying the problem

contrib/orafce/expected/ora_date.out line#1496 showing a test related this.

grantzhou commented 1 year ago

we have reproduced the bug and working on the fix, will submit the PR soon.

imranzaheer612 commented 1 year ago

I just noticed the PR https://github.com/IvorySQL/IvorySQL/pull/191 Thanks for helping guys 😃.