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

Commite343187

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 parent3d21f08 commite343187

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
@@ -87,13 +87,13 @@ CREATE [ OR REPLACE ] [ TEMP | TEMPORARY ] [ RECURSIVE ] VIEW <replaceable class
8787
<para>
8888
Creates a recursive view. The syntax
8989
<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>...</>;
9191
</synopsis>
9292
is equivalent to
9393
<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</>;
9595
</synopsis>
96-
A view column list must be specified for a recursive view.
96+
A view columnnamelist must be specified for a recursive view.
9797
</para>
9898
</listitem>
9999
</varlistentry>
@@ -462,11 +462,16 @@ CREATE VIEW comedies AS
462462
<para>
463463
Create a recursive view consisting of the numbers from 1 to 100:
464464
<programlisting>
465-
CREATE RECURSIVE VIEW nums_1_100 (n) AS
465+
CREATE RECURSIVE VIEWpublic.nums_1_100 (n) AS
466466
VALUES (1)
467467
UNION ALL
468468
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
473+
schema-qualified.
474+
</para>
470475
</refsect1>
471476

472477
<refsect1>

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp