interfaceRecursiveDefinition
interface RecursiveDefinition
extends Node
@visibility public.A named relation whose query may refer to itself: a common table expression, or a recursive view.
When such a relation is bound while its own query is derived, the second operand of the UNION that computes it sees the relation with the columns of the first operand, renamed by the column names written for it (PG-SET-OPERATION-001). The server reads CREATE RECURSIVE VIEW v (a) AS q as a view over WITH RECURSIVE v (a) AS (q), so both kinds share the rule. Source: https://www.postgresql.org/docs/17/queries-with.html#QUERIES-WITH-RECURSIVE, https://www.postgresql.org/docs/17/sql-createview.html.
$one = new \SqlSemantics\Platform\PostgreSql\Statement\Query\Select([new \SqlSemantics\Platform\PostgreSql\Statement\Query\ExpressionTarget(new \SqlSemantics\Platform\PostgreSql\Statement\Literal\Constant(new \SqlSemantics\Platform\PostgreSql\Statement\Literal\IntegerConstant('1')))]);
$table = new \SqlSemantics\Platform\PostgreSql\Statement\Query\With\CommonTableExpression(new \SqlSemantics\Platform\PostgreSql\Model\Statement\Identifier\Name('x'), $one, [new \SqlSemantics\Platform\PostgreSql\Model\Statement\Identifier\Name('a')]);
[$table->recursiveQuery() === $one, $table->recursiveColumns()[0]->value] // => [true, 'a']Methods§
public function recursiveQuery(): QueryAnswers the query that computes the rows and may refer to the relation itself.
Returns
Test cases 1§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 1
RecursiveDefinitionTestcalls