Re: Multiple SELECT statements Using One WITH statement - Mailing list pgsql-general

From David G. Johnston
Subject Re: Multiple SELECT statements Using One WITH statement
Date
Msg-id CAKFQuwbxp5ge5mPHovsZ3Y4HBK9mVH4XBeYeAhReA4Co5X+M9Q@mail.gmail.com
Whole thread Raw
In response to Re: Multiple SELECT statements Using One WITH statement  (Ken Tanzer <ken.tanzer@gmail.com>)
Responses Re: Multiple SELECT statements Using One WITH statement  ("David G. Johnston" <david.g.johnston@gmail.com>)
List pgsql-general
On Thu, Jan 20, 2022 at 4:32 PM Ken Tanzer <ken.tanzer@gmail.com> wrote:


On Thu, Jan 20, 2022 at 8:46 AM David G. Johnston <david.g.johnston@gmail.com> wrote:
You can always write:

CREATE VIEW cte_view AS
WITH cte AS (...)
SELECT * FROM cte;

And then incorporate that into any queries that require the results of said CTE.


Is there any advantage to still using a CTE inside the view definition, and then selecting it?  Instead of just

CREATE VIEW cte_view AS
(...);

Just curious, in case I'm missing something!


No. That would be tunnel vision and early morning posting on my part.

David J.

pgsql-general by date:

Previous
From: Ken Tanzer
Date:
Subject: Re: Multiple SELECT statements Using One WITH statement
Next
From: "David G. Johnston"
Date:
Subject: Re: Multiple SELECT statements Using One WITH statement