classAtTimeZone
final class AtTimeZone
implements Scalar
uses Snapshot
@visibility public.A time converted to or from a time zone: a AT TIME ZONE zone.
The parser reads it as a call of pg_catalog.timezone(zone, a).
Rule: PG-AT-TIME-ZONE-001. Facts: timestamp with time zone gives timestamp, timestamp gives timestamp with time zone, a time with or without zone gives time with time zone, and an unknown-typed constant is read as the preferred timestamp with time zone; the zone is text or an interval; NULL when an operand can be. Both operands must keep their place (PG-PRECEDENCE-001). Source: https://www.postgresql.org/docs/17/functions-datetime.html#FUNCTIONS-DATETIME-ZONECONVERT. Status: Implemented.
(new \SqlSemantics\Platform\PostgreSql\Semantics())->analyze("SELECT '2024-01-01 00:00+00'::timestamptz AT TIME ZONE 'UTC'", [])->field(0)->type->descriptor->name() // => 'timestamp without time zone'Properties§
public Scalar $operandpublic Scalar $zoneMethods§
public function __construct(public Scalar $operand, public Scalar $zone)Parameters
$operand | Scalar | The time value |
$zone | Scalar | The time zone |
Calls 5
- new Precedence line 45
- static-call Check::input() line 46
- method-call Precedence::before() line 46
- class-const Precedence::AT() line 46
- method-call Precedence::after() line 47
public function deriveScalar(Derivation $derivation, Environment $environment): ScalarFactDerives the operands and the converted type.
Parameters
$derivation | Derivation | |
$environment | Environment |
Returns
Calls 6
- method-call Derivation::scalar() line 55
- new ScalarFact line 58
- method-call PredicateTyping::zone() line 58
- new PredicateTyping line 58
- method-call OperandChecks::nullability() line 58
- new OperandChecks line 58
public function render(Output $out): voidWrites the value, AT TIME ZONE and the zone.
Parameters
$out | Output |
Test cases 1
Calls 1
- method-call Output::node() line 66
Test cases 3§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.