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
@@ -87,13 +87,13 @@ CREATE [ OR REPLACE ] [ TEMP | TEMPORARY ] [ RECURSIVE ] VIEW <replaceable class
87
87
<para>
88
88
Creates a recursive view. The syntax
89
89
<synopsis>
90
-
CREATE RECURSIVE VIEW <replaceable>name</> (<replaceable>columns</>) AS SELECT <replaceable>...</>;
90
+
CREATE RECURSIVE VIEW[<replaceable>schema</>. ] <replaceable>view_name</>(<replaceable>column_names</>) AS SELECT <replaceable>...</>;
91
91
</synopsis>
92
92
is equivalent to
93
93
<synopsis>
94
-
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 columnnamelist must be specified for a recursive view.
97
97
</para>
98
98
</listitem>
99
99
</varlistentry>
@@ -462,11 +462,16 @@ CREATE VIEW comedies AS
462
462
<para>
463
463
Create a recursive view consisting of the numbers from 1 to 100:
464
464
<programlisting>
465
-
CREATE RECURSIVE VIEW nums_1_100 (n) AS
465
+
CREATE RECURSIVE VIEWpublic.nums_1_100 (n) AS
466
466
VALUES (1)
467
467
UNION ALL
468
468
SELECT n+1 FROM nums_1_100 WHERE n < 100;
469
-
</programlisting></para>
469
+
</programlisting>
470
+
Notice that although the recursive view's name is schema-qualified in this
471
+
<command>CREATE</>, its internal self-reference is not schema-qualified.
472
+
This is because the implicitly-created CTE's name cannot be