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

Document DATE/TIME/TIMESTAMP literal prefixes. #19543

Open
mjonss opened this issue Nov 29, 2024 · 2 comments
Open

Document DATE/TIME/TIMESTAMP literal prefixes. #19543

mjonss opened this issue Nov 29, 2024 · 2 comments

Comments

@mjonss
Copy link
Contributor

mjonss commented Nov 29, 2024

Change Request

Please answer the following questions before submitting your issue. Thanks!

  1. Describe what you find is inappropriate or missing in the existing docs.
    There is no mention about DATE/TIME and TIMESTAMP literal, which can be written as DATE'2024-11-28', TIME'14:22:39' and TIMESTAMP'2024-11-28 14:22:11' in the literal values section.

  2. Describe your suggestion or addition.
    Implementation wise it differs slightly if only using a string, and let the parser/function/data type do implicit conversion from string to date/time/timestamp. Normally the result is the same, but there are stricter checks for DATE/TIME and TIMESTAMP explicit literals.
    Also note that TIMESTAMP literal is first interpreted as in current @@time_zone unless explicitly setting time_zone offset (see tidb#57845) and then set as DATETIME datatype, which can be good to know when working with implicit data type conversion during comparison between different literals and column types.

  3. Provide some reference materials (such as documents and websites) if you could.
    https://docs.pingcap.com/tidb/stable/literal-values

@mjonss
Copy link
Contributor Author

mjonss commented Nov 29, 2024

Also the explicit time zone offset [+-]HH:MM or TiDB extension 'Z' as in 2024-11-28 14:22:31+08:00 or 2024-11-28 14:22:31Z is not documented (time zone offset waiting for PR for explicit TIMESTAMP literal, and 'Z' is only supported by implicit timestamp literal).

@mjonss
Copy link
Contributor Author

mjonss commented Nov 29, 2024

Maybe https://docs.pingcap.com/tidb/stable/configure-time-zone#time-zone-support should include explicit time zone offset as well?

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