pingcap / pingcap/docs

Document DATE/TIME/TIMESTAMP literal prefixes.

Open
#19,543 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
617
Forks
724
Avg merge
2d 10h
Merged PRs (30d)
223

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Review the literal values section at docs.pingcap.com/tidb/stable/literal-values and the behavior referenced in tidb#57845. Document DATE, TIME, and TIMESTAMP literal-prefix examples, including the stricter explicit-literal checks and TIMESTAMP handling with the current time zone. Done means the literal values documentation explains these forms and their conversion behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
sql
Domain
databases, documentation
Issue type
Documentation
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.