Re: Multiple SELECT statements Using One WITH statement

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Ken Tanzer <ken(dot)tanzer(at)gmail(dot)com>
Cc: Avi Weinberg <AviW(at)gilat(dot)com>, "pgsql-general(at)lists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: Multiple SELECT statements Using One WITH statement
Date: 2022-01-20 23:34:15
Message-ID: CAKFQuwbxp5ge5mPHovsZ3Y4HBK9mVH4XBeYeAhReA4Co5X+M9Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thu, Jan 20, 2022 at 4:32 PM Ken Tanzer <ken(dot)tanzer(at)gmail(dot)com> wrote:

>
>
> On Thu, Jan 20, 2022 at 8:46 AM David G. Johnston <
> david(dot)g(dot)johnston(at)gmail(dot)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.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message David G. Johnston 2022-01-20 23:35:14 Re: Multiple SELECT statements Using One WITH statement
Previous Message Ken Tanzer 2022-01-20 23:32:10 Re: Multiple SELECT statements Using One WITH statement