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

current_timestamp() not treated as sql literal #1111

Open
christoph-blessing opened this issue Oct 4, 2023 · 4 comments
Open

current_timestamp() not treated as sql literal #1111

christoph-blessing opened this issue Oct 4, 2023 · 4 comments
Assignees
Labels

Comments

@christoph-blessing
Copy link

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
@christoph-blessing
Copy link
Author

This doesn't happen when using mysql 5.7.33.

@dimitri-yatsenko dimitri-yatsenko self-assigned this Oct 5, 2023
@dimitri-yatsenko
Copy link
Member

We are not testing with MariaDB at this time.
Shall we just add current_timestamp() as another literal? Would you test it? @christoph-blessing

@christoph-blessing
Copy link
Author

Unfortunately I won't be able to test this because I am no longer working with DataJoint.

@dimitri-yatsenko
Copy link
Member

Thank you, @christoph-blessing we will reproduce it and fix it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants