Received: from malur.postgresql.org ([2a02:16a8:dc51::56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fIHHu-0001qg-T9 for pgsql-hackers@arkaria.postgresql.org; Mon, 14 May 2018 17:29:31 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fIHHs-0004Cp-Sm for pgsql-hackers@arkaria.postgresql.org; Mon, 14 May 2018 17:29:28 +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 1fIHHs-0004Cf-G4 for pgsql-hackers@lists.postgresql.org; Mon, 14 May 2018 17:29:28 +0000 Received: from mail-qt0-x243.google.com ([2607:f8b0:400d:c0d::243]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1fIHHe-0000Xb-3H for pgsql-hackers@lists.postgresql.org; Mon, 14 May 2018 17:29:27 +0000 Received: by mail-qt0-x243.google.com with SMTP id h2-v6so17185686qtp.7 for ; Mon, 14 May 2018 10:29:13 -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=mZW7p+Ez8an6eMV16uYGZITWxA9SAalaTX6wxeBlXl0=; b=0/jKDocehpKylBPEfwOXdtn9N/8JPvCez4eLpayGNyym9DcYO2ohgVdCCuczZ1jn5m qN2W8eKrfU3lLNyRGrnuf8BD96HRugSAt39W5QLL4476PjpDv9OmsuGFI/755p6HlqBR pbbfJaBo812EifFe0ErxyU6tUI78TMs4jRYLqjPMOIAO/mwq8NSdkxzUwEOpMgXo3N+f s4eMiVewE/zsaSEQUm0BRexlhvWAl77X2CvEBbdVB9kO8UlsFnLLn5cZvPkwNG5xIEco cooYPwvd9UBhqPYZH5PyswXW5P35WYPJoL4/wNfODAYavMfvWF5ZOEr0L1lemQD14K48 H30g== 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=mZW7p+Ez8an6eMV16uYGZITWxA9SAalaTX6wxeBlXl0=; b=Qb68kxLn+PwblS32ESXZ6LuOspm48XRx7vf8NQGKkc2bjanRQF3c7LeJWh+knBZirP tBgNdXkoA9jwgScSZVVCi9L3/Fl6eIuwFY0dOY7Gtw4/pTJDjcHMiktLpAOIVn1hHAMx cz8i9Gwe/u+9NgUcWmJhHvZlTCWPkhapbaXUDC9LPRFSAwVH6NAP57eyt+y1biM4bL4v x2Otx2z9iJ4uvllKBEAKsR0WOo4IxUf91sh8JLIgMf0V8f8mczVVdvhR7Gei2jFoLjbG RR5t+5REzgfvRPfaPltCxKl8E968VIQBxr6uFN/xjG9uDKg/2SrZ6haZFEDQQ5ylViYL kgFA== X-Gm-Message-State: ALKqPwdokfMxgVQcTtNw/cOI7494WAx1CrVrvvaMDxhs5Awv6cqJ3Ng1 brj9IqN699pg5jhBKoSezS4CWg== X-Google-Smtp-Source: AB8JxZr9GaPnByAFYELmx6dCsWL6/tAxBuUpdduw7KdAkC/dsz1FlGw+7FblcweIjNuGlw1O8LlZKw== X-Received: by 2002:a0c:d842:: with SMTP id i2-v6mr9786288qvj.50.1526318952350; Mon, 14 May 2018 10:29:12 -0700 (PDT) Received: from alvin.alvh.no-ip.org ([179.57.112.31]) by smtp.gmail.com with ESMTPSA id w70-v6sm8506377qkg.13.2018.05.14.10.29.11 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 14 May 2018 10:29:11 -0700 (PDT) Received: by alvin.alvh.no-ip.org (Postfix, from userid 1000) id 457FF842; Mon, 14 May 2018 13:29:10 -0400 (-04) Date: Mon, 14 May 2018 13:29:10 -0400 From: Alvaro Herrera To: Amit Langote Cc: Michael Paquier , Tom Lane , Robert Haas , Simon Riggs , Arseny Sher , "pgsql-hackers@lists.postgresql.org" Subject: Re: Indexes on partitioned tables and foreign partitions Message-ID: <20180514172910.wjuvrtcdhcc5y3u7@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <211ee61d-f91a-9cbd-7b9b-6cd81cb8d08d@lab.ntt.co.jp> User-Agent: NeoMutt/20170306-137-4415bd-dirty (1.8.0) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 2018-May-10, Amit Langote wrote: > How about we error out even *before* calling DefineIndex for the 1st time? > I see that ProcessUtilitySlow() gets a list of all partitions when > locking them for index creation before calling DefineIndex. Maybe, just > go through the list and error out if one of them is a partition that we > don't support creating an index on? The overwhelming consensus seems to be for this option, so I pushed your patch after some small tweaks -- mostly to simplify unnecessarily baroque code. (I must have been thinking that recursion would happen right in ProcessUtilitySlow. That doesn't match my memories, but I can't explain this code otherwise.) I added a very small test too. I think it'd be better to take this out of ProcessUtility also and into DefineInde, for cleanliness sake; maybe add a 'recursing' flag to DefineIndex. Not for pg11, though. -- Álvaro Herrera https://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services