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

Broken range + interval + preceding in PostgreSQL #1715

Closed
alippai opened this issue Jun 2, 2023 · 1 comment
Closed

Broken range + interval + preceding in PostgreSQL #1715

alippai opened this issue Jun 2, 2023 · 1 comment

Comments

@alippai
Copy link

alippai commented Jun 2, 2023

The following breaks the PRECEDING in sqlglot 14.1.1, but PostgreSQL accepts it:

select LAST_value(col1) OVER(ORDER BY col2 RANGE between interval '1 day' PRECEDING  AND '10 days' FOLLOWING) FROM tbl

Note the interval keyword. I didn't find it in the docs (other than it's the INTERVAL type used if col2 is DATE type), but it works and creates the same query plan with our without the additional interval.

@tobymao tobymao closed this as completed in 92dbace Jun 2, 2023
@alippai
Copy link
Author

alippai commented Jun 2, 2023

🙇‍♂️

adrianisk pushed a commit to adrianisk/sqlglot that referenced this issue Jun 21, 2023
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

1 participant