Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1ZHqj1-0003Lj-Am for pgsql-bugs@arkaria.postgresql.org; Wed, 22 Jul 2015 09:54:07 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1ZHqj0-0004Jh-RU for pgsql-bugs@arkaria.postgresql.org; Wed, 22 Jul 2015 09:54:06 +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 1ZHqiO-0003Yf-8j for pgsql-bugs@postgresql.org; Wed, 22 Jul 2015 09:53:28 +0000 Received: from smtp.neteip.com ([92.223.241.37]) by magus.postgresql.org with esmtp (Exim 4.84) (envelope-from ) id 1ZHqiG-0001Am-6S for pgsql-bugs@postgresql.org; Wed, 22 Jul 2015 09:53:27 +0000 Received: from localhost (localhost [127.0.0.1]) by netengineering.neteip.com (Postfix) with ESMTP id 83E7744A118; Wed, 22 Jul 2015 11:53:18 +0200 (CEST) Received: from smtp.neteip.com ([127.0.0.1]) by localhost (netengineering.neteip.com [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id JyR00wsgjwWj; Wed, 22 Jul 2015 11:53:17 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by netengineering.neteip.com (Postfix) with ESMTP id 4A86744747F; Wed, 22 Jul 2015 11:53:17 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.8.4 netengineering.neteip.com 4A86744747F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=net-international.com; s=41314C00-A54D-11E3-A303-573A9EF291EC; t=1437558797; bh=j1u2FmLKjTPFkDhzXVK0GjmRtzVTv4z19Tmm+bV74IY=; h=Date:From:To:Message-ID:Subject:MIME-Version:Content-Type: Content-Transfer-Encoding; b=28dY2ZCAf7p5rJ/OXPHdKUEA5KNbmdfxJqNNtRagB0VCcWwSmLGQ8l6kNRnRa/3Cf ldnkhaRrByr3ppTsvC2VZwTJWoP7U9NAhDt34rw0h5SlZihm2emh0BaeWXhgnvKgEM 4f4LBb2aoyDPvPU/N/OkDcV6OcS21gYE2WJhAejQ= X-Virus-Scanned: amavisd-new at netspa.com Received: from smtp.neteip.com ([127.0.0.1]) by localhost (netengineering.neteip.com [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id YfS3kWot9Csi; Wed, 22 Jul 2015 11:53:17 +0200 (CEST) Received: from netengineering.neteip.com (localhost [127.0.0.1]) by netengineering.neteip.com (Postfix) with ESMTP id 1EE7C44A118; Wed, 22 Jul 2015 11:53:17 +0200 (CEST) Date: Wed, 22 Jul 2015 11:53:16 +0200 (CEST) From: Piergiorgio Buongiovanni To: Andres Freund Cc: pgsql-bugs@postgresql.org Message-ID: <416591758.338151.1437558796979.JavaMail.zimbra@net-international.com> In-Reply-To: <20150722085906.GE5053@awork2.anarazel.de> References: <20150722082538.9705.21746@wrigleys.postgresql.org> <20150722085906.GE5053@awork2.anarazel.de> Subject: Re: BUG #13513: Turning a table into a view MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Mailer: Zimbra 8.0.6_GA_5922 (ZimbraWebClient - GC43 (Win)/8.0.6_GA_5922) Thread-Topic: BUG #13513: Turning a table into a view Thread-Index: 7z8BXolrhqEW5cybmF/hDRHM/BKuVQ== X-Pg-Spam-Score: -2.0 (--) 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 Hi Andres, thank you very much for your email. Just only to answer to your question, we are doing some tests with our RAD = (Instant Developer) and we are trying to "cheating" it. PostgreSQL is very powerful allowing us to use views as tables through the = RULE mechanism. Well. Our RAD doesn't treat views as tables (probably the problem is the JD= BC driver) and we cannot insert data into a view. So we create a table, then we import that table into the project and the RA= D reads all the info (constraints, default values, etc.) and creates the fi= elds correctly. At the end we turn the table into a view simply using rules. However I understand your explanation below and I agree with you. Thanks very much Regards Piergiorgio ----- Messaggio originale ----- Da: "Andres Freund" A: "p buongiovanni" Cc: pgsql-bugs@postgresql.org Inviato: Mercoled=C3=AC, 22 luglio 2015 10:59:06 Oggetto: Re: [BUGS] BUG #13513: Turning a table into a view 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 th= at > 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 --=20 Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs