Re: Create recursive view schema.name - Mailing list pgsql-general

From Lele Gaifax
Subject Re: Create recursive view schema.name
Date
Msg-id 87wphfx9cl.fsf@metapensiero.it
Whole thread Raw
In response to Create recursive view schema.name  (Lele Gaifax <lele@metapensiero.it>)
List pgsql-general
Tom Lane <tgl@sss.pgh.pa.us> writes:

> The manual says
>     CREATE RECURSIVE VIEW name (columns) AS SELECT ...;
>     is equivalent to
>     CREATE VIEW name AS WITH RECURSIVE name (columns) AS (SELECT ...) SELECT columns FROM name;
>
> I guess it could be more explicit about the fact that the implied CTE just
> has the base name of the view; but since CTE names can't be qualified,
> that's not that hard to guess.  Short answer is that you don't qualify the
> view's internal self-reference, even if you are using a schema name in the
> CREATE.

Thank you Tom, it works.

I agree with you that the doc could/should be fixed/enhanced, because the
explanation of "name" is immediately following the snippet you cited, and it
says "The name (optionally schema-qualified) of a view to be created": it
would never occurred to me that I could use a not-qualified name within the
view.

bye, lele.
--
nickname: Lele Gaifax | Quando vivrò di quello che ho pensato ieri
real: Emanuele Gaifas | comincerò ad aver paura di chi mi copia.
lele@metapensiero.it  |                 -- Fortunato Depero, 1929.

pgsql-general by date:

Previous
From: Adrian Klaver
Date:
Subject: Re: confusion about user paring with pg_hba and pg_ident
Next
From: Tom Lane
Date:
Subject: Re: confusion about user paring with pg_hba and pg_ident