Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jfNsb-0007zP-H4 for pgsql-general@arkaria.postgresql.org; Sun, 31 May 2020 13:19:58 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jfNsY-0004PV-3y for pgsql-general@arkaria.postgresql.org; Sun, 31 May 2020 13:19:54 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jfNsX-0004N6-JY for pgsql-general@lists.postgresql.org; Sun, 31 May 2020 13:19:53 +0000 Received: from lb1-smtp-cloud9.xs4all.net ([194.109.24.22]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jfNsQ-0007Ts-4P for pgsql-general@lists.postgresql.org; Sun, 31 May 2020 13:19:52 +0000 Received: from cust-09840407 ([IPv6:fc0c:c117:af1b:7672:8e54:ec41:afcd:d795]) by smtp-cloud9.xs4all.net with ESMTPA id fNsMjEvFtCKzefNsNjALgn; Sun, 31 May 2020 15:19:44 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xs4all.nl; s=s1; t=1590931184; bh=DlJC0bbGd75hum8DlOVu+4uv0+qdUgjFRdvFYl6O4Kw=; h=From:Subject:To:Message-ID:Date:MIME-Version:Content-Type:From: Subject; b=s+N3sYNzS5jw4dIhx5bqExrSI2/Wk30meoG6yXWk6fcxnidPYe+wQ735U1iR+7JH8 2AzXyBHlTZecRxLFfz5jEfM5hI8x2gh7VvMLwHAKpYBcRzEFwFYG1qYpKd2vhEH8XO SzxJBNHdLyMOnpAo/DQEzHzWNUP0qO8wXBI0q4XBW99/UFwrCZGhUJSPv/qXTLvx9L GsSLp3oo41ob6iWVxmZcN8faPwvqTYCPetM+OS5aZvO0e8bSDfXwZkB40TYke6Uo8d iHx+9AnP96F1ODewhnm0nzBpSRIuBGQBT20kjs+0oGBKhugLBv1edsUFe4f2WhXXih 8r3ptwOUv3NtQ== From: Hans Subject: Trigger not firing To: pgsql-general@lists.postgresql.org References: <159077982292.12069.16282824319899836435@malur.postgresql.org> Message-ID: <0f0451cc-aa72-2cfc-111a-5e956ca16457@xs4all.nl> Date: Sun, 31 May 2020 15:19:42 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:68.0) Gecko/20100101 Thunderbird/68.8.1 MIME-Version: 1.0 In-Reply-To: <159077982292.12069.16282824319899836435@malur.postgresql.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-CMAE-Envelope: MS4wfLYpO28mb8a/oSsCHK3+n4CdQqueEo8VxtVyrpd32v2v5e5AuoSAbKLYBwAb2CqXIVu6NrazxkJN5q+1jy3OIx1MatigNawsrWJVJb3ILmF8YdN7camH NphIIVGtLaYMJrmGonCdS2Fqz9pCCzHm/alfuH89hEWzcfrwngwLaWfK+IYrLCEQh9Uz59gAlbAyOdNqKiLdFhNg9/hDzptX05W/WzvRDHUT5SR97zriNXGK AjJ+llUp2oXRN4xmw/QMc8uLn3RBiFCGpkFkt1K12kfFg6spVXrbc6GJq9bGNnuf List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Hi, I've had a weird problem in a production system. The customer had installed a new server with our software on it. The software installs a Postgres database schema that includes a number of triggers. The triggers perform inserts into an additional table. In this installation, from what I can tell, some triggers somehow got into a disabled state: - they were confirmed to be present (checked using pgAdmin 4). - In the trigger property window of pgAdmin 4, the triggers were listed as enabled. - However, attempts to trigger them (by performing an appropriate insert or update) didn't visibly result in the trigger running (no entries in the additional table were created). The insert/update itself worked fine. I asked the customer to look in pg_trigger. The triggers were listed with tgenabled set to 'O' (but I'm not sure if that is the right thing to look at). Our software contains no code for disabling triggers. It creates them once, during database initialisation (i.e. before any data is put in), and then leaves them alone. I have no reason to believe the customer messed with the database either. How we resolved this: after using "triggers -> enable all" in pgAdmin on that table, the triggers were now found to be working as expected. So the trigger code is correct and works, but it (somehow) wasn't enabled. Moreover, pgAdmin apparently reported this state incorrectly. My question is: what could have happened? Postgres 10.3, 64-bits, Ubuntu (I think 18.04). - Are triggers always automatically created in the 'enabled' state, or are there conditions that could cause them to start as 'disabled', or in some other way inactive? - What could have caused pgAdmin to report the trigger as 'enabled' even though, from what I can tell, it really wasn't? - Is there a log file that could shed more light on this situation? The customer is willing to try another installation, to see if the problem can be replicated. I can ask for additional logging to be enabled if that helps in understanding this problem. What would be helpful in troubleshooting this? Thanks in advance for any insight you may have, Hans