This is kind of a subjective question.
If I have a recursive CTE something like:
WITH RECURSIVE r(x, y) AS ( ...
SELECT x, y -- select1
FROM t WHERE ..
UNION
SELECT t.x, t.y -- select2
FROM r JOIN t
ON ...
)
SELECT x, y
FROM r
What exactly is the point of specifying the list of columns as an argument in the CTE definition? If I don't specify it, it anyways takes the list of columns in the SELECT
.
If I do specify it, every time I want to make changes, I have to reflect that in both the SELECT
s in the CTE and also in the argument list.
What benefit do I gain from writing WITH RECURSIVE r(x, y) AS
instead of just WITH RECURSIVE r AS
?