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

Support the current_timestamp() function #129

Closed
wants to merge 1 commit into from

Conversation

akirk
Copy link
Member

@akirk akirk commented Jul 18, 2024

@akirk
Copy link
Member Author

akirk commented Jul 18, 2024

Ok, I think I need some help here. I think the problem is that CURRENT_TIMESTAMP can also be a keyword in a field definition.

@JanJakes
Copy link
Collaborator

JanJakes commented Aug 8, 2024

@akirk I think the issue is actually that in SQLite, the current_timestamp function can't be used with partenthesesSELECT CURRENT_TIMESTAMP works, SELECT CURRENT_TIMESTAMP() doesn't.

In a bigger picture:

  1. CURRENT_TIMESTAMP is supported by SQLite, but only without parentheses, NOW() is not supported.
  2. CURRENT_TIMESTAMP is SQL standard, NOW() is not.
  3. In the current implementation, NOW() is emulated in PHP, although it would probably be more correct to just convert it to SQLite-native CURRENT_TIMESTAMP.
  4. CURRENT_TIMESTAMP() can be only stripped off of the optional parentheses and consumed to the SQL query.

@JanJakes
Copy link
Collaborator

JanJakes commented Aug 8, 2024

In short, I think the sqliteCreateFunction has no effect because CURRENT_TIMESTAMP is a SQLite-native function, so it probably cannot be overwritten. The quickest fix would be to remove the parentheses.

@JanJakes
Copy link
Collaborator

JanJakes commented Aug 8, 2024

I took a stab at it in #151. It seems to work.

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

Successfully merging this pull request may close these issues.

2 participants