Re: Create recursive view schema.name

From: Lele Gaifax <lele(at)metapensiero(dot)it>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Create recursive view schema.name
Date: 2016-10-11 14:12:58
Message-ID: 87wphfx9cl.fsf@metapensiero.it
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)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(at)metapensiero(dot)it | -- Fortunato Depero, 1929.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2016-10-11 14:20:37 Re: confusion about user paring with pg_hba and pg_ident
Previous Message Adrian Klaver 2016-10-11 14:08:27 Re: confusion about user paring with pg_hba and pg_ident