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.96) (envelope-from ) id 1w2YGs-000OKE-2Y for pgsql-hackers@arkaria.postgresql.org; Tue, 17 Mar 2026 17:31:58 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1w2YGr-003csI-26 for pgsql-hackers@arkaria.postgresql.org; Tue, 17 Mar 2026 17:31:57 +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.96) (envelope-from ) id 1w2YGr-003csA-1E for pgsql-hackers@lists.postgresql.org; Tue, 17 Mar 2026 17:31:57 +0000 Received: from mail-oo1-xc2b.google.com ([2607:f8b0:4864:20::c2b]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1w2YGo-00000000dsy-4A6D for pgsql-hackers@lists.postgresql.org; Tue, 17 Mar 2026 17:31:57 +0000 Received: by mail-oo1-xc2b.google.com with SMTP id 006d021491bc7-67bad873c3eso3778562eaf.3 for ; Tue, 17 Mar 2026 10:31:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1773768713; x=1774373513; darn=lists.postgresql.org; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:from:to :cc:subject:date:message-id:reply-to; bh=zSlF777xNsSPD/fWUxAcVY1ni96i5ZRYq5V8J3wLQYM=; b=j3uoKUUleQAhRusI00oDmfDB1PI9pzWk+anjAICC0SukYBH1wtdSYHjfl77dbOXia3 SDmalXls5k6X8UbsCzvkJf3D5xlLaHB5gEIcNpsSxEfG8N5/gmsGFeVoLq/446l2xln2 kTJzjGmX6UgUuD30JeFN2oRmK0J2CZk/9tCZl1zCNC3SVw0TfLsPAnKr+BuEHud87Fm4 il6Rx+gCxBci6/g1zZ7B5gLEdUBGYVel01JlaeLzxvSBWHvm6TzwXNon2ZU1ExkGCAks T2/v8Fz6F5C4tNvMZox1EFuV2Alg9WTIr3FB+d1KlqE51MY2Pt/FTutizGWCiWu5qy4B Zaig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1773768713; x=1774373513; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=zSlF777xNsSPD/fWUxAcVY1ni96i5ZRYq5V8J3wLQYM=; b=cenlTVDfzU9OwPytf/dHW8lhYPfRJkny3I4DnzazWncMPQxwm4q7vAsSqD7BQfPCLt SETK7Rgbpvq2w+v6cmpzhC3dWpzD6pDlGdTX67SmP6HyxolzOzMN57WB7pDz9sexXkXg aLr7sjzP4rhUlYfTAmCafnGVOUX3orFLiaiBtDbv3FJdRzZ9sg9eBMSB54HxH+tvXWAD 4niq85t+uxFe0/k/w/9/TlAZWFn5piVDhgYU5SxUygGm/V6fmBQz8kwte2/14daAgWbo 4rBTh9UB0jn2pJ50tI5EL1HsgA/Iz+gbDUmRaNJKeD13LzyOl9O/uBWr+FdvDJJuae/3 tN5A== X-Gm-Message-State: AOJu0YztVvCtnRKC2kPMw9ZccnAp8chLBckt094kR0hTqOd8qVHYz0/4 ItGgRj9E/GcNGdwR6rQ4B5hcoAuS2MkwuDg4yZUk/OXwSgWwjeSWMlPm5vGqPg== X-Gm-Gg: ATEYQzyzlm21ehJWP4jAZ9SaVrfzbKmUO3YFZdAyeAEHowfBymFx64pkMuI7m9/c9oa Qn2O/cyUV2f7my4nVEEp1QgHYK7Yr8XIRVbkdP7UZ/nyfW/hstxtklaGrVcERZJMYWZd3Pfz4J2 U82aC2lEx+vAGlYAvGh3XkWQvC6EpCVhc7UQz8CsilD9RvZLXZbT4piiQsi7QgRl6YByLodwuaH JMdPsW7/fJ5+CM7SYVcIMz9B6wz7sDb/NsHno6Ndxn6ODZ+l086ZIPRyb4E1b9RBmhlPT8IDXWT XRbMVWRYAO3T008YS4aCEC+dwgH7GqI1NHSTPIOhnEDAUevGJ6ptBbnapIg6eKbpKCF3m0/4v0I PO3zJ1ayyR5aGs+3mLi+fD01D2NsdZUfFSVWleDAehwwz/fOPRrQdY4uoroWSdK31VeNNWGwu88 wCz+sN/6EdhBayfbarTJnFcgTY6eRIcujeQokjc4s4aMhkJqX8rP/V2IxWjYivRswug38/EQUCJ fTY9Uql5435xbOOTKMlkW40A0nifwAL X-Received: by 2002:a05:6820:440b:b0:67b:f13c:3fd2 with SMTP id 006d021491bc7-67c0db2952cmr60027eaf.62.1773768713126; Tue, 17 Mar 2026 10:31:53 -0700 (PDT) Received: from nathan (162-195-168-172.lightspeed.stlsmo.sbcglobal.net. [162.195.168.172]) by smtp.gmail.com with ESMTPSA id 586e51a60fabf-41bd288c5e3sm287192fac.8.2026.03.17.10.31.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Mar 2026 10:31:52 -0700 (PDT) Date: Tue, 17 Mar 2026 12:31:51 -0500 From: Nathan Bossart To: =?utf-8?Q?=C3=81lvaro?= Herrera Cc: Pg Hackers Subject: Re: table AM option passing Message-ID: References: <202603171606.kf6pmhscqbqz@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <202603171606.kf6pmhscqbqz@alvherre.pgsql> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Tue, Mar 17, 2026 at 05:50:41PM +0100, Álvaro Herrera wrote: > We could solve this easily by adding one more boolean to each, but I > think this is a good time to instead consolidate the API by using a > bitmask; this also allows us not to have changingPart in the wrong place > of the heap_delete API. > > So here's a patch to do that, which shouldn't change any behavior. Seems entirely reasonable to me. I read through the patch and nothing stood out. > (This change is vaguely similar to b7271aa1d71a, except I used 'int' > instead of 'bits32', to keep the interface consistent with the existing > heap_insert() one. Maybe I should make all three take bits64 instead? > We don't actually have that type at present, so I'd have to add that > too.) Why bits64 and not bits32? I must be missing something. > While at it, I noticed that the table_insert() and heap_insert() uses > one set of value definitions for each half of the interface; that is, in > tableam.h we have > > /* "options" flag bits for table_tuple_insert */ > /* TABLE_INSERT_SKIP_WAL was 0x0001; RelationNeedsWAL() now governs */ > #define TABLE_INSERT_SKIP_FSM 0x0002 > #define TABLE_INSERT_FROZEN 0x0004 > #define TABLE_INSERT_NO_LOGICAL 0x0008 > > and in heapam.h we have > /* "options" flag bits for heap_insert */ > #define HEAP_INSERT_SKIP_FSM TABLE_INSERT_SKIP_FSM > #define HEAP_INSERT_FROZEN TABLE_INSERT_FROZEN > #define HEAP_INSERT_NO_LOGICAL TABLE_INSERT_NO_LOGICAL > #define HEAP_INSERT_SPECULATIVE 0x0010 > > This seems rather odd to me -- how could heapam.c have a different set > of behaviors than what table AM uses? I find it even more weird that > HEAP_INSERT_SPECULATIVE is defined so that as soon as some future patch > defines the next "free" tableam.h flag value to do something new, we'll > have a conflict. I think this would be cleaner if we removed from > heapam.h the flags that correspond to anything in tableam.h, and use > heapam.c and all its direct callers use the tableam.h flag definitions > instead; and perhaps move HEAP_INSERT_SPECULATIVE to be at the other end > of the bitmask (0x1000) -- maybe simply say in tableam.h that the first > byte of the options int is reserved for internal use. Probably a good idea. -- nathan