Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ef8xI-0005ND-Ho for pgsql-hackers@arkaria.postgresql.org; Fri, 26 Jan 2018 18:42:28 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ef8xI-0005A3-4j for pgsql-hackers@arkaria.postgresql.org; Fri, 26 Jan 2018 18:42:28 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1ef8xH-00059t-EH for pgsql-hackers@lists.postgresql.org; Fri, 26 Jan 2018 18:42:27 +0000 Received: from out3-smtp.messagingengine.com ([66.111.4.27]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1ef8xA-0006rj-D7 for pgsql-hackers@postgresql.org; Fri, 26 Jan 2018 18:42:26 +0000 Received: from compute7.internal (compute7.nyi.internal [10.202.2.47]) by mailout.nyi.internal (Postfix) with ESMTP id E05A6211F4; Fri, 26 Jan 2018 13:42:18 -0500 (EST) Received: from frontend2 ([10.202.2.161]) by compute7.internal (MEProxy); Fri, 26 Jan 2018 13:42:18 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; bh=HEiw4a FeDyUcH1mV9G4Nc/THOpfnbln42BndmgeQ5Ho=; b=cQ50xe1fMt1JxBP2pMJwVZ UzKZNZYvVQtldvFRG58T3DiljNT3Hf7dgBPlD/tj8reLK3owvwFu2sWC7RaKX1vl HuJSI/Kj9EtmoE0/b1qSTJagArzrhJCKz8t25Q3YXzIamGynmN4EHuv1nLeejeBg 8XNyVkgaVKoeTtGPzRw3bT8c7c+ZixLBP8OdMmk0+PyAzuEFd3EFXvTGyxQXKkcf MPZdWxan/wOoxn8X1vYmiOArszJvEuziNtL2f1iNtlEK8Wj22RANwj6phNVB7r7x fDQU3VQNAg6Sep2YWpOuVi52jXg4pdRp5z0ITPWjMH/b4w1OodXhrSF+85y8n4eA == X-ME-Sender: Received: from april.local (c-73-13-66-39.hsd1.pa.comcast.net [73.13.66.39]) by mail.messagingengine.com (Postfix) with ESMTPA id A18B3241E0; Fri, 26 Jan 2018 13:42:18 -0500 (EST) Subject: Re: unique indexes on partitioned tables To: Alvaro Herrera , Pg Hackers References: <20180122225559.7pbzomvgp5iwmath@alvherre.pgsql> From: Peter Eisentraut Organization: 2ndQuadrant Message-ID: Date: Fri, 26 Jan 2018 13:42:17 -0500 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 MIME-Version: 1.0 In-Reply-To: <20180122225559.7pbzomvgp5iwmath@alvherre.pgsql> Content-Type: text/plain; charset=windows-1252 Content-Language: en-US Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 1/22/18 17:55, Alvaro Herrera wrote: > Alvaro Herrera wrote: >> Version 4 of this patch, rebased on today's master. + if (key->partattrs[i] == 0) + ereport(ERROR, + (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), + errmsg("unsupported %s constraint with partition key definition", + constraint_type), + errmsg("%s constraints cannot be used when partition keys include expressions.", + constraint_type))); Double errmsg(). (Maybe an Assert somewhere should help catch this?) +alter table idxpart add primary key (a); -- not an incomplete one tho "though"? I would like to see some tests that the unique constraints are actually enforced. That is, insert some duplicate values and see it fail. Throw some null values in, to check PK behavior as well. It should be trivial, but seems kind of useful. Other than that, this looks pretty good to me. A logical extension of the previous partitioned index patch. -- Peter Eisentraut http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services