Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1f3Tnm-0003x8-LC for pgsql-hackers@arkaria.postgresql.org; Tue, 03 Apr 2018 21:49:14 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1f3Tnl-0007Vz-NZ for pgsql-hackers@arkaria.postgresql.org; Tue, 03 Apr 2018 21:49:13 +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 1f3Tnk-0007SX-NI for pgsql-hackers@lists.postgresql.org; Tue, 03 Apr 2018 21:49:13 +0000 Received: from new1-smtp.messagingengine.com ([66.111.4.221]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1f3Tnf-0002I5-Oy for pgsql-hackers@postgresql.org; Tue, 03 Apr 2018 21:49:12 +0000 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailnew.nyi.internal (Postfix) with ESMTP id 47FD5149A; Tue, 3 Apr 2018 17:49:06 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Tue, 03 Apr 2018 17:49:06 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:subject:to :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; bh=TQ5QgHXjeXhIjFN0C cBhQao/XjGctUjiP/yg5vnR8wA=; b=LRKG2lm8k1wxcrijh5BTJRqAPePLBb4gx 0Aer/HyM2ptVwlVZcwFqoTG1IYrRcLYGFwHkGPLBao1bgUX0YA2JbGt9JSgmCspJ kWcdwMPO0ECHS8Wsw8cD3+7S8AQFkkdopDHaTBbhZ9eHM27JqCHXUho8LuAGWFgV RnlGmGuFUoVcWNXjo7Y3zpNH3icYs6H+Gm+77s3cFztmHjLmh9Qix+IPBQA0QK8j o27L13NeH0e50+36N3+7q0QnczKpA5S+DVtFPR8Lwxs96rI3PBqWmM46eOMqZqkf EkDfcEL7AgEodweExYXCV2nFMkbstFlRX3fKK1ztP37bpmT8gytiw== X-ME-Sender: Received: from alvin.alvh.no-ip.org (unknown [179.56.29.253]) by mail.messagingengine.com (Postfix) with ESMTPA id B3AFBE4437; Tue, 3 Apr 2018 17:49:05 -0400 (EDT) Received: by alvin.alvh.no-ip.org (Postfix, from userid 1000) id D57EE2AB; Tue, 3 Apr 2018 18:49:03 -0300 (-03) Date: Tue, 3 Apr 2018 18:49:03 -0300 From: Alvaro Herrera To: Peter Eisentraut Cc: Pg Hackers Subject: Re: Foreign keys and partitioned tables Message-ID: <20180403214903.ozfagwjcpk337uw7@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <8a3e483c-d89f-6872-74ac-5f0ee36357eb@2ndquadrant.com> User-Agent: NeoMutt/20170306-137-4415bd-dirty (1.8.0) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Peter Eisentraut wrote: > > 0002 is a fixup for a bug in the row triggers patch: I had a restriction > > earlier that triggers declared internal were not cloned, and I seem to > > have lost it in rebase. Reinstate it. > > Hmm, doesn't cause any test changes? Here's a test case: create table t (a int) partition by range (a); create table t1 partition of t for values from (0) to (1000); alter table t add constraint uniq unique (a) deferrable; create table t2 partition of t for values from (1000) to (2000); create table t3 partition of t for values from (2000) to (3000) partition by range (a); create table t33 partition of t3 for values from (2000) to (2100); Tables t and t1 have one trigger; tables t2 and t3 have two triggers; table t33 has three triggers: alvherre=# select tgrelid::regclass, count(*) from pg_trigger where tgrelid::regclass in ('t', 't1', 't2', 't3', 't33') group by tgrelid; tgrelid │ count ─────────┼─────── t │ 1 t1 │ 1 t2 │ 2 t3 │ 2 t33 │ 3 (5 filas) These triggers probably all do the same thing, so there is no correctness issue -- only speed. I suppose it's not impossible to construct a case that shows some actual breakage -- I just don't know how. -- Álvaro Herrera https://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services