Skip to content

MySQL allows integer interval values #298

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

Open
duvall-eb opened this issue Mar 13, 2021 · 2 comments
Open

MySQL allows integer interval values #298

duvall-eb opened this issue Mar 13, 2021 · 2 comments

Comments

@duvall-eb
Copy link

The usual format for an interval is INTERVAL 'value' unit, but MySQL allows 'value' to be an expression that is either a string or a number. For example:

SELECT DATE_SUB('2018-05-01',INTERVAL '1' YEAR);
SELECT DATE_SUB('2018-05-01',INTERVAL 1 YEAR);

both return 2017-05-01. Currently, the latter syntax is not supported.

@kyle-mccarthy
Copy link

I am running into this issue as well. mysql also allows for referencing columns in the unit part of the interval.

@46bit
Copy link

46bit commented Jun 9, 2022

ClickHouse similarly supports INTERVAL 1 HOUR without requiring the 1 to be quoted. I'm not sure it supports generic expressions though, just unquoted numbers. https://clickhouse.com/docs/en/sql-reference/operators/#interval

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

No branches or pull requests

3 participants