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 1suPFr-006Trq-Qq for pgsql-in-general@arkaria.postgresql.org; Sat, 28 Sep 2024 04:40:28 +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 1suPEs-002LMe-P3 for pgsql-in-general@arkaria.postgresql.org; Sat, 28 Sep 2024 04:39:26 +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 1suPEs-002LMV-Hr for pgsql-in-general@lists.postgresql.org; Sat, 28 Sep 2024 04:39:26 +0000 Received: from mail-oo1-xc2c.google.com ([2607:f8b0:4864:20::c2c]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1suPEo-001Sih-Oz for pgsql-in-general@postgresql.org; Sat, 28 Sep 2024 04:39:25 +0000 Received: by mail-oo1-xc2c.google.com with SMTP id 006d021491bc7-5e1b5b617b8so1339175eaf.0 for ; Fri, 27 Sep 2024 21:39:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1727498362; x=1728103162; darn=postgresql.org; h=cc:to:subject:message-id:date:from:references:in-reply-to :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=T0kV/iApm0WjKgkOwGljmaHGy469IF0F8kPOC8LEIdo=; b=dLHWJYmiJgCYrxl6Ovcq2f+WzHuyIYoTffgaH6xoFO8RqzYvKgIc/pBM7voLuAF6py lT+fn2SL0G2/1wll7kxMr7xWyyZV9jggZVGTgM5rTfm0aaIdB3fIa0Hju7a45g7j84LK VZ6Pp54flMm8OqhB0jh3ZcVkYA/cBeM22mD1iiOBcvuXa6RjAnw0/8usAnts+E0DDa0p FwptWRBL8aHBCPavRu7jYAFRupfGDIbHtYUedyuhikqzQaq5aZWVA0JFLtum8Av0pmpf poVuVLo4jomPJdz4jqCH6lYIf4oa1Nb9QEQJx8cSlAcvRnFgeH9+SHotdxZgU6sGPCY1 Jp3Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727498362; x=1728103162; h=cc:to:subject:message-id:date:from:references:in-reply-to :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=T0kV/iApm0WjKgkOwGljmaHGy469IF0F8kPOC8LEIdo=; b=GU+mGQ2miNYXEqP/1gyk3NsAJmZacFTMDuXwp4KBFd3j/Y55FwnSNcemmMK1f+XWfb ayPTusKmqvMUEIs4ubZ427b46Z4ljs96PTv1d6LptqIC2iFhlgpTk5u4WJE/Ty15uLsr Y4uZs+X/mgb9gTp+96WnyJ/eRRqlHJxXQrn+ErT0aGukmuj6IsFJ7oh/+CYq9SndVxpu Cz6mTiWdhOl2c7F0HEWGzynVWblgF30XxsABsqcaB+5xSUMLMjf0TQSW0EPG//O5Lg3a 26sfBiGpJyeldGKCBB8MkOfN4EqnZ5HgZYtzFEa7abJekXCTWgoclZA98iTPbNq49C5X N4zg== X-Forwarded-Encrypted: i=1; AJvYcCU/DNF3WEnZWdRpNwX8yIcGeWJ//nzDWZ/Yr3ZxQiAxakTAincBDy3dY6zCBa7/WgVlVJcvh+Jf1WM55idiP/ex@postgresql.org X-Gm-Message-State: AOJu0YxAvvMhedlbjPA08KcRNOGPLWJYqgwWHxDvnTVCKVtIdjFhJqFo /osV5/Ziqg8hXRb/pf7N3cmBzjxyNvaKgHaoDYkx1yp5FaiFoKd+f6zeViINUhRJ4gjyMx1V+Sl 7MBoGy9Q+0IaVnrgs3jTqZ0TwClg= X-Google-Smtp-Source: AGHT+IGRvHrBXXxvM/oFVzD1B4hhStbyLU6XmgmVyfc4vs/r2ibLDtXbdqobuR4f3NK4xK1lTyZr0uSG/V6YQ+PGdQg= X-Received: by 2002:a4a:db5e:0:b0:5e5:b8c2:40b4 with SMTP id 006d021491bc7-5e5d473607fmr4476131eaf.4.1727498362308; Fri, 27 Sep 2024 21:39:22 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a05:6802:a13:b0:557:c384:fb61 with HTTP; Fri, 27 Sep 2024 21:39:21 -0700 (PDT) In-Reply-To: References: From: "David G. Johnston" Date: Fri, 27 Sep 2024 21:39:21 -0700 Message-ID: Subject: Re: Regarding use of single column as primary key on partitioned table To: Durgamahesh Manne Cc: "pgsql-general@lists.postgresql.org" , "pgsql-in-general@postgresql.org" Content-Type: multipart/alternative; boundary="0000000000003c50720623268e68" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --0000000000003c50720623268e68 Content-Type: text/plain; charset="UTF-8" On Friday, September 27, 2024, Durgamahesh Manne wrote: > > ERROR: unique constraint on partitioned table must include all > partitioning columns > DETAIL: PRIMARY KEY constraint on table "bet" lacks column "placedon" > which is part of the partition key. > test=> > > Can't we use primary key on singal column(betid) on partitioned table > rather than using composite key (placedon,betid)? > No. It would be misleading to allow such a thing because a unique index can only span a single partition. David J. --0000000000003c50720623268e68 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Friday, September 27, 2024, Durgamahesh Manne <maheshpostgres9@gmail.com> wrote:

ERROR: =C2=A0unique constr= aint on partitioned table must include all partitioning columns
DETAIL: = =C2=A0PRIMARY KEY constraint on table "bet" lacks column "pl= acedon" which is part of the partition key.
test=3D>

Can't we use primary key on singal column(betid) on p= artitioned table rather than using composite key (placedon,betid)?

No.=C2=A0 It would be misleading to all= ow such a thing because a unique index can only span a single partition.

David J.

--0000000000003c50720623268e68--