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

sql: timestamps are truncated to precision 0 after 19.2 upgrade #42283

Closed
thoszhang opened this issue Nov 7, 2019 · 2 comments
Closed

sql: timestamps are truncated to precision 0 after 19.2 upgrade #42283

thoszhang opened this issue Nov 7, 2019 · 2 comments
Assignees
Labels
A-sql-pgcompat Semantic compatibility with PostgreSQL A-sql-semantics C-bug Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior. regression Regression from a release.

Comments

@thoszhang
Copy link
Contributor

Start a cluster running 19.1.5 and create a table with a timestamp column:

root@localhost:26257/defaultdb> create table t (a timestamp);
CREATE TABLE

Insert a value (just for comparison's sake):

root@localhost:26257/defaultdb> insert into t values ('2016-01-25 10:10:10.555555');
INSERT 1

Then upgrade to 19.2.0-rc.2.

Now when timestamps are inserted, they get truncated:

root@localhost:26257/defaultdb> insert into t values ('2016-01-25 10:10:10.555555');
INSERT 1
root@localhost:26257/defaultdb> select * from t;
                 a
+----------------------------------+
  2016-01-25 10:10:10.555555+00:00
  2016-01-25 10:10:11+00:00
(2 rows)

This was introduced in #37920. The problem is that the Precision field for the timestamp types were unset, and the precision was always 6 (i.e. microseconds) by default. After the change, a Precision of 0 is now taken to mean precision 0 (i.e. seconds).

@RaduBerinde
Copy link
Member

Cool find! I filed #42309 to track adding a test along these lines.

@knz knz added A-sql-pgcompat Semantic compatibility with PostgreSQL A-sql-semantics C-bug Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior. regression Regression from a release. labels Nov 8, 2019
@solongordon
Copy link
Contributor

Fixed by #42286.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-sql-pgcompat Semantic compatibility with PostgreSQL A-sql-semantics C-bug Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior. regression Regression from a release.
Projects
None yet
Development

No branches or pull requests

5 participants