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

refactoring default and on update expressions #296

Merged
merged 8 commits into from
Jan 3, 2024
Merged

Conversation

jycor
Copy link

@jycor jycor commented Dec 29, 2023

This PR changes the grammar to more closely match MySQL's behavior, specifically around the NOW() function and its synonyms.
Changes:

  • Throw syntax errors for ON UPDATE expressions against functinos that aren't NOW() or a synonym.
  • Only accept integer for argument to NOW() and synonyms; syntax error for anything else
  • Simplified grammar rules
  • Removed CurTimeFuncExpr from AST in favor of plain FuncExpr

Companion PR: dolthub/go-mysql-server#2218

@jycor jycor requested a review from zachmu as a code owner December 29, 2023 00:11
Copy link

@max-hoffman max-hoffman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, the specifics of the diff are a bit hard to understand but the api refactor makes sense

func_datetime_precision:
openb value_expression closeb
// Optional datetime precision for certain functions.
func_datetime_prec_opt:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we have error tests with non-integer precisions?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

go/vt/sqlparser/sql.y Outdated Show resolved Hide resolved
@jycor jycor merged commit 78fa0d3 into main Jan 3, 2024
4 checks passed
@jycor jycor deleted the james/now-synonyms branch January 3, 2024 00:58
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