Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1r4533-007Ga9-Jj for pgsql-hackers@arkaria.postgresql.org; Fri, 17 Nov 2023 20:02:41 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1r4532-00FcD7-4M for pgsql-hackers@arkaria.postgresql.org; Fri, 17 Nov 2023 20:02:40 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1r4531-00FcCz-NH for pgsql-hackers@lists.postgresql.org; Fri, 17 Nov 2023 20:02:39 +0000 Received: from mail-pl1-x631.google.com ([2607:f8b0:4864:20::631]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1r452y-006xAY-Rv for pgsql-hackers@postgresql.org; Fri, 17 Nov 2023 20:02:39 +0000 Received: by mail-pl1-x631.google.com with SMTP id d9443c01a7336-1cc5fa0e4d5so20535355ad.0 for ; Fri, 17 Nov 2023 12:02:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=j-davis-com.20230601.gappssmtp.com; s=20230601; t=1700251354; x=1700856154; darn=postgresql.org; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:to:from:subject:message-id:from:to:cc:subject:date :message-id:reply-to; bh=cbc38pCEfEEskFlI5wcj4fx4iAXrD89Fnp/zO4NG+A0=; b=VMrIl4ZeXLSvQFB7yX1ZXqts47Lu9Y1pv8VRnOAKy+cojdOEqsHcxkN7qsn4xNoVK/ aawNAD/WxHm7lR2Aq1d2Tmw55HyPQE54eEL9U/LeXbXDWeS5HSMPfnJZQ9xRNOxDIyxR n1mYHMG86cp5fT9LN93TBnbV25tSXrRFVVfoJqTlFQe3+Ue4tkwgrrDcs771IyGpQsvQ H7DqzFAcfJYDAHKU6Vkxv9NBw4Ys05sQj+v61t4Vq46HbjIgCRJNLEE/xJJfWpfvziAp SmQKbE2Rf3K2dXV3Tmepx2URSEQlgLO0+6/3yZa5ntQGYgOC6HnzdL9ZLVNOecn0KMAB st8A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700251354; x=1700856154; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:to:from:subject:message-id:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=cbc38pCEfEEskFlI5wcj4fx4iAXrD89Fnp/zO4NG+A0=; b=lqh7FLVr3B0kZSqzuY9UFg0ebRAbd+ip/qancqYL9RUqlLBULuPYeNA7+tCHTT0Yzi /yTbZlg746rCLU9Fgk3Ioe6ButhoprmeH1yzR9mRcq9KNH3PAkVNoenYRz7++1elejvQ tweZIIil0gZ0b3BJW3srNiqo3smYL4IUsqArEFCVjqyB8gTE9NV5wwuMWLQvULT7v1aY BMxJ2/td5uOGosHReRZUUkF2jAIVbi5UngGRh6y6KfnIsVjmwCgpDwO42PUitNCv39XB Zl2TcEK2SWjL3UfWneelR+sIFp2hWJLzZpIC30utze0zbNXtUFFCoY1e/VQSAXXIW/Ku iDGA== X-Gm-Message-State: AOJu0YwcLnmJD2qwwm0+608cVaT2d79kDIjwHW5XgEoZhpi7NAis3/8Z P8GiZvgZlafyn0vouJFl+8bnFWiX88xW19Df82U= X-Google-Smtp-Source: AGHT+IGdBRAwJPxJrYxq4ay1qXReqDVdzqj/czsISBZfM1CvMnzRF2qDomP1GdiKShR1BP5ZR2plMw== X-Received: by 2002:a17:903:1108:b0:1cc:3bd3:73d8 with SMTP id n8-20020a170903110800b001cc3bd373d8mr593024plh.59.1700251354665; Fri, 17 Nov 2023 12:02:34 -0800 (PST) Received: from [172.18.10.36] ([12.126.244.130]) by smtp.gmail.com with ESMTPSA id bv5-20020a17090af18500b00279163e52bbsm1749190pjb.17.2023.11.17.12.02.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Nov 2023 12:02:34 -0800 (PST) Message-ID: Subject: Re: should check collations when creating partitioned index From: Jeff Davis To: Peter Eisentraut , pgsql-hackers Date: Fri, 17 Nov 2023 12:02:33 -0800 In-Reply-To: <3327cb54-f7f1-413b-8fdb-7a9dceebb938@eisentraut.org> References: <3327cb54-f7f1-413b-8fdb-7a9dceebb938@eisentraut.org> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.44.4-0ubuntu2 MIME-Version: 1.0 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Mon, 2023-11-13 at 10:24 +0100, Peter Eisentraut wrote: > create table t1 (a int, b text) partition by hash (b); > create table t1a partition of t1 for values with (modulus 2, > remainder 0); > create table t1b partition of t1 for values with (modulus 2, > remainder 1); > create unique index i1 on t1 (b collate case_insensitive); > insert into t1 values (1, 'a'), (2, 'A');=C2=A0 -- this succeeds >=20 > The attached patch adds the required collation check.=C2=A0 In the > example,=20 > it would not allow the index i1 to be created. In the patch, you check for an exact collation match. Considering this case only depends on equality, I think it would be correct if the requirement was that (a) both collations are deterministic; or (b) the collations match exactly. This is related to the discussion here: https://postgr.es/m/b7a9f32eee8d24518f791168bc6fb653d1f95f4d.camel@j-davis.= com Regards, Jeff Davis