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 1u1h8T-006Z1a-U9 for pgsql-general@arkaria.postgresql.org; Mon, 07 Apr 2025 07:43:14 +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 1u1h8R-00DAa8-DG for pgsql-general@arkaria.postgresql.org; Mon, 07 Apr 2025 07:43:11 +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 1u10rJ-00BvIO-MK for pgsql-general@lists.postgresql.org; Sat, 05 Apr 2025 10:34:42 +0000 Received: from fout-a2-smtp.messagingengine.com ([103.168.172.145]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1u10rH-0035gu-1V for pgsql-general@postgresql.org; Sat, 05 Apr 2025 10:34:40 +0000 Received: from phl-compute-08.internal (phl-compute-08.phl.internal [10.202.2.48]) by mailfout.phl.internal (Postfix) with ESMTP id 19E6F13801DE for ; Sat, 5 Apr 2025 06:34:38 -0400 (EDT) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-08.internal (MEProxy); Sat, 05 Apr 2025 06:34:38 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=flapplabs.se; h= cc:content-type:content-type:date:date:from:from:in-reply-to :message-id:mime-version:reply-to:subject:subject:to:to; s=fm2; t=1743849278; x=1743935678; bh=g74oQfEgpFO9lzvsVSgR3mUSt2Hl2mTG E8aD/LPbYfA=; b=U8Tj4mj7WpszW1VzfjkIKyVIDqb1gCs4aSDGkfUsGxd2RAvC LJzr4y+SZIOVRUjcXNnuZdumneKa2R6UdE2pOSULEs1bHM1xdJV0RB76a637LB83 OT5uCCD38WuR5123nJgRBKuCVQD7ylXFsoYnFchtOR55QFd3+p0q6iJIb2VjTSBQ +Geghs7Ytfx3BSvFzh3uhdbV0ixdPZsmpr0wPFYVa8L+TTtUMV1b/P282bmLfuUG yd268ps9ZAM2nCu3+IIKJ86u0QofsEWOPr427kqAJcT4Fj6+keZ/NL5uoMrYXY+K iziLXlZxINyHQBCd/heZ2fTXq0C4CyNwLVPjOA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:message-id :mime-version:reply-to:subject:subject:to:to:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t=1743849278; x= 1743935678; bh=g74oQfEgpFO9lzvsVSgR3mUSt2Hl2mTGE8aD/LPbYfA=; b=F QnOeAq+GLJUxhk5daP+4ObjJhqCCM7NDfiq+x+EfGlx0Xho7AKBWE8TZY1OnBOv+ q3WrwIVPhMdT2jKeNMWifyWyAEbm0e9QTjEKD92hynjPzTzp5YuImxIWRfw5VbPv vDZC0mz7XQYB+U7Wcs9X6WVvo5o2Jwxta0XrCG+07f/vKGxjwC8NXnfGZjkISZBL 1gPBE991e2/e+7HT7O0v6F73j5SJgkrJ52nh8IDyVrE+J1YyIV7EX5kvnegbcff2 lKr6e6GS4CoxHI77X+3TFsz0q9pd6W2CWgCa4zwMlKYQKYoxgST8Z0o5ms/YRpeR 5pS/kb5AFkIMAVHJWMCPw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgdduleeguddvucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggv pdfurfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucenucfjughrpefhtg gguffkfffvofesrgdtmherhhdtjeenucfhrhhomhephfgrsghirghnucfnihhnughfohhr shcuoehfrggsihgrnhesfhhlrghpphhlrggsshdrshgvqeenucggtffrrghtthgvrhhnpe eitdefieegleehffeijedtffdvfedttdetueejudethefgffejkefgveevhefgleenucff ohhmrghinhepghhithhhuhgsrdgtohhmnecuvehluhhsthgvrhfuihiivgeptdenucfrrg hrrghmpehmrghilhhfrhhomhepfhgrsghirghnsehflhgrphhplhgrsghsrdhsvgdpnhgs pghrtghpthhtohepuddpmhhouggvpehsmhhtphhouhhtpdhrtghpthhtohepphhgshhqlh dqghgvnhgvrhgrlhesphhoshhtghhrvghsqhhlrdhorhhg X-ME-Proxy: Feedback-ID: i2be9440c:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA for ; Sat, 5 Apr 2025 06:34:37 -0400 (EDT) From: Fabian Lindfors Content-Type: multipart/alternative; boundary="Apple-Mail=_A2CDF16B-824F-46CE-B27C-5FE3A432C7B6" Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3776.700.51.11.1\)) Subject: Custom index access method for primary keys Message-Id: <872B0CA7-4483-4FC2-8CD8-0A5C08FC0942@flapplabs.se> Date: Sat, 5 Apr 2025 12:34:24 +0200 To: pgsql-general@postgresql.org X-Mailer: Apple Mail (2.3776.700.51.11.1) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --Apple-Mail=_A2CDF16B-824F-46CE-B27C-5FE3A432C7B6 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 Hi! I=E2=80=99m working on an index access method that I intend to be = generic and to replace btree for my specific use case. I noticed though = that it doesn=E2=80=99t seem to be possible to specify an access method = when creating a new table and using PRIMARY KEY. Same applies to altering a table to add a primary key using an existing = index with a non-btree access method. That hits this check and errors: = https://github.com/postgres/postgres/blob/4be6a74cfb1ef4c50740e4c2f97a3b47= 8c16de73/src/backend/parser/parse_utilcmd.c#L2480 Wanted to ask if this an intentional limitation and if there is a reason = why an index access method (if it supports uniqueness) would not be = usable for a primary key?= --Apple-Mail=_A2CDF16B-824F-46CE-B27C-5FE3A432C7B6 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8 Hi! I=E2=80=99m = working on an index access method that I intend to be generic and to = replace btree for my specific use case. I noticed though that it = doesn=E2=80=99t seem to be possible to specify an access method when = creating a new table and using PRIMARY KEY.

Same = applies to altering a table to add a primary key using an existing index = with a non-btree access method. That hits this check and errors: https://github.= com/postgres/postgres/blob/4be6a74cfb1ef4c50740e4c2f97a3b478c16de73/src/ba= ckend/parser/parse_utilcmd.c#L2480

Wanted = to ask if this an intentional limitation and if there is a reason why an = index access method (if it supports uniqueness) would not be usable for = a primary key?
= --Apple-Mail=_A2CDF16B-824F-46CE-B27C-5FE3A432C7B6--