From: Tom Lane <tgl@sss.pgh.pa.us>
To: Lele Gaifax <lele@metapensiero.it>
Cc: pgsql-general@postgresql.org
Subject: Re: Create recursive view schema.name
Date: Tue, 11 Oct 2016 09:46:13 -0400
Message-ID: <25887.1476193573@sss.pgh.pa.us> (raw)
In-Reply-To: <871sznz69m.fsf@metapensiero.it>
References: <871sznz69m.fsf@metapensiero.it>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-general>
Lele Gaifax <lele@metapensiero.it> writes:
> I have a working recursive-CTE query, and I tried wrapping it in a view:
> reading the documentation I found the "CREATE RECURSIVE VIEW" form, so I tried
> it.
> It works as far as I use a "simple" name for the view:
> but I get an error when I create it in a specific schema:
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.
regards, tom lane
--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: tgl@sss.pgh.pa.us, lele@metapensiero.it
Subject: Re: Create recursive view schema.name
In-Reply-To: <25887.1476193573@sss.pgh.pa.us>
References: <871sznz69m.fsf@metapensiero.it> <25887.1476193573@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox