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 1tGKRr-002HKA-9D for pgsql-hackers@arkaria.postgresql.org; Wed, 27 Nov 2024 15:59:27 +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 1tGKRp-00GJXy-L8 for pgsql-hackers@arkaria.postgresql.org; Wed, 27 Nov 2024 15:59:25 +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 1tGKRp-00GJXq-BJ for pgsql-hackers@lists.postgresql.org; Wed, 27 Nov 2024 15:59:25 +0000 Received: from mail-qt1-x833.google.com ([2607:f8b0:4864:20::833]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1tGKRn-004LpN-2L for pgsql-hackers@lists.postgresql.org; Wed, 27 Nov 2024 15:59:24 +0000 Received: by mail-qt1-x833.google.com with SMTP id d75a77b69052e-46375ac25fbso50627421cf.0 for ; Wed, 27 Nov 2024 07:59:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1732723161; x=1733327961; darn=lists.postgresql.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=6IuxLTLc3V8mNACY7mLpeeZZOZ1blGle+1mRqzVR3yM=; b=LC/23PiTP4iPwsQR0ev/cAzo+3pTed8nouss2lV2E/dSLqQPvoHSu2j3TEDgHks52s ih6al7pMGWOmxeZgC/7jb7r1wb0sh8q+/pEh3LDeNzGWwLBb8cxZhg/wo2eB/qbNxu2r OOcKht+ipnyYxmslAfueMj4KLBd9y209BAO2zMS/4/ai0MH1HzpHChx01L1O0cuAHTTw nnS0eL0LAy53r2KkvyLwloqHsC9HpG+sWlHIShEpIJn53SmDobiFGQ1VsyE+UREDqYZt /tAp2iap134mfqF0Zji+NYJLCfj3QXJ/gPP0f2FuWpPBzdO4jOWxKqwfqJ68u6d7Tlhj d1LQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732723161; x=1733327961; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=6IuxLTLc3V8mNACY7mLpeeZZOZ1blGle+1mRqzVR3yM=; b=iu86q9h8bQYwXvQSD/pIaEZEF/6B+++HUy7ACgnBIx6XMY5CBzLDSVZhO3yqQn8tUj NpKPCWnIv6SoennVQhbxA75CaQ2uCUl+I22tebYzcAeXKU467iXwClXAEZJyHq3pCGZc yEmP8QU42ZphKE9AHih4eBjAnLvrvgqAmNXb6M2bYZGLRPTH7Mxl0TbcficzQ26pgIEd 3pBShYWsuRc6qTqKYU1p0GPk+9XKSoXG7CwZpsKo3Xh4JatHEgCJtW4b1/Pybg9b/ekH o462MjEfy6vjlQH35rIckvVIQjjaV73vZN72vPtSFgXVUeTOTz/aEo9uL6ZizbK9T7xo E+Sg== X-Forwarded-Encrypted: i=1; AJvYcCV9jSkzBgP4OFgcaNUEzvC6ENORKOKz/3zh9tOWGvKHIADpLzVNn0fiQksNlvx4CUdPlo3SMUULmdtk8Kqq@lists.postgresql.org X-Gm-Message-State: AOJu0YxZQ+RZV/OB093ClddRa9Wj2QItYvKyoHkaeWTmYB9DocDkD5En V+Y+kmhmlJB0Z6c3ZOjqcTkY3MokXcmxbbEv0eAeHB3VwHfrXb/G X-Gm-Gg: ASbGncvKf8KqtR05X3iHzfT6tJG1TGWorDNmpXjf+EouWJd2mmhNUg3390rMOQ6VDBB HsYXnjKM3ZPdj+pbnGDaSRvz7yOFNuv3NFB5fF58Aigf+c78m+u07MzWjBAtipF7JJkQYTM5B/f uOKn6zprC9R/sTDKKXfCHiV7zH1FrpBejLGPZx54rOo1IGA3BY+o/eUduUG925H1AWnYRxFwLeO eXRwUM3Oln/pn+2nmzLLJuAbKvhnu1T4qM9/QHtBFd8fnSGxX3aer1U4Ts/PupOD8h+8Q1XeLoG +lFe9UvzMREAzF7/CsHJ+DRvaLEw5htye7tRG/R8 X-Google-Smtp-Source: AGHT+IFI1Q0+T1TYzOyEdOj9Ggg1CMWnAIcy0BHT3EPRVH8z+kJf5d8daV27Soy3pN9y8S36dkfTow== X-Received: by 2002:a05:622a:13cd:b0:466:954e:a89f with SMTP id d75a77b69052e-466b3510a41mr37129681cf.14.1732723161063; Wed, 27 Nov 2024 07:59:21 -0800 (PST) Received: from nathan (162-195-168-172.lightspeed.stlsmo.sbcglobal.net. [162.195.168.172]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-466b0a61144sm13915481cf.27.2024.11.27.07.59.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Nov 2024 07:59:20 -0800 (PST) Date: Wed, 27 Nov 2024 09:59:18 -0600 From: Nathan Bossart To: Michael Paquier Cc: Alexander Lakhin , Tom Lane , "Jonathan S. Katz" , PostgreSQL Hackers Subject: Re: Large expressions in indexes can't be stored (non-TOASTable) Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Wed, Nov 27, 2024 at 03:20:19PM +0900, Michael Paquier wrote: > On Mon, Nov 25, 2024 at 01:29:31PM -0600, Nathan Bossart wrote: >> Or we could just enforce that you have an active snapshot whenever you >> modify a catalog with a TOAST table. That's simpler, but it requires extra >> work in some paths (and probably comments to point out that we're only >> pushing an active snapshot to satisfy an assertion). > > I may be wrong, but I suspect that enforcing the check without being > column-based is the right way to go and that this is going to catch > more errors in the long-term than being a maintenance burden. So I > would keep the snapshot check even if it's a bit aggressive, still > it's useful. And we are not talking about that may code paths that > need to be switched to require a snapshot, as well. Most of the ones > you have mentioned on this thread are really particular in the ways > they do transaction handling. I suspect that it may also catch > out-of-core issues with extensions doing direct catalog manipulations. That is useful feedback, thanks. One other thing that caught my eye is that replorigin_create() uses SnapshotDirty, so I'm unsure if PushActiveSnapshot(GetTransactionSnapshot()) is correct there. The only other example I found is RelationFindReplTupleByIndex(), which uses GetLatestSnapshot(). But I do see that CreateSubscription() calls replorigin_create(), and it seems to rely on the transaction snapshot, so maybe it's okay, at least for the purpose of TOAST table access... I'm finding myself wishing there was a bit more commentary about the proper usage of these snapshot functions. Maybe I can try to add some as a follow-up exercise. -- nathan