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 1sp6t8-00GeZ4-Dg for pgsql-bugs@arkaria.postgresql.org; Fri, 13 Sep 2024 14:03:07 +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 1sp6sA-003NQg-3Q for pgsql-bugs@arkaria.postgresql.org; Fri, 13 Sep 2024 14:02:06 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sp2Ds-00GWWR-LE for pgsql-bugs@lists.postgresql.org; Fri, 13 Sep 2024 09:04:12 +0000 Received: from mail-wr1-x42d.google.com ([2a00:1450:4864:20::42d]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1sp2Dp-000wES-L2 for pgsql-bugs@lists.postgresql.org; Fri, 13 Sep 2024 09:04:11 +0000 Received: by mail-wr1-x42d.google.com with SMTP id ffacd0b85a97d-3787f30d892so485597f8f.0 for ; Fri, 13 Sep 2024 02:04:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=deepbluecap-com.20230601.gappssmtp.com; s=20230601; t=1726218248; x=1726823048; darn=lists.postgresql.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=nUY6empLiiHOS6iFSjN/11FlMrF7J6WTCB2VoTRlwcA=; b=BUUh+Ueg478j9e43Omae/yhhiQRb7I/hyAKd/Y2RaZUsN17mYupm0CqFin5Cr+x7MS K4bvb2WMNLNtYpnM42gk6ZE87CXWTs6EViWpJ2Wpcg5O3/0Fy3e2BVhh2iVoME18CD9t UcmmWWgVv1YSZss25jjYuSHQBmbTIfz++8Mgn4E3GWLxwXBsT6t9MhozyEaJsdg1ohoe VpxYcIlRnkezU+92+NvIsxcqOn0xfe8Flz66wOIP80P+Gwy121vcK+Om3Zt4g3k8QbdK YRut0WOS9D3oOKBqNfcxfWnFVaLSt1o0fzZU1yu0SBqTnkd6LpYVs736K9bEau1Q5U/Z ZXTQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726218248; x=1726823048; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=nUY6empLiiHOS6iFSjN/11FlMrF7J6WTCB2VoTRlwcA=; b=eMAZOStzafQomyMh0XQgy8ffaza5Gm+1ZbT8bOzxxjOg/pjvCBqgII4kZ68QtY23Jh BP5YkvNQXbbkTHvHMGc0bniAE3LQ89dCgIg7BDV+JTK1IS/jqXV9S1SQcFKXna1SSYm8 JAX9xTmkYQ2zGn4cgS430tLtDjgES8Y9gYnzNP7WSfxOIWw8q6lTJJ6u2Ivvi7M/ilGZ qghYjOFuzWMmIFAmnNR/eebk5T/zXl2IhK5BvoGgKm1k/yDPmkMZrUVQOmpUt2PzsW2p nekQp/ShqF3g4QAf4Q/D/6G1CU2ULnhyZ1b5KazT060A1/BLoY4cs2CK/d5EKGkvhAHJ 97QA== X-Gm-Message-State: AOJu0YwB0w3RABilFaZOlldmSMQsNkQxWh+r3luyUPDdxsp0XeEygEet Ckq9ERdBwZ/IQn1UfqPpP/JTDdUP65BJuoeqWvsTTcpar8dV+Kg5cYlYbPY0ZDc= X-Google-Smtp-Source: AGHT+IH2FZFvk/pQZNtH7K+iVZOq+pBRnOVz/ZFMVMi2iERg0LC+1vP2i4/4w6F/LSFpZAQExxpvEQ== X-Received: by 2002:adf:b353:0:b0:374:b24e:d2bf with SMTP id ffacd0b85a97d-378d61f0af4mr1093452f8f.27.1726218248143; Fri, 13 Sep 2024 02:04:08 -0700 (PDT) Received: from ?IPV6:2a01:e0a:255:1000:62b5:e310:63f5:e5eb? ([2a01:e0a:255:1000:62b5:e310:63f5:e5eb]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-378956d367csm16098003f8f.68.2024.09.13.02.04.07 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 13 Sep 2024 02:04:07 -0700 (PDT) Message-ID: Date: Fri, 13 Sep 2024 11:04:07 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: pg_restore with --disable-triggers discards ENABLE ALWAYS To: Tom Lane , Laurenz Albe Cc: pgsql-bugs@lists.postgresql.org References: <78a13f951a03bf325027f8dcfb32b1b5089cdb14.camel@cybertec.at> <4156698.1726174027@sss.pgh.pa.us> Content-Language: en-US From: Duncan Sands In-Reply-To: <4156698.1726174027@sss.pgh.pa.us> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi Tom, thanks for taking a look. > The given recipe seems incomplete, I'm not sure what is missing in the recipe. I just dropped and recreated the database, and performed exactly the steps listed in my original email, and get exactly the same result. > but I think Duncan has put his > finger on a shortcoming. pg_restore with --disable-triggers will > issue > > ALTER TABLE foo DISABLE TRIGGER ALL; > > and later > > ALTER TABLE foo ENABLE TRIGGER ALL; > > and if you read the fine print in the ALTER TABLE man page, > you'll discover that ENABLE TRIGGER sets the triggers' replication > mode to the default (origin only). I'm not sure why somebody > thought that replication mode shouldn't be stored separately > from enable/disable, but it isn't: there's just one four-valued > state field. > > We could probably add code to make pg_dump individually re-enable > the table's triggers with the appropriate state(s), but I can't > muster too much enthusiasm for writing that myself.