Skip to content

support current_timestamp synonyms #7129

@jycor

Description

@jycor

In MySQL, these are all the same function:

  • CURRENT_TIMESTAMP
  • CURRENT_TIMESTAMP()
  • NOW()
  • LOCALTIME
  • LOCALTIME()
  • LOCALTIMESTAMP
  • LOCALTIMESTAMP()

Dolt lacks support for these

dolt> select localtime;
function: 'localtime' not found
dolt> select localtime();
function: 'localtime' not found
dolt> select localtimestamp;
function: 'localtimestamp' not found
dolt> select localtimestamp();
function: 'localtimestamp' not found

Note: We also have slightly different implementations of NOW() and CURRENT_TIMESTAMP()

As a result, we lack support for using these functions as column defaults and as on update expressions.

dolt> create table t (ts timestamp default localtime);
function: 'localtime' not found

Note: We just support on update localtime, but treat it like a no-op

dolt> create table t (ts timestamp on update localtime);
dolt> show create table t;
+-------+------------------------------------------------------------------+
| Table | Create Table                                                     |
+-------+------------------------------------------------------------------+
| t     | CREATE TABLE `t` (                                               |
|       |   `ts` timestamp                                                 |
|       | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_bin |
+-------+------------------------------------------------------------------+
1 row in set (0.00 sec)

Relevant MySQL Docs:

Related Issues:

Metadata

Metadata

Assignees

No one assigned

    Labels

    analyzerbugSomething isn't workingcorrectnessWe don't return the same result as MySQLsqlIssue with SQL

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions