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 column references and other expressions in RHS of AT TIME ZONE operator #1270

Closed
jmhain opened this issue May 11, 2024 · 0 comments · Fixed by #1272
Closed

Support column references and other expressions in RHS of AT TIME ZONE operator #1270

jmhain opened this issue May 11, 2024 · 0 comments · Fixed by #1272

Comments

@jmhain
Copy link
Contributor

jmhain commented May 11, 2024

We currently require the RHS of AT TIME ZONE operator to be a string literal, but in postgres, it's allowed to be an expression. For example, an expression such as <timestamp> AT TIME ZONE ('America/' || some_column) is accepted. This change would make Expr::AtTimeZone isomorphic to Expr::BinaryOp, so when implementing this I suggest we eliminate Expr::AtTimeZone and add BinaryOperator::AtTimeZone.

We'll need to be careful to get the precedence right. In <timestamp> AT TIME ZONE 'America/Los Angeles'::text the cast is on the time zone string literal, but in <timestamp> AT TIME ZONE 'America/Los Angeles' || 'foo' it's concatenating the result of the entirely AT TIME ZONE binop (which is implicitly casted into text).

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 a pull request may close this issue.

1 participant