Received: from malur.postgresql.org ([2a02:16a8:dc51::56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fn6uD-0004sv-9B for pgsql-bugs@arkaria.postgresql.org; Tue, 07 Aug 2018 18:40:29 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fn6uA-0004vj-Dn for pgsql-bugs@arkaria.postgresql.org; Tue, 07 Aug 2018 18:40:26 +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.89) (envelope-from ) id 1fn6uA-0004vD-89 for pgsql-bugs@lists.postgresql.org; Tue, 07 Aug 2018 18:40:26 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fn6u1-0006Me-Vo for pgsql-bugs@lists.postgresql.org; Tue, 07 Aug 2018 18:40:25 +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 w77IeDVg027953; Tue, 7 Aug 2018 14:40:13 -0400 From: Tom Lane To: Haribabu Kommi cc: nickbarnes01@gmail.com, pgsql-bugs@lists.postgresql.org Subject: Re: BUG #15310: pg_upgrade dissociates event triggers from extensions In-reply-to: References: <153360083872.1395.4593932457718151600@wrigleys.postgresql.org> Comments: In-reply-to Haribabu Kommi message dated "Tue, 07 Aug 2018 19:40:24 +1000" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <27951.1533667213.1@sss.pgh.pa.us> Date: Tue, 07 Aug 2018 14:40:13 -0400 Message-ID: <27952.1533667213@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Haribabu Kommi writes: > On Tue, Aug 7, 2018 at 10:14 AM PG Bug reporting form < > noreply@postgresql.org> wrote: >> I have an extension which contains an event trigger. As expected, CREATE >> EXTENSION adds a pg_depend entry between the trigger and the extension. But >> after running pg_upgrade, this pg_depend entry is gone (and the extension's >> CREATE EVENT TRIGGER statement now shows up in the pg_dump output, causing >> the restore to fail with an "event trigger already exists" error). >> Did I miss something, or is this a bug? > Yes, I feel it is a bug. Undoubtedly. I haven't checked your fix in detail yet but it looks plausible. I poked around to see if there were any other missing moving parts in extension membership support. Mostly we seem to be OK ... but I found out that CreateUserMapping contains a recordDependencyOnCurrentExtension call, even though there is no support in the grammar for ALTER EXTENSION ADD/DROP USER MAPPING, nor does pg_dump check for extension membership when dumping a user mapping. (So if someone did do a CREATE USER MAPPING in an extension, the membership would be recorded but then silently lost during pg_upgrade, just as with this bug.) I'm inclined to think that not supporting that is the correct thing: if we don't allow roles to be extension members, then user mappings for roles shouldn't be either. Unless someone can come up with a convincing use-case for that, I think we should remove the recordDependencyOnCurrentExtension call from CreateUserMapping. > Do we need to support the same for trigger also? No. Whole tables can be extension members, not properties of tables. regards, tom lane