Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gkYZQ-0004b8-Bs for pgsql-bugs@arkaria.postgresql.org; Fri, 18 Jan 2019 18:08:44 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gkYZO-0002jz-SA for pgsql-bugs@arkaria.postgresql.org; Fri, 18 Jan 2019 18:08:42 +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_SHA1:256) (Exim 4.89) (envelope-from ) id 1gkYZO-0002hL-FM for pgsql-bugs@lists.postgresql.org; Fri, 18 Jan 2019 18:08:42 +0000 Received: from mail-qk1-x743.google.com ([2607:f8b0:4864:20::743]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gkYZL-0007ja-Oh for pgsql-bugs@lists.postgresql.org; Fri, 18 Jan 2019 18:08:42 +0000 Received: by mail-qk1-x743.google.com with SMTP id z18so8546608qkj.10 for ; Fri, 18 Jan 2019 10:08:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:mime-version:content-disposition :content-transfer-encoding:in-reply-to:user-agent; bh=TaIq70kfDT1UjKG01fXI4sBuTrI6uBj3akfNtjeP4oc=; b=1jyrHuH6lc9CKUBSDpc4dYifbVbORMBbmHGvCbEkkoUjijtaAArFFVqU3F6XsAYMfX 2o2IuqaWDdzz3meYO/D7p3mlsM+wrbFLtNolGHPCzdtBcdYVQfb/MU2j+t5pvf3tOK73 bVOr3bKK9ahrZJAIXX34sKHfGw6I+RIQshisK0hiX1KiFNGD5KoTBWgWnt7+GzkwZZtA qd/A33wLFWwa2RH+rnE8CdeRtZsXy6FCBjj2DvZWgKAYt8CGFXS7/XSxMZUC+z6A26D+ unwuFeYPKRsk2OhIR+aLY8vot8fuhOE5dDwxuBPYw4mLcsFQ8HVWhe0Zlr5xOHZRqJMI aWnA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=TaIq70kfDT1UjKG01fXI4sBuTrI6uBj3akfNtjeP4oc=; b=HbW3jT+Al+JREvm8FiFf2+uTszTMQtE3iykjijLZcR4bA9pD3XEE1hGvHc4xFba7/K zJ61WHSUJ86US0PpVC5ArN6mIgSYCQWu3B1LmvCWLtQUgx/QEquk7c3b4vJt0+ZWO6m+ gtNpzftKvuwOPdUUjDs3Eno1fGbymbF27UrUEPWX2zyKby5tZDBlHz+ZgD+02QDCjzcp d+j2hBrhy8qA5mFGPZM59TORkyTCrVlmfZt5TI/R8ykBxYKTpE3FYunj3Jhs5/2pNv1+ L2GRxxRh4Et0LblIDoGXNi4Y99y/bKZ4r8W/QrBbe517VAAW+iZWZYCNSEReN9IRXpZt xZew== X-Gm-Message-State: AJcUukdWuDMrUP1RDctLeYeU9eVXH0b3/3ffXUMj6u3rc/K9M8j2EtZZ vrE/7qpXPMkZ34qyfLYENs/A9Q== X-Google-Smtp-Source: ALg8bN4iYvFyrJR5EeLYaYdUruTQ+ZPcO2BSum/9kw57udmPTjRN80iaI8GloPWyeAo7zwI6x46NVA== X-Received: by 2002:a37:b306:: with SMTP id c6mr15590114qkf.265.1547834917831; Fri, 18 Jan 2019 10:08:37 -0800 (PST) Received: from alvin.alvh.no-ip.org ([190.121.29.3]) by smtp.gmail.com with ESMTPSA id d193sm71368210qka.91.2019.01.18.10.08.36 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 18 Jan 2019 10:08:36 -0800 (PST) Received: by alvin.alvh.no-ip.org (Postfix, from userid 1000) id CEB92978; Fri, 18 Jan 2019 15:08:33 -0300 (-03) Date: Fri, 18 Jan 2019 15:08:33 -0300 From: Alvaro Herrera To: Amit Langote Cc: Tom Lane , Jesper Pedersen , pgsql-bugs@lists.postgresql.org Subject: Re: BUG #15587: Partitions with ALTER TABLE ADD CONSTRAINT Message-ID: <201901181808.5srgir3zfzhc@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <201901172223.lm3iihkw7hn4@alvherre.pgsql> User-Agent: NeoMutt/20180716-1013-2c1e88 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 2019-Jan-17, Alvaro Herrera wrote: > Well, the whole point of my proposal is that the FK-creating code > recurses to partitions by calling ATAddForeignKeyConstraint, and IMO > that's the wrong level to recurse at; we should instead recurse by > calling clone_fk_constraints() as a whole. That's not readibly possible > with the current code arrangement because of layering, but after > backpatching (as attached) the two patches I mentioned, I end up with > the following, which I think is much cleaner. (Also, this code layout > plays much better with my project to continue to extend FKs so that they > are allowed to point to partitioned tables; see the other thread). > > The attached patches are for pg11; they don't apply to master. The > changes are uninteresting. Pushed this. -- Álvaro Herrera https://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services