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 1sluw5-001x0T-Lk for pgsql-hackers@arkaria.postgresql.org; Wed, 04 Sep 2024 18:40:57 +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 1sluw4-00DeLt-63 for pgsql-hackers@arkaria.postgresql.org; Wed, 04 Sep 2024 18:40:56 +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 1sluw3-00DeLl-Sp for pgsql-hackers@lists.postgresql.org; Wed, 04 Sep 2024 18:40:56 +0000 Received: from mail-il1-x132.google.com ([2607:f8b0:4864:20::132]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1sluw2-000A6T-1M for pgsql-hackers@lists.postgresql.org; Wed, 04 Sep 2024 18:40:55 +0000 Received: by mail-il1-x132.google.com with SMTP id e9e14a558f8ab-39f4ec52c5fso18139845ab.2 for ; Wed, 04 Sep 2024 11:40:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1725475251; x=1726080051; 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=NrdYSkvMDDRxtKecc3Tz1Y5DR/pzB34vf+/4a+kecSE=; b=m4XsM/znu1N2t/C0rFPhAvgmdLTouTuKZ0SW29TslvGziuXpcoNw8TbDU2L+AqNwH+ oEOfo1Jd4lrHa+f1zdjOtvsuNcyK9N1rNOs6e3+Ge5Gl9MvT8u7RwyRDSZIuJuGnPajU Dytdl+6+FCYj98cU8Oy/FvD7DHNCpjxhxylnRr8mGz+emgtqtg0wwAQkDxEAWKggN+pp lsVuhPs9gj2aPbrFsn0ez60vdSymitjrgQcJSMlU2+0kqRyUZx5uEYfX0vKWAX3Ibc/U CvUxbP89/3tMOTym/8qHDhgisXrPqI2XTl/mjmse814A4W+Y6At8IxVc3ICJw6MctCdk kS+Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725475251; x=1726080051; 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=NrdYSkvMDDRxtKecc3Tz1Y5DR/pzB34vf+/4a+kecSE=; b=UcRjtzfgRbqjW7mzpD6UfbpXPnkeDmsRTisjz8MnqOuXg9qYmgnT9yA+4wz22oZ1Gv /22zZ/KoG5QQSHG7pYOs5nEBeTn/EXKSfWcYhx7ACQhs0NN9NWXJNsVIV1R9KOBoVP1S sZQtSRix0oFaeZMJMGGZXvH8tV/2Qa/63SOOZz8c2Na3TyOePauUBrCfRRYUIbONUIpM B6JH582ml+SsYwUoMU+AxUiGkBmBll21/O+6901HysG32DTsfKjSDE+cW1hCxJ3CoNOw CVEn7GcUwjvD1SzvVRsOCL62HBPrVq8H2MbO/pCHCM9Qov8ve61raUinSmAYa4JS974h rTaA== X-Gm-Message-State: AOJu0YwBGuHcmSCTB9OL7ZPqEeynKVlNFs3IizVEuPf6bfwsdnZkqG6e F79/gUxY5w7nwXOTQ0r+ym1lrfqYE5h9j6ujHajelGDgXloQE0OibvlNYw== X-Google-Smtp-Source: AGHT+IGgulN+yTHMWTuK6OMcdWCjVCco18fTtCfUUHT3D3R1e2ipBhngS02CUtnY4cLVSOwQofyL1w== X-Received: by 2002:a05:6e02:1381:b0:39f:4e36:4b96 with SMTP id e9e14a558f8ab-39f4f68e2d9mr196940885ab.10.1725475251353; Wed, 04 Sep 2024 11:40:51 -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-4ced2ee4110sm3173587173.159.2024.09.04.11.40.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Sep 2024 11:40:50 -0700 (PDT) Date: Wed, 4 Sep 2024 13:40:49 -0500 From: Nathan Bossart To: "Jonathan S. Katz" Cc: PostgreSQL Hackers Subject: Re: Large expressions in indexes can't be stored (non-TOASTable) Message-ID: References: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="6evqaw/7iNisbu+7" Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --6evqaw/7iNisbu+7 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Tue, Sep 03, 2024 at 12:35:42PM -0400, Jonathan S. Katz wrote: > However, I ran into the issue in[1], where pg_index was identified as > catalog that is missing a toast table, even though `indexprs` is marked for > extended storage. Providing a very simple reproducer in psql below: Thanks to commit 96cdeae, only a few catalogs remain that are missing TOAST tables: pg_attribute, pg_class, pg_index, pg_largeobject, and pg_largeobject_metadata. I've attached a short patch to add one for pg_index, which resolves the issue cited here. This passes "check-world" and didn't fail for a few ad hoc tests (e.g., VACUUM FULL on pg_index). I haven't spent too much time investigating possible circularity issues, but I'll note that none of the system indexes presently use the indexprs and indpred columns. If we do want to proceed with adding a TOAST table to pg_index, IMHO it would be better to do it sooner than later so that it has plenty of time to bake. -- nathan --6evqaw/7iNisbu+7 Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="v1-0001-add-toast-table-to-pg_index.patch" From 301aeeb346c3499e4555e4db1f4fc124f9cbab62 Mon Sep 17 00:00:00 2001 From: Nathan Bossart Date: Wed, 4 Sep 2024 13:28:27 -0500 Subject: [PATCH v1 1/1] add toast table to pg_index --- src/include/catalog/pg_index.h | 2 ++ src/test/regress/expected/misc_sanity.out | 4 +--- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/include/catalog/pg_index.h b/src/include/catalog/pg_index.h index 3462572eb5..6c89639a9e 100644 --- a/src/include/catalog/pg_index.h +++ b/src/include/catalog/pg_index.h @@ -69,6 +69,8 @@ CATALOG(pg_index,2610,IndexRelationId) BKI_SCHEMA_MACRO */ typedef FormData_pg_index *Form_pg_index; +DECLARE_TOAST_WITH_MACRO(pg_index, 8149, 8150, PgIndexToastTable, PgIndexToastIndex); + DECLARE_INDEX(pg_index_indrelid_index, 2678, IndexIndrelidIndexId, pg_index, btree(indrelid oid_ops)); DECLARE_UNIQUE_INDEX_PKEY(pg_index_indexrelid_index, 2679, IndexRelidIndexId, pg_index, btree(indexrelid oid_ops)); diff --git a/src/test/regress/expected/misc_sanity.out b/src/test/regress/expected/misc_sanity.out index ad88cbd5c4..2152c65810 100644 --- a/src/test/regress/expected/misc_sanity.out +++ b/src/test/regress/expected/misc_sanity.out @@ -56,11 +56,9 @@ ORDER BY 1, 2; pg_class | relacl | aclitem[] pg_class | reloptions | text[] pg_class | relpartbound | pg_node_tree - pg_index | indexprs | pg_node_tree - pg_index | indpred | pg_node_tree pg_largeobject | data | bytea pg_largeobject_metadata | lomacl | aclitem[] -(11 rows) +(9 rows) -- system catalogs without primary keys -- -- 2.39.3 (Apple Git-146) --6evqaw/7iNisbu+7--