Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitcf3e2c3

Browse files
committed
Improve documentation for CREATE RECURSIVE VIEW.
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>
1 parent455eaf9 commitcf3e2c3

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

‎doc/src/sgml/ref/create_view.sgml

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -86,13 +86,13 @@ CREATE [ OR REPLACE ] [ TEMP | TEMPORARY ] [ RECURSIVE ] VIEW <replaceable class
8686
<para>
8787
Creates a recursive view. The syntax
8888
<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>...</>;
9090
</synopsis>
9191
is equivalent to
9292
<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</>;
9494
</synopsis>
95-
A view column list must be specified for a recursive view.
95+
A view columnnamelist must be specified for a recursive view.
9696
</para>
9797
</listitem>
9898
</varlistentry>
@@ -303,11 +303,16 @@ CREATE VIEW comedies AS
303303
<para>
304304
Create a recursive view consisting of the numbers from 1 to 100:
305305
<programlisting>
306-
CREATE RECURSIVE VIEW nums_1_100 (n) AS
306+
CREATE RECURSIVE VIEWpublic.nums_1_100 (n) AS
307307
VALUES (1)
308308
UNION ALL
309309
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
314+
schema-qualified.
315+
</para>
311316
</refsect1>
312317

313318
<refsect1>

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp