Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1ZHprv-0001PB-R9 for pgsql-bugs@arkaria.postgresql.org; Wed, 22 Jul 2015 08:59:15 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1ZHpru-0000Pd-1r for pgsql-bugs@arkaria.postgresql.org; Wed, 22 Jul 2015 08:59:14 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1ZHprt-0000PW-Jh for pgsql-bugs@postgresql.org; Wed, 22 Jul 2015 08:59:13 +0000 Received: from mail.anarazel.de ([217.115.131.40]) by magus.postgresql.org with esmtp (Exim 4.84) (envelope-from ) id 1ZHprq-00007F-Dl for pgsql-bugs@postgresql.org; Wed, 22 Jul 2015 08:59:12 +0000 Received: by mail.anarazel.de (Postfix, from userid 108) id 046A5860002; Wed, 22 Jul 2015 10:59:09 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on mail X-Spam-Level: X-Spam-Status: No, score=-6.4 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.2.5 Received: from anarazel.de (p5DDC6ED2.dip0.t-ipconnect.de [93.220.110.210]) (Authenticated sender: andres@anarazel.de) by mail.anarazel.de (Postfix) with ESMTPSA id 94312860001; Wed, 22 Jul 2015 10:59:06 +0200 (CEST) Received: by anarazel.de (Postfix, from userid 1000) id 19994100C3E; Wed, 22 Jul 2015 10:59:06 +0200 (CEST) Date: Wed, 22 Jul 2015 10:59:06 +0200 From: Andres Freund To: p.buongiovanni@net-international.com Cc: pgsql-bugs@postgresql.org Subject: Re: BUG #13513: Turning a table into a view Message-ID: <20150722085906.GE5053@awork2.anarazel.de> References: <20150722082538.9705.21746@wrigleys.postgresql.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150722082538.9705.21746@wrigleys.postgresql.org> X-Pg-Spam-Score: -5.4 (-----) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org On 2015-07-22 08:25:38 +0000, p.buongiovanni@net-international.com wrote: > I create the table MyTable with a foreign key. In a second time I drop that > foreign key (using ALTER TABLE command) in order to turn the table MyTable > into a view, using the command: CREATE RULE "_RETURN" AS ON SELECT TO > MyTable DO INSTEAD... > The server doesn't allow me to esecute this command as it tells me that > there is a foreign key or a trigger on the table MyTable. > The problem does not occur if I create the table MyTable without foreign > keys at the beginnning. Why are you converting tables to views like that? That's really only supported to break dependency cycles when restoring dumps... The "problem" is that we don't reset relhastriggers (and some other fields) when dropping them, which normally is fine. Regards, Andres -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs