final class SetOperationFacts
Restricted visibility: declared "@visibility SqlSemantics\Platform\PostgreSql". Code outside that scope must not name this declaration.

Derives the facts of UNION, INTERSECT and EXCEPT.

Rule: PG-SET-OPERATION-001. Both operands are derived in the enclosing environment. The output has the names of the first operand; the type of a column is the common type of the operand columns (PG-UNIFICATION-001, untyped literals as unknown, PG-UNKNOWN-OUTPUT-001), and a column can be NULL when it can in an operand. Operands of different widths and types that cannot be matched are reported. When the set operation is the query of a recursive common table or view (RecursiveDefinition) that refers to itself, the second operand sees that table with the columns of the first operand, renamed by the column list of the table, each able to be NULL because later rounds of the recursion feed back their own rows. An operand whose columns are not all known leaves the output open. Terminates: two operands; no fixpoint is computed. Source: https://www.postgresql.org/docs/17/queries-union.html, https://www.postgresql.org/docs/17/queries-with.html#QUERIES-WITH-RECURSIVE. Status: Implemented.

Methods§

public function derive(
    SetOperation $operation,
    Derivation $derivation,
    Environment $outer,
): QueryFact
public function rebound(
    SetOperation $operation,
    QueryFact $anchor,
    Environment $outer,
): Environment

Answers the environment of the second operand: the enclosing one, with the recursive common table this operation computes bound to the first operand.

Parameters

$operationSetOperation
$anchorQueryFact
$outerEnvironment
Called from 1
Calls 8

Test cases 1§

Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.

Dedicated tests 1

Relations§

Instantiated in 1
Method calls 1