Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tlCFU-00A1q7-B5 for pgsql-admin@arkaria.postgresql.org; Thu, 20 Feb 2025 19:30:16 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1tlCFS-00C8NT-EV for pgsql-admin@arkaria.postgresql.org; Thu, 20 Feb 2025 19:30:14 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tlCFS-00C8NL-3J for pgsql-admin@lists.postgresql.org; Thu, 20 Feb 2025 19:30:14 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1tlCFP-00210h-2p for pgsql-admin@lists.postgresql.org; Thu, 20 Feb 2025 19:30:13 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 51KJUA012790100; Thu, 20 Feb 2025 14:30:10 -0500 From: Tom Lane To: Olleg Samoylov cc: pgsql-admin@lists.postgresql.org Subject: Re: A trigger in an extension In-reply-to: <40129c90-138c-4331-a3d6-c04158cb91e0@ya.ru> References: <40129c90-138c-4331-a3d6-c04158cb91e0@ya.ru> Comments: In-reply-to Olleg Samoylov message dated "Thu, 20 Feb 2025 22:23:18 +0300" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <2790098.1740079810.1@sss.pgh.pa.us> Date: Thu, 20 Feb 2025 14:30:10 -0500 Message-ID: <2790099.1740079810@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Olleg Samoylov writes: > I have the extension pgpro_scheduler. In the exception there are two > tables and the trigger on one of them that write to the other. I was > surprised but when I load dump created by pg_dump this trigger is > created in the pre-data stage (automatically by create extension) early > and thus has wrong behavior when uploaded data in the data stage (lead > to duplication of primary key). pg_dump does not like to editorialize on the contents of extensions. It just does CREATE EXTENSION and doesn't inquire into what's in them. I'd argue that if you need triggers like this, maybe you should rethink your data model. regards, tom lane