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 1heLn3-0006Z0-S7 for pgsql-bugs@arkaria.postgresql.org; Fri, 21 Jun 2019 15:49:25 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1heLn2-0004yk-IC for pgsql-bugs@arkaria.postgresql.org; Fri, 21 Jun 2019 15:49:24 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1heLn2-0004yd-7X for pgsql-bugs@lists.postgresql.org; Fri, 21 Jun 2019 15:49:24 +0000 Received: from mail-qt1-x843.google.com ([2607:f8b0:4864:20::843]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1heLmz-0004xB-EX for pgsql-bugs@lists.postgresql.org; Fri, 21 Jun 2019 15:49:22 +0000 Received: by mail-qt1-x843.google.com with SMTP id i34so7367754qta.6 for ; Fri, 21 Jun 2019 08:49:21 -0700 (PDT) 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=S2hlhuzPo0Cd1fUps/5OhuOJfmhZoderj0ynQqvTLkg=; b=FqW6roJXR6eCgeyGplApT7yTIUl//ZJ7aR2+J1poNEuNj+mPnwTjNztDRElYFuBQSm 4hlfwGbNR6/1/sdZczHZE5lxLNFre7GUHAULxlCcz3QALIp/dYRte4caX4xVIynmrs5+ klGyGI9mhghAzx88u5wU7zfCUg4DbDePMp66ricDQ2MjyNT9wERXYLgpZkqxkLA0TiFh cT9qLiNJXDCAlgqMo5YV8JOTl8tDhGG3Dx4b0NT/wTC7O5h+wKV1EKuyAkHeV8NUz2x3 +u4AKEGbhWDVUXVWHouyXAii8JWIAJZkFce9/gPqA0qTuEbZ7NQEd9B2tnjRyWoA2z2b IXeA== 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=S2hlhuzPo0Cd1fUps/5OhuOJfmhZoderj0ynQqvTLkg=; b=l+hmHbJqZO61S78YZUwH1ew+idEJBjwqQpUz7zcD13BM3vUV0Bn+TohmDcbKLqPOEl HeuXfmkvthUMt7F81Q/E15pQwD4mliN0UiW281gHXyNK1Qlk2jMqx4bPScHLdye+67cY 9PPz57tmirqBrpvCyA3e/XVj8NvvMODCMOta2rK+PFPCOdNeHUEFBiU31e/b95bWvYJn uMyI8k+G0rKsKyPpt/e80E3dKK7yooukQw/tL3h05upH1Gra/LGU8Kqpbp+AlH4NN9Fk 0XfQKhvR6jKf7eeOwU4Gh5JdaGBRoCFtwCiVIgjBUREPZ7PJtRWKe+RgAl/tYx+PiPRf 60sQ== X-Gm-Message-State: APjAAAWnu7LVP50jRV2oBIawn6vlCZytbsAbzcQK6hW+U/qLi8PKEj5t mSQYr3hG8TO9+zB4Tyje0Bed7g== X-Google-Smtp-Source: APXvYqxQPNMixzQsueOcNXRNzEXuyrjGczQ1UCcwQYvHS5OshxErRlE7U1GQn/tnOgTN0dq5QsY4dw== X-Received: by 2002:a0c:ada6:: with SMTP id w35mr29434823qvc.55.1561132160389; Fri, 21 Jun 2019 08:49:20 -0700 (PDT) Received: from nimloth.alvh.no-ip.org ([191.125.99.86]) by smtp.gmail.com with ESMTPSA id m5sm1484665qke.25.2019.06.21.08.49.19 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Fri, 21 Jun 2019 08:49:19 -0700 (PDT) Received: by nimloth.alvh.no-ip.org (Postfix, from userid 1000) id D6AEC120827; Fri, 21 Jun 2019 11:49:15 -0400 (-04) Date: Fri, 21 Jun 2019 11:49:15 -0400 From: Alvaro Herrera To: Pavan Deolasee Cc: stepya@ukr.net, pgsql-bugs@lists.postgresql.org Subject: Re: BUG #15724: Can't create foreign table as partition Message-ID: <20190621154915.GA17031@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 2019-Jun-21, Pavan Deolasee wrote: > On Thu, Jun 20, 2019 at 6:07 AM Alvaro Herrera > wrote: > > > With this patch, an index creation will no longer fail in the presence > > of a partition that is a foreign table, as long as the index is not a > > constraint index (not unique, not primary key). Conversely, > > creating/attaching a partition that is a foreign table does not fail if > > the partitioned table only has non-constraint indexes. > > Like others suggested above, I also think that we should make this is a > no-op on the foreign tables i.e. not fail even when there exists a UNIQUE > or PRIMARY KEY on the parent table. We simply assume that the appropriate > constraints will be defined on the foreign side and violations will be > caught. This is same as CHECK constraints on the foreign partitions, that > we assume the foreign server will enforce. I don't oppose making such a change in pg13, but it seems too much of a behavior change to be making even in pg12, let alone in the stable branches. Therefore, my proposal --in response to this bug report-- is to backpatch the previously proposed patch, which allows indexes to be created [on partitioned tables containing foreign tables as partitions], as long as they are not UNIQUE/PKs. If others want to explore the implications of UNIQUE/PK indexes on partitioned tables with foreign partitions, I won't stand in their way, though it doesn't seem material for this thread. -- Álvaro Herrera https://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services