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'tbe schema-qualified even if the view name is written with a schema.Spell it out.Discussion: <871sznz69m.fsf@metapensiero.it>
Copy file name to clipboardExpand all lines: doc/src/sgml/ref/create_view.sgml
+10-5Lines changed: 10 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -86,13 +86,13 @@ CREATE [ OR REPLACE ] [ TEMP | TEMPORARY ] [ RECURSIVE ] VIEW <replaceable class
86
86
<para>
87
87
Creates a recursive view. The syntax
88
88
<synopsis>
89
-
CREATE RECURSIVE VIEW <replaceable>name</> (<replaceable>columns</>) AS SELECT <replaceable>...</>;
89
+
CREATE RECURSIVE VIEW[<replaceable>schema</>. ] <replaceable>view_name</>(<replaceable>column_names</>) AS SELECT <replaceable>...</>;
90
90
</synopsis>
91
91
is equivalent to
92
92
<synopsis>
93
-
CREATE VIEW <replaceable>name</> AS WITH RECURSIVE <replaceable>name</> (<replaceable>columns</>) AS (SELECT <replaceable>...</>) SELECT <replaceable>columns</> FROM <replaceable>name</>;
93
+
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</>;
94
94
</synopsis>
95
-
A view column list must be specified for a recursive view.
95
+
A view columnnamelist must be specified for a recursive view.
96
96
</para>
97
97
</listitem>
98
98
</varlistentry>
@@ -303,11 +303,16 @@ CREATE VIEW comedies AS
303
303
<para>
304
304
Create a recursive view consisting of the numbers from 1 to 100:
305
305
<programlisting>
306
-
CREATE RECURSIVE VIEW nums_1_100 (n) AS
306
+
CREATE RECURSIVE VIEWpublic.nums_1_100 (n) AS
307
307
VALUES (1)
308
308
UNION ALL
309
309
SELECT n+1 FROM nums_1_100 WHERE n < 100;
310
-
</programlisting></para>
310
+
</programlisting>
311
+
Notice that although the recursive view's name is schema-qualified in this
312
+
<command>CREATE</>, its internal self-reference is not schema-qualified.
313
+
This is because the implicitly-created CTE's name cannot be