Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1btxQG-0000i9-RI for pgsql-general@arkaria.postgresql.org; Tue, 11 Oct 2016 13:48:48 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1btxQG-0005pk-9J for pgsql-general@arkaria.postgresql.org; Tue, 11 Oct 2016 13:48:48 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1btxNv-0000Yc-Is for pgsql-general@postgresql.org; Tue, 11 Oct 2016 13:46:23 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1btxNs-0008GE-Eb for pgsql-general@postgresql.org; Tue, 11 Oct 2016 13:46:22 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id u9BDkDrx025888; Tue, 11 Oct 2016 09:46:14 -0400 From: Tom Lane To: Lele Gaifax cc: pgsql-general@postgresql.org Subject: Re: Create recursive view schema.name In-reply-to: <871sznz69m.fsf@metapensiero.it> References: <871sznz69m.fsf@metapensiero.it> Comments: In-reply-to Lele Gaifax message dated "Tue, 11 Oct 2016 09:36:37 +0200" Date: Tue, 11 Oct 2016 09:46:13 -0400 Message-ID: <25887.1476193573@sss.pgh.pa.us> X-Pg-Spam-Score: -2.2 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-general Precedence: bulk Sender: pgsql-general-owner@postgresql.org Lele Gaifax 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