Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-34829

LOCALTIME returns a wrong data type

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Fixed
    • 10.5, 10.6, 10.11, 11.1(EOL), 11.2, 11.4, 11.6, 11.7, 10.7(EOL), 10.8(EOL), 10.9(EOL), 10.10(EOL), 11.0(EOL), 11.3(EOL), 11.5(EOL)
    • 11.6.2
    • Data types, Temporal Types
    • None

    Description

      MariaDB [test]> select localtime;
      +---------------------+
      | localtime           |
      +---------------------+
      | 2024-08-28 13:48:03 |
      +---------------------+
      

      Looks wrong. According to the standard, LOCALTIME should return the TIME data type as follows:

      a) If <time precision> TP is specified, then LOCALTIME(TP) is equivalent to:
       
        CAST (CURRENT_TIME(TP) AS TIME(TP) WITHOUT TIME ZONE)
       
      b) Otherwise, LOCALTIME is equivalent to:
       
        CAST (CURRENT_TIME AS TIME WITHOUT TIME ZONE)
      

      LOCALTIME and LOCALTIMESTAMP are implemented as aliases to CURRENT_TIMESTAMP:

      lex.h:  { "LOCALTIME",	SYM(NOW_SYM)},
      lex.h:  { "LOCALTIMESTAMP",	SYM(NOW_SYM)},
      

      The alias for LOCALTIME is wrong. It should alias to CURRENT_TIME instead of CURRENT_TIMESTAMP.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              bar Alexander Barkov
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.