classOverlaps
final class Overlaps
implements Scalar
uses Snapshot
Public API: explicitly declared with
@visibility public.A test of whether two time periods overlap: (start1, end1) OVERLAPS (start2, end2).
The parser reads it as a call of pg_catalog.overlaps with the four fields; each period is a start and an end, or a start and a length.
Rule: PG-OVERLAPS-001. Facts: boolean, NULL when a field can be (a row constructor itself is never NULL, so its fields decide); a period of other than two fields is reported, as the parser rejects it. Source: https://www.postgresql.org/docs/17/functions-datetime.html. Status: Implemented.
(new \SqlSemantics\Platform\PostgreSql\Semantics())->analyze("SELECT (date '2024-01-01', date '2024-02-01') OVERLAPS (date '2024-01-15', interval '1 day')")->field(0)->type->descriptor->name() // => 'boolean'Properties§
public RowConstructor $leftpublic RowConstructor $rightMethods§
public function __construct(public RowConstructor $left, public RowConstructor $right)Parameters
$left | RowConstructor | The first period |
$right | RowConstructor | The second period |
public function deriveScalar(Derivation $derivation, Environment $environment): ScalarFactDerives both periods and checks that each has two fields.
Parameters
$derivation | Derivation | |
$environment | Environment |
Returns
Calls 10
- method-call Derivation::scalar() line 52
- method-call OperandChecks::fields() line 53
- new OperandChecks line 53
- function-call
countline 55 - new RowArity line 56
- method-call Derivation::report() line 57
- new ScalarFact line 59
- new Invalid line 59
- new Known line 63
- class-const Builtin::Bool() line 63
public function render(Output $out): voidWrites the two periods around OVERLAPS.
Parameters
$out | Output |
Test cases 1
Calls 1
- method-call Output::node() line 71
Test cases 3§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.