Skip to content

current_timestamp() not treated as sql literal #1111

@christoph-blessing

Description

@christoph-blessing

Bug Report

Description

@schema
class Table(dj.Manual):
    definition = """
        t = CURRENT_TIMESTAMP : timestamp
    """

@schema  # pymysql.err.OperationalError: (1067, "Invalid default value for 't'")
class Copy(dj.Manual):
    definition = (Table().heading)  # or 'Table().describe()'

In my case the server returns current_timestamp() as the default value for t but that value is not treated as a sql literal by datajoint. Therefore datajoint surrounds the value with quotation marks making it an invalid default value and leading to the error. One fix is to add current_timestamp() to the list of literals here. I would be happy to make a PR if you agree with that fix.

Reproducibility

  • DataJoint Version 0.14.1
  • MariaDB Version 10.3.38

Metadata

Metadata

Labels

bugIndicates an unexpected problem or unintended behaviorstaleIndicates issues, pull requests, or discussions are inactive

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions