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

Add GETDATE, NOW as alias to parser + allow CURRENT_TIMESTAMP with parenthesis #1980

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

paulrutter
Copy link
Contributor

Add the following functions to the parser:

  • NOW
  • GETDATE

Also add CURRENT_TIMESTAMP() to the parser (with parenthesis).

  • Adjust failing test as now is a reserved keyword. It was already, it was just not validated.
  • Add test

See #1979

Thank you for the time you are putting into AlaSQL!

Add the following functions to the parser:
- NOW
- GETDATE

Also add `CURRENT_TIMESTAMP()` to the parser (with parenthesis).

- Adjust failing test as `now` is a reserved keyword. It was already, it was just not validated.
- Add test
@paulrutter
Copy link
Contributor Author

@mathiasrw whenever you have time, could you please check out this PR? Thanks.

@mathiasrw
Copy link
Member

Hi Paul. I really like what you did here. Thank you so much. This is probably how we should have done it from the beginning.

The changes in test/test845.js indicate that this is a breaking change so I will bundle this into a bucket of changes waiting for us to bump major version. Probably during the next few months as we are in the work of restructuring the whole source into ES6 friendly components.

@mathiasrw mathiasrw added this to the ES6 src milestone Oct 7, 2024
@paulrutter
Copy link
Contributor Author

paulrutter commented Oct 8, 2024

@mathiasrw Thanks, good to know that will take a while for this to get into a release.
Since we're making changes on this front, it might be worthwhile to also add all other date functions in the same matter (see #1937 (comment)).

Do you agree? If so, i could work on a PR (WiP: https://github.com/AlaSQL/alasql/compare/develop...blueconic:alasql:feature/add-all-date-functions-to-parser?expand=1)

@mathiasrw
Copy link
Member

@paulrutter We are talking about all fields named DATE/NOW/GETDATE/YEAR/MONTH having to be wrapped in escape chars, right?

@paulrutter
Copy link
Contributor Author

paulrutter commented Oct 13, 2024

@mathiasrw yes, indeed. In backticks/quotes.

@paulrutter
Copy link
Contributor Author

@mathiasrw See #1982 for additional work on the parser.
One can still use YEAR, MONTH etc without escape chars in DATEADD for example, although one cannot use it as column alias without escape characters.

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