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

cli/sql: time-related types often display extraneous info #21390

Closed
solongordon opened this issue Jan 10, 2018 · 2 comments
Closed

cli/sql: time-related types often display extraneous info #21390

solongordon opened this issue Jan 10, 2018 · 2 comments
Labels
C-bug Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior. S-3-ux-surprise Issue leaves users wondering whether CRDB is behaving properly. Likely to hurt reputation/adoption.

Comments

@solongordon
Copy link
Contributor

pq represents all time-related types (DATE, TIME, TIMESTAMP, TIMESTAMPTZ) using Go's time.Time. As a result, cockroach sql often uses too much precision when it displays these types. This is only a display bug but it can be confusing for users.

The most egregious example is TIME, where we display an irrelevant date and timezone.

root@:26257/> select '02:03:04'::TIME;
+---------------------------+
|     '02:03:04'::TIME      |
+---------------------------+
| 0000-01-01 02:03:04+00:00 |
+---------------------------+

But DATE and TIMESTAMP are also somewhat misleading.

root@:26257/> select '2018-01-10'::DATE;  -- should not include time
+---------------------------+
|    '2018-01-10'::DATE     |
+---------------------------+
| 2018-01-10 00:00:00+00:00 |
+---------------------------+

root@:26257/> select '2018-01-10 02:03:04'::TIMESTAMP;  -- should not include timezone
+----------------------------------+
| '2018-01-10 02:03:04'::TIMESTAMP |
+----------------------------------+
| 2018-01-10 02:03:04+00:00        |
+----------------------------------+
@solongordon solongordon added the C-bug Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior. label Jan 10, 2018
@knz knz changed the title cli: time-related types often display extraneous info cli/sql: time-related types often display extraneous info Apr 11, 2018
@knz knz added the S-3-ux-surprise Issue leaves users wondering whether CRDB is behaving properly. Likely to hurt reputation/adoption. label Apr 11, 2018
@otan
Copy link
Contributor

otan commented Jan 30, 2020

related to #44548, i think this results in real bugs when using things such as client dumps.

@knz
Copy link
Contributor

knz commented Jun 4, 2021

Fixed in #62310.

@knz knz closed this as completed Jun 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Code not up to spec/doc, specs & docs deemed correct. Solution expected to change code/behavior. S-3-ux-surprise Issue leaves users wondering whether CRDB is behaving properly. Likely to hurt reputation/adoption.
Projects
None yet
Development

No branches or pull requests

3 participants