Skip to content

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

Closed
@jmhain

Description

@jmhain

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).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions