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 1t3pkB-00Ev6h-6I for pgsql-hackers@arkaria.postgresql.org; Thu, 24 Oct 2024 04:46:43 +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 1t3pk8-00GqHW-Q3 for pgsql-hackers@arkaria.postgresql.org; Thu, 24 Oct 2024 04:46:41 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1t3pk8-00GqHG-Ft for pgsql-hackers@lists.postgresql.org; Thu, 24 Oct 2024 04:46:40 +0000 Received: from mail-wr1-x435.google.com ([2a00:1450:4864:20::435]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1t3pk6-002YsO-Bo for pgsql-hackers@lists.postgresql.org; Thu, 24 Oct 2024 04:46:39 +0000 Received: by mail-wr1-x435.google.com with SMTP id ffacd0b85a97d-37d495d217bso371314f8f.0 for ; Wed, 23 Oct 2024 21:46:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1729745195; x=1730349995; darn=lists.postgresql.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=1ha9I1pQ109QYWV9Izdowf2boEM+FCro7gm0hJSH6wU=; b=PZImjto+L3yWeU7yL+sIpgC354E8LyXJDumkTbT6EkjO8Gr9q/gPr40WFSU+cnA9vs j9N8Pvlq4Kivkhk4uhijyU/WjCApG2hwGbQ6fYyF31UmrxCUPHUiQSnzZjWZLlK0pPS1 7iHrjrhKcYXVHn0d0zpvQfxil8+NnIyiZdqelGHWYjRQpSykzSE0qQbzJ5aybvvjoKmb ln3p5uEsTPHx1BehN6mcqD9oXvRijO5I5tih76LiLW73ibO15EMzFUmKSQ5cOJGZxY8E hIQ3CJ8NVLQ0DA5aT9CX05N+MXZd6oEPtNC6prVWRTobIyXLcs1xVO48rMwulvmJxjdN GHcQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729745195; x=1730349995; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=1ha9I1pQ109QYWV9Izdowf2boEM+FCro7gm0hJSH6wU=; b=daINY+sFFidv3DTQSxMndKNy0Ie8Ll9ZDK/MQYE9u79VgKb5xEt5d3cXp5Fya5A0+/ 7meC6a0jdW4UpwWYCXLA7tvLCeRsZhIoArtbkFVxMyIBu5KAXYgi8iwfdQPrtFCwv/dv is7ywraEj4bil6C12ScvIy+7O9riSdB/0426eFXX89bnIF6pLfRTnud9pYKB686mFgBO CDTDiq09dSvH/3oFp/0vlFkGnolEKQnGfTxr8XrE8zQsmpYTuDVmyQraMHNYrc4CtWwK BNC9AUpIJufxMB0AWnfKybFAQPvKwB/5Ba6FXL39Z7id7ul3mL7ouUu6vsOBwnL/d7oo hCfA== X-Gm-Message-State: AOJu0YySO0E46v7cgc/8AGjaneJJkOW6G8W1Z87rpvg1kkkWRhCfwwFM EwDNrwYwj1X+amI3UJwx/uo+GUNxz+oIh87Gq6Qf40Q517f7Erc8E9EkxoVnrtZz8gBJAmJvSCI BaFCgF12NVU/ZhY6vb+bIksK8CTtdg77Y X-Google-Smtp-Source: AGHT+IGNybxE0MXDtCWtyVWpdwwJzx/7R/G0vS7VEnzPchkmbtwmBtr2FeMAbKY1NC0cZifHPd+4UvxFQCNgpA5B8Ms= X-Received: by 2002:adf:e0d1:0:b0:37d:4cd6:e8e with SMTP id ffacd0b85a97d-37efcf8c18bmr3922721f8f.48.1729745195473; Wed, 23 Oct 2024 21:46:35 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Tender Wang Date: Thu, 24 Oct 2024 12:46:23 +0800 Message-ID: Subject: Re: Wrong result when enable_partitionwise_join is on if collation of PartitionKey and Column is different. To: PostgreSQL Hackers Cc: Amit Langote Content-Type: multipart/alternative; boundary="000000000000eda422062531afd4" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --000000000000eda422062531afd4 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Tender Wang =E4=BA=8E2024=E5=B9=B410=E6=9C=8823=E6=97= =A5=E5=91=A8=E4=B8=89 21:48=E5=86=99=E9=81=93=EF=BC=9A > Hi all, > > I find another issue as $SUBJECT when I work on [1]. > When I continue to work on this, I find below issue. But I'm not sure whether it is a bug. postgres=3D# create table part_index(a text primary key) partition by list = ( a collate "POSIX"); ERROR: unique constraint on partitioned table must include all partitioning columns DETAIL: PRIMARY KEY constraint on table "part_index" lacks column "a" which is part of the partition key. postgres=3D# create table part_index(a text) partition by list ( a collate "POSIX"); CREATE TABLE postgres=3D# alter table part_index add primary key (a); ERROR: unique constraint on partitioned table must include all partitioning columns DETAIL: PRIMARY KEY constraint on table "part_index" lacks column "a" which is part of the partition key. It seems we can't create a primary key if the collation is different between columnDef and PartitionKey. By the way, I think the error message is misleading to users. ostgres=3D# alter table part_index add primary key (a); ERROR: unique constraint on partitioned table must include all partitioning columns DETAIL: PRIMARY KEY constraint on table "part_index" lacks column "a" which is part of the partition key. --=20 Thanks, Tender Wang --000000000000eda422062531afd4 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


=
Tender Wang <tndrwang@gmail.com> =E4=BA=8E2024=E5=B9=B410=E6=9C= =8823=E6=97=A5=E5=91=A8=E4=B8=89 21:48=E5=86=99=E9=81=93=EF=BC=9A
=
Hi all,

I find another issue as $SUB= JECT when I work on [1].

= When I continue to work on this, I find below issue. But I'm not sure w= hether it is a bug.

postgres=3D# create table part_inde= x(a text primary key) partition by list ( a collate "POSIX");
= ERROR: =C2=A0unique constraint on partitioned table must include all partit= ioning columns
DETAIL: =C2=A0PRIMARY KEY constraint on table "part_= index" lacks column "a" which is part of the partition key.<= /div>
postgres=3D# create table part_index(a text= ) partition by list ( a collate "POSIX");
CREATE TABLE
post= gres=3D# alter table part_index add primary key (a);
ERROR: =C2=A0unique= constraint on partitioned table must include all partitioning columns
<= div>DETAIL: =C2=A0PRIMARY KEY constraint on table "part_index" la= cks column "a" which is part of the partition key.

=
It seems we can't create a primary key if the collation is d= ifferent between columnDef and PartitionKey.

B= y the way, I think the error message is misleading to users.
ostg= res=3D# alter table part_index add primary key (a);
ERROR: =C2=A0unique = constraint on partitioned table must include all partitioning columns
DETAIL: =C2=A0PRIMARY KEY constraint on table "part_index" lac= ks column "a" which is part of the partition key.



--
Thanks,
Tender Wang
--000000000000eda422062531afd4--