Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BC timestamps appear incorrect in postgres #1172

Open
jasobrown-rs opened this issue Mar 26, 2024 · 0 comments
Open

BC timestamps appear incorrect in postgres #1172

jasobrown-rs opened this issue Mar 26, 2024 · 0 comments

Comments

@jasobrown-rs
Copy link
Contributor

Summary

When selecting a timestamp or timestamptz column directly from PG, the output will look like: 0214-02-05 15:40:00+00 BC. When selecting the same data from a cached query, the output looks like this: -0213-02-05 15:40:00 +00:00. While the years appear to be an off-by-one error, they actually represent the same point in time, just expressed differently: 214-…. BC vs -213…. I believe this is an artifact of the way be must parse BC dates wrt the chrono crate, in readyset-data::TimestatmpTz::from_str().

Steps to reproduce

noria=> create table bc_testtz(t timestamptz);
CREATE TABLE
noria=> insert into bc_testtz values('214-02-05 15:40:00+00 BC');
INSERT 0 1
noria=> select * from bc_testtz;
             t             
---------------------------
 0214-02-05 15:40:00+00 BC
(1 row)

noria=> create cache from select * from bc_testtz;

noria=> select * from bc_testtz;
              t              
-----------------------------
 -0213-02-05 15:40:00 +00:00
(1 row)

Upstream DB type and version

Postgres, any version. This will probably apply to MySQL, as well, although I have not tried it out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant