You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It was perhaps not entirely clear that internal self-references shouldn't
be schema-qualified even if the view name is written with a schema.
Spell it out.
Discussion: <871sznz69m.fsf@metapensiero.it>
CREATE VIEW <replaceable>name</> AS WITH RECURSIVE <replaceable>name</> (<replaceable>columns</>) AS (SELECT <replaceable>...</>) SELECT <replaceable>columns</> FROM <replaceable>name</>;
94
+
CREATE VIEW [ <replaceable>schema</> . ] <replaceable>view_name</> AS WITH RECURSIVE <replaceable>view_name</> (<replaceable>column_names</>) AS (SELECT <replaceable>...</>) SELECT <replaceable>column_names</> FROM <replaceable>view_name</>;
95
95
</synopsis>
96
-
A view column list must be specified for a recursive view.
96
+
A view column name list must be specified for a recursive view.
97
97
</para>
98
98
</listitem>
99
99
</varlistentry>
@@ -461,11 +461,16 @@ CREATE VIEW comedies AS
461
461
<para>
462
462
Create a recursive view consisting of the numbers from 1 to 100:
463
463
<programlisting>
464
-
CREATE RECURSIVE VIEW nums_1_100 (n) AS
464
+
CREATE RECURSIVE VIEW public.nums_1_100 (n) AS
465
465
VALUES (1)
466
466
UNION ALL
467
467
SELECT n+1 FROM nums_1_100 WHERE n < 100;
468
-
</programlisting></para>
468
+
</programlisting>
469
+
Notice that although the recursive view's name is schema-qualified in this
470
+
<command>CREATE</>, its internal self-reference is not schema-qualified.
471
+
This is because the implicitly-created CTE's name cannot be
0 commit comments