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 1sr0jX-00EoiR-Oi for pgsql-hackers@arkaria.postgresql.org; Wed, 18 Sep 2024 19:53:03 +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 1sr0jV-00EmOk-3F for pgsql-hackers@arkaria.postgresql.org; Wed, 18 Sep 2024 19:53:01 +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 1sr0jU-00EmOc-NW for pgsql-hackers@lists.postgresql.org; Wed, 18 Sep 2024 19:53:00 +0000 Received: from mail-il1-x136.google.com ([2607:f8b0:4864:20::136]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1sr0jR-001r9T-Rr for pgsql-hackers@lists.postgresql.org; Wed, 18 Sep 2024 19:52:59 +0000 Received: by mail-il1-x136.google.com with SMTP id e9e14a558f8ab-3a097ff7d89so289205ab.3 for ; Wed, 18 Sep 2024 12:52:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1726689177; x=1727293977; 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=YMaITecEwwwKk2mBq6RdSdGx0XdWalS5TVdKwEITwek=; b=LOpMK3W5jCtOSXVKJlylagDEvcDNjD3pgdDQ/jW4WiOSE8BkpKNho/MQCJgiAnJBw+ xFB8SB00sIfV37q3QtDb1hxOeTNil9SBeGMb7vk4Qjx6xDhwLwEIHhrV+Ouo7t6igLxm 32c68fKlpbe4w47DFZqmNv34vk1ua9jBv/VWOqfy09N1M6Y+QniuuvG26/8+NZmBLp7E O0zUPrutLs1IQstX4+bpQ7LoYziclgoVPtOVRrPch4Blv10Skzdn189yqBpK5W8AOaf8 cskvd3hZ6h03YKxQm6Eh3Tl2nhuKfdt4NqWFAXyn81bXOqxA8lB1eLGd99rDlolcgHp7 GDGQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726689177; x=1727293977; 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=YMaITecEwwwKk2mBq6RdSdGx0XdWalS5TVdKwEITwek=; b=Elf4P4I4RulbUdg7MiKMg+Ff4ziU2KJFeLPdaanF3l06YH8Dg4ecfQ/mvb9sSB6jH8 VGmndTQTbszW+Zcb78OgyGhOhkcY+sQjNyG2a/cdaUKmGy769OWp5l7cWIZpKzi3kYqJ 5cgS7Z/fZlvbRiihNrvjanyTleCyUGWkGox7cyFQA2KrZEiJoJbN/WEW4MdOb+0yBzlp cOlul/P/01B77Vg384nJCoLT75yv20OUDYxwNGfATLs8z38eFj24lVlaTf1Q3dHSAC7A Z+CByyqRG/1MYUYtVOeHSPgmgDRKoFhPxo6pluk/M5KWmm9V6BIII3rLugXYvgxgnpIQ on5g== X-Forwarded-Encrypted: i=1; AJvYcCWuzjAWK6Sa3qciGgMxRcdMGUD+l0iV4qhyUxx6gJ3pidKaD6Y6JXqqeqyvtgvOu2lAmmvT8oXAaYysFyCJ@lists.postgresql.org X-Gm-Message-State: AOJu0YyQ7dmNrV/KGg8XJOyf6wuiFAvZrNVDdulwDm0or+UtmdjaRVIs mbIyEnObt4fDD0hiLd2ZSlLcTy9Y8nCSmjD02l6U51nMsQtO6OC3 X-Google-Smtp-Source: AGHT+IE5MLKokMhNzlgORDgH+n3Hv85QbLgmKppxQTu7Va7jBtxhFN+A94r9/wE22VQLN+Gly7u51Q== X-Received: by 2002:a05:6e02:1ca5:b0:3a0:a311:6773 with SMTP id e9e14a558f8ab-3a0a3116a37mr91686325ab.21.1726689175993; Wed, 18 Sep 2024 12:52:55 -0700 (PDT) Received: from nathan (162-195-168-172.lightspeed.stlsmo.sbcglobal.net. [162.195.168.172]) by smtp.gmail.com with ESMTPSA id 8926c6da1cb9f-4d37ed19ebesm2597188173.112.2024.09.18.12.52.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Sep 2024 12:52:55 -0700 (PDT) Date: Wed, 18 Sep 2024 14:52:53 -0500 From: Nathan Bossart To: Tom Lane Cc: "Jonathan S. Katz" , PostgreSQL Hackers Subject: Re: Large expressions in indexes can't be stored (non-TOASTable) Message-ID: References: <1679756.1725476893@sss.pgh.pa.us> <1812111.1726671296@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="XPnlhGfhBsHUsLKx" Content-Disposition: inline In-Reply-To: <1812111.1726671296@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --XPnlhGfhBsHUsLKx Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Wed, Sep 18, 2024 at 10:54:56AM -0400, Tom Lane wrote: > Nathan Bossart writes: >> Any objections to committing this? > > Nope. Committed. I waffled on whether to add a test for system indexes that used pg_index's varlena columns, but I ended up leaving it out. I've attached it here in case anyone thinks we should add it. -- nathan --XPnlhGfhBsHUsLKx Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="test.patch" diff --git a/src/test/regress/expected/misc_sanity.out b/src/test/regress/expected/misc_sanity.out index 45e7492877..2af66cf648 100644 --- a/src/test/regress/expected/misc_sanity.out +++ b/src/test/regress/expected/misc_sanity.out @@ -60,6 +60,31 @@ ORDER BY 1, 2; pg_largeobject_metadata | lomacl | aclitem[] (9 rows) +-- **************** pg_index **************** +-- Look for system indexes that use varlena columns in pg_index. There +-- shouldn't be any to avoid circularity hazards with pg_index's TOAST table. +-- +-- The first query returns the varlena columns in pg_index. Each should be +-- listed in the second query's WHERE clause. +SELECT attname +FROM pg_attribute +WHERE attstorage != 'p' AND + attrelid = 'pg_catalog.pg_index'::regclass +ORDER BY 1; + attname +---------- + indexprs + indpred +(2 rows) + +SELECT relname +FROM pg_class c JOIN pg_index i ON indexrelid = c.oid +WHERE c.oid < 16384 AND + (i.indexprs IS NOT NULL OR i.indpred IS NOT NULL); + relname +--------- +(0 rows) + -- system catalogs without primary keys -- -- Current exceptions: diff --git a/src/test/regress/sql/misc_sanity.sql b/src/test/regress/sql/misc_sanity.sql index 16f3a7c0c1..3e87c50b84 100644 --- a/src/test/regress/sql/misc_sanity.sql +++ b/src/test/regress/sql/misc_sanity.sql @@ -53,6 +53,26 @@ WHERE c.oid < 16384 AND ORDER BY 1, 2; +-- **************** pg_index **************** + +-- Look for system indexes that use varlena columns in pg_index. There +-- shouldn't be any to avoid circularity hazards with pg_index's TOAST table. +-- +-- The first query returns the varlena columns in pg_index. Each should be +-- listed in the second query's WHERE clause. + +SELECT attname +FROM pg_attribute +WHERE attstorage != 'p' AND + attrelid = 'pg_catalog.pg_index'::regclass +ORDER BY 1; + +SELECT relname +FROM pg_class c JOIN pg_index i ON indexrelid = c.oid +WHERE c.oid < 16384 AND + (i.indexprs IS NOT NULL OR i.indpred IS NOT NULL); + + -- system catalogs without primary keys -- -- Current exceptions: --XPnlhGfhBsHUsLKx--