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
<
8000
script type="application/json" data-target="react-app.embeddedData">{"payload":{"commit":{"oid":"e34318725ca5b274efd6f57ea7460e89f4dca9f9","url":"/postgres/postgres/commit/e34318725ca5b274efd6f57ea7460e89f4dca9f9","authoredDate":"2016-10-11T10:08:45.000-04:00","committedDate":"2016-10-11T10:08:45.000-04:00","shortMessage":null,"shortMessageMarkdown":"\u003cdiv\u003eImprove documentation for CREATE RECURSIVE VIEW.\u003c/div\u003e","shortMessageMarkdownLink":null,"bodyMessageHtml":"It was perhaps not entirely clear that internal self-references shouldn't\nbe schema-qualified even if the view name is written with a schema.\nSpell it out.\n\nDiscussion: \u0026lt;871sznz69m.fsf@metapensiero.it\u0026gt;","authors":[{"login":"tglsfdc","displayName":"Tom Lane","avatarUrl":"https://avatars.githubusercontent.com/u/8755309?v=4","path":"/tglsfdc","isGitHub":false}],"committerAttribution":false,"committer":{"login":"tglsfdc","displayName":"Tom Lane","avatarUrl":"https://avatars.githubusercontent.com/u/8755309?v=4","path":"/tglsfdc","isGitHub":false},"parents":["3d21f08bccd316c3850a1943c1ee1e381dab1588"],"globalRelayId":"MDY6Q29tbWl0OTI3NDQyOmUzNDMxODcyNWNhNWIyNzRlZmQ2ZjU3ZWE3NDYwZTg5ZjRkY2E5Zjk=","sha1":"3d21f08bccd316c3850a1943c1ee1e381dab1588","sha2":"e34318725ca5b274efd6f57ea7460e89f4dca9f9"},"currentUser":null,"repo":{"id":927442,"defaultBranch":"master","name":"postgres","ownerLogin":"postgres","currentUserCanPush":false,"isFork":false,"isEmpty":false,"createdAt":"2010-09-21T11:35:45.000Z","ownerAvatar":"https://avatars.githubusercontent.com/u/177543?v=4","public":true,"private":false,"isOrgOwned":true},"diffEntryData":[{"diffLines":[{"stylingDirective":null,"type":"HUNK","blobLineNumber":86,"text":"@@ -87,13 +87,13 @@ CREATE [ OR REPLACE ] [ TEMP | TEMPORARY ] [ RECURSIVE ] VIEW \u003creplaceable class","html":"@@ -87,13 +87,13 @@ CREATE [ OR REPLACE ] [ TEMP | TEMPORARY ] [ RECURSIVE ] VIEW \u0026lt;replaceable class","displayNoNewLineWarning":false,"position":0,"left":86,"right":86},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":87,"text":" \u003cpara\u003e","html":" \u0026lt;para\u0026gt;","displayNoNewLineWarning":false,"position":1,"left":87,"right":87},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":88,"text":" Creates a recursive view. The syntax","html":" Creates a recursive view. The syntax","displayNoNewLineWarning":false,"position":2,"left":88,"right":88},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":89,"text":" \u003csynopsis\u003e","html":" \u0026lt;synopsis\u0026gt;","displayNoNewLineWarning":false,"position":3,"left":89,"right":89},{"stylingDirective":null,"type":"DELETION","blobLineNumber":90,"text":"-CREATE RECURSIVE VIEW \u003creplaceable\u003ename\u003c/\u003e (\u003creplaceable\u003ecolumns\u003c/\u003e) AS SELECT \u003creplaceable\u003e...\u003c/\u003e;","html":"-CREATE RECURSIVE VIEW \u0026lt;replaceable\u0026gt;\u003cspan class=\"x x-first x-last\"\u003ename\u003c/span\u003e\u0026lt;/\u0026gt; (\u0026lt;replaceable\u0026gt;\u003cspan class=\"x x-first x-last\"\u003ecolumns\u003c/span\u003e\u0026lt;/\u0026gt;) AS SELECT \u0026lt;replaceable\u0026gt;...\u0026lt;/\u0026gt;;","displayNoNewLineWarning":false,"position":4,"left":90,"right":89},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":90,"text":"+CREATE RECURSIVE VIEW [ \u003creplaceable\u003eschema\u003c/\u003e . ] \u003creplaceable\u003eview_name\u003c/\u003e (\u003creplaceable\u003ecolumn_names\u003c/\u003e) AS SELECT \u003creplaceable\u003e...\u003c/\u003e;","html":"+CREATE RECURSIVE VIEW \u003cspan class=\"x x-first x-last\"\u003e[ \u003c/span\u003e\u0026lt;replaceable\u0026gt;\u003cspan class=\"x x-first x-last\"\u003eschema\u003c/span\u003e\u0026lt;/\u0026gt; \u003cspan class=\"x x-first x-last\"\u003e. ] \u0026lt;replaceable\u0026gt;view_name\u0026lt;/\u0026gt; \u003c/span\u003e(\u0026lt;replaceable\u0026gt;\u003cspan class=\"x x-first x-last\"\u003ecolumn_names\u003c/span\u003e\u0026lt;/\u0026gt;) AS SELECT \u0026lt;replaceable\u0026gt;...\u0026lt;/\u0026gt;;","displayNoNewLineWarning":false,"position":5,"left":90,"right":90},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":91,"text":" \u003c/synopsis\u003e","html":" \u0026lt;/synopsis\u0026gt;","displayNoNewLineWarning":false,"position":6,"left":91,"right":91},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":92,"text":" is equivalent to","html":" is equivalent to","displayNoNewLineWarning":false,"position":7,"left":92,"right":92},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":93,"text":" \u003csynopsis\u003e","html":" \u0026lt;synopsis\u0026gt;","displayNoNewLineWarning":false,"position":8,"left":93,"right":93},{"stylingDirective":null,"type":"DELETION","blobLineNumber":94,"text":"-CREATE VIEW \u003creplaceable\u003ename\u003c/\u003e AS WITH RECURSIVE \u003creplaceable\u003ename\u003c/\u003e (\u003creplaceable\u003ecolumns\u003c/\u003e) AS (SELECT \u003creplaceable\u003e...\u003c/\u003e) SELECT \u003creplaceable\u003ecolumns\u003c/\u003e FROM \u003creplaceable\u003ename\u003c/\u003e;","html":"-CREATE VIEW \u0026lt;replaceable\u0026gt;\u003cspan class=\"x x-first x-last\"\u003ename\u003c/span\u003e\u0026lt;/\u0026gt; AS WITH RECURSIVE \u0026lt;replaceable\u0026gt;\u003cspan class=\"x x-first x-last\"\u003ename\u003c/span\u003e\u0026lt;/\u0026gt; (\u0026lt;replaceable\u0026gt;\u003cspan class=\"x x-first x-last\"\u003ecolumns\u003c/span\u003e\u0026lt;/\u0026gt;) AS (SELECT \u0026lt;replaceable\u0026gt;...\u0026lt;/\u0026gt;) SELECT \u0026lt;replaceable\u0026gt;\u003cspan class=\"x x-first x-last\"\u003ecolumns\u003c/span\u003e\u0026lt;/\u0026gt; FROM \u0026lt;replaceable\u0026gt;\u003cspan class=\"x x-first x-last\"\u003ename\u003c/span\u003e\u0026lt;/\u0026gt;;","displayNoNewLineWarning":false,"position":9,"left":94,"right":93},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":94,"text":"+CREATE VIEW [ \u003creplaceable\u003eschema\u003c/\u003e . ] \u003creplaceable\u003eview_name\u003c/\u003e AS WITH RECURSIVE \u003creplaceable\u003eview_name\u003c/\u003e (\u003creplaceable\u003ecolumn_names\u003c/\u003e) AS (SELECT \u003creplaceable\u003e...\u003c/\u003e) SELECT \u003creplaceable\u003ecolumn_names\u003c/\u003e FROM \u003creplaceable\u003eview_name\u003c/\u003e;","html":"+CREATE VIEW \u003cspan class=\"x x-first x-last\"\u003e[ \u003c/span\u003e\u0026lt;replaceable\u0026gt;\u003cspan class=\"x x-first x-last\"\u003eschema\u003c/span\u003e\u0026lt;/\u0026gt; \u003cspan class=\"x x-first x-last\"\u003e. ] \u0026lt;replaceable\u0026gt;view_name\u0026lt;/\u0026gt; \u003c/span\u003eAS WITH RECURSIVE \u0026lt;replaceable\u0026gt;\u003cspan class=\"x x-first x-last\"\u003eview_name\u003c/span\u003e\u0026lt;/\u0026gt; (\u0026lt;replaceable\u0026gt;\u003cspan class=\"x x-first x-last\"\u003ecolumn_names\u003c/span\u003e\u0026lt;/\u0026gt;) AS (SELECT \u0026lt;replaceable\u0026gt;...\u0026lt;/\u0026gt;) SELECT \u0026lt;replaceable\u0026gt;\u003cspan class=\"x x-first x-last\"\u003ecolumn_names\u003c/span\u003e\u0026lt;/\u0026gt; FROM \u0026lt;replaceable\u0026gt;\u003cspan class=\"x x-first x-last\"\u003eview_name\u003c/span\u003e\u0026lt;/\u0026gt;;","displayNoNewLineWarning":false,"position":10,"left":94,"right":94},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":95,"text":" \u003c/synopsis\u003e","html":" \u0026lt;/synopsis\u0026gt;","displayNoNewLineWarning":false,"position":11,"left":95,"right":95},{"stylingDirective":null,"type":"DELETION","blobLineNumber":96,"text":"- A view column list must be specified for a recursive view.","html":"- A view column list must be specified for a recursive view.","displayNoNewLineWarning":false,"position":12,"left":96,"right":95},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":96,"text":"+ A view column name list must be specified for a recursive view.","html":"+ A view column \u003cspan class=\"x x-first x-last\"\u003ename \u003c/span\u003elist must be specified for a recursive view.","displayNoNewLineWarning":false,"position":13,"left":96,"right":96},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":97,"text":" \u003c/para\u003e","html":" \u0026lt;/para\u0026gt;","displayNoNewLineWarning":false,"position":14,"left":97,"right":97},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":98,"text":" \u003c/listitem\u003e","html":" \u0026lt;/listitem\u0026gt;","displayNoNewLineWarning":false,"position":15,"left":98,"right":98},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":99,"text":" \u003c/varlistentry\u003e","html":" \u0026lt;/varlistentry\u0026gt;","displayNoNewLineWarning":false,"position":16,"left":99,"right":99},{"stylingDirective":null,"type":"HUNK","blobLineNumber":461,"text":"@@ -462,11 +462,16 @@ CREATE VIEW comedies AS","html":"@@ -462,11 +462,16 @@ CREATE VIEW comedies AS","displayNoNewLineWarning":false,"position":17,"left":461,"right":461},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":462,"text":" \u003cpara\u003e","html":" \u0026lt;para\u0026gt;","displayNoNewLineWarning":false,"position":18,"left":462,"right":462},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":463,"text":" Create a recursive view consisting of the numbers from 1 to 100:","html":" Create a recursive view consisting of the numbers from 1 to 100:","displayNoNewLineWarning":false,"position":19,"left":463,"right":463},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":464,"text":" \u003cprogramlisting\u003e","html":" \u0026lt;programlisting\u0026gt;","displayNoNewLineWarning":false,"position":20,"left":464,"right":464},{"stylingDirective":null,"type":"DELETION","blobLineNumber":465,"text":"-CREATE RECURSIVE VIEW nums_1_100 (n) AS","html":"-CREATE RECURSIVE VIEW nums_1_100 (n) AS","displayNoNewLineWarning":false,"position":21,"left":465,"right":464},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":465,"text":"+CREATE RECURSIVE VIEW public.nums_1_100 (n) AS","html":"+CREATE RECURSIVE VIEW \u003cspan class=\"x x-first x-last\"\u003epublic.\u003c/span\u003enums_1_100 (n) AS","displayNoNewLineWarning":false,"position":22,"left":465,"right":465},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":466,"text":" VALUES (1)","html":" VALUES (1)","displayNoNewLineWarning":false,"position":23,"left":466,"right":466},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":467,"text":" UNION ALL","html":" UNION ALL","displayNoNewLineWarning":false,"position":24,"left":467,"right":467},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":468,"text":" SELECT n+1 FROM nums_1_100 WHERE n \u003c 100;","html":" SELECT n+1 FROM nums_1_100 WHERE n \u0026lt; 100;","displayNoNewLineWarning":false,"position":25,"left":468,"right":468},{"stylingDirective":null,"type":"DELETION","blobLineNumber":469,"text":"-\u003c/programlisting\u003e\u003c/para\u003e","html":"-\u0026lt;/programlisting\u0026gt;\u0026lt;/para\u0026gt;","displayNoNewLineWarning":false,"position":26,"left":469,"right":468},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":469,"text":"+\u003c/programlisting\u003e","html":"+\u0026lt;/programlisting\u0026gt;","displayNoNewLineWarning":false,"position":27,"left":469,"right":469},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":470,"text":"+ Notice that although the recursive view's name is schema-qualified in this","html":"+ Notice that although the recursive view\u0026#39;s name is schema-qualified in this","displayNoNewLineWarning":false,"position":28,"left":469,"right":470},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":471,"text":"+ \u003ccommand\u003eCREATE\u003c/\u003e, its internal self-reference is not schema-qualified.","html":"+ \u0026lt;command\u0026gt;CREATE\u0026lt;/\u0026gt;, its internal self-reference is not schema-qualified.","displayNoNewLineWarning":false,"position":29,"left":469,"right":471},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":472,"text":"+ This is because the implicitly-created CTE's name cannot be","html":"+ This is because the implicitly-created CTE\u0026#39;s name cannot be","displayNoNewLineWarning":false,"position":30,"left":469,"right":472},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":473,"text":"+ schema-qualified.","html":"+ schema-qualified.","displayNoNewLineWarning":false,"position":31,"left":469,"right":473},{"stylingDirective":null,"type":"ADDITION","blobLineNumber":474,"text":"+ \u003c/para\u003e","html":"+ \u0026lt;/para\u0026gt;","displayNoNewLineWarning":false,"position":32,"left":469,"right":474},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":475,"text":" \u003c/refsect1\u003e","html":" \u0026lt;/refsect1\u0026gt;","displayNoNewLineWarning":false,"position":33,"left":470,"right":475},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":476,"text":" ","html":"\u003cbr\u003e","displayNoNewLineWarning":false,"position":34,"left":471,"right":476},{"stylingDirective":null,"type":"CONTEXT","blobLineNumber":477,"text":" \u003crefsect1\u003e","html":" \u0026lt;refsect1\u0026gt;","displayNoNewLineWarning":false,"position":35,"left":472,"right":477}],"diffNumber":0,"diffSize":"0 Bytes","isBinary":false,"isTooBig":false,"collapsed":false,"isSubmodule":false,"lineCount":497,"linesChanged":15,"newTreeEntry":{"lineCount":497,"path":"doc/src/sgml/ref/create_view.sgml","mode":100644,"isGenerated":false},"oldTreeEntry":{"lineCount":0,"path":"doc/src/sgml/ref/create_view.sgml","mode":100644},"linesAdded":10,"linesDeleted":5,"path":"doc/src/sgml/ref/create_view.sgml","pathDigest":"a257964452a59b8e948600626f4669a9934a1c7e57d2d43c264e006a05936d74","status":"MODIFIED","truncatedReason":null,"oldOid":"3d21f08bccd316c3850a1943c1ee1e381dab1588","newOid":"e34318725ca5b274efd6f57ea7460e89f4dca9f9","copilotChatReference":null,"deletedSha":"3d21f08bccd316c3850a1943c1ee1e381dab1588","canToggleRichDiff":false,"defaultToRichDiff":false,"proseDifffHtml":null,"renderInfo":null,"dependencyDiffPath":null,"submodule":null}],"splitViewPreference":"unified","ignoreWhitespace":false,"repoOwnerGlobalRelayId":"MDEyOk9yZ2FuaXphdGlvbjE3NzU0Mw==","commentsPreference":"visible","diffLineSpacingPreference":"relaxed","useMonospaceFont":false,"pasteUrlLinkAsPlainText":false,"userNotices":[],"path":"/postgres/postgres/commit/e34318725ca5b274efd6f57ea7460e89f4dca9f9","fileTreeExpanded":true,"headerInfo":{"additions":10,"deletions":5,"filesChanged":1,"filesChangedString":"1"},"moreDiffsToLoad":false,"asyncDiffLoadInfo":{"startIndex":1,"truncated":false,"byteCount":1726,"lineShownCount":36},"commentInfo":{"canComment":false,"locked":false,"canLock":false,"repoArchived":false},"csrf_tokens":{"/users/diffview?diff=split":{"post":"7TIxjAqTQGYHaDjMv-WbsTZEBoMggeHsaXLhxX4XLiuFGscq9uq3wEsNmf5tDgp5bDIBwQQ8ipQnOF-0mEVkvw"},"/users/diffview?diff=unified":{"post":"BWG471JCw-Y4bsNpcC842ykfJi4ROVEWrMZCX9QdIABtSU5Jrjs0QHQLYluixKkTc2khbDWEOm7ijPwuMk9qlA"},"/notifications/thread":{"post":"n7xa7Jzv3VugX5bz-UEOFFSUON74hN-O42CoSSu6zHYrVmArplpuc9p7xwHVgfppYwG3TQVuvqFJeKJoX93WqA"}}},"title":"Improve documentation for CREATE RECURSIVE VIEW. · postgres/postgres@e343187","appPayload":{"helpUrl":"https://docs.github.com","findInDiffWorkerPath":"/assets-cdn/worker/find-in-diff-worker-2bfe39677d14.js","enabled_features":{"diff_ux_refresh_beta":false,"diff_inline_comments":true,"diff_ux_refresh_ssr_five":false,"diff_ux_refresh_ssr_ten":false,"react_diff_line_type_character_correction":true}}}
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>
@@ -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 VIEW public.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
0 commit comments