Skip to content

Commit b52c4fc

Browse files
Add TOAST table to pg_index.
This change allows pg_index rows to use out-of-line storage for the "indexprs" and "indpred" columns, which enables use-cases such as very large index expressions. This system catalog was previously not given a TOAST table due to a fear of circularity issues (see commit 96cdeae). Testing has not revealed any such problems, and it seems unlikely that the entries for system indexes could ever need out-of-line storage. In any case, it is still early in the v18 development cycle, so committing this now will hopefully increase the chances of finding any unexpected problems prior to release. Bumps catversion. Reported-by: Jonathan Katz Reviewed-by: Tom Lane Discussion: https://postgr.es/m/b611015f-b423-458c-aa2d-be0e655cc1b4%40postgresql.org
1 parent a7c39db commit b52c4fc

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

src/include/catalog/catversion.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,6 @@
5757
*/
5858

5959
/* yyyymmddN */
60-
#define CATALOG_VERSION_NO 202409181
60+
#define CATALOG_VERSION_NO 202409182
6161

6262
#endif

src/include/catalog/pg_index.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,8 @@ CATALOG(pg_index,2610,IndexRelationId) BKI_SCHEMA_MACRO
6969
*/
7070
typedef FormData_pg_index *Form_pg_index;
7171

72+
DECLARE_TOAST_WITH_MACRO(pg_index, 8149, 8150, PgIndexToastTable, PgIndexToastIndex);
73+
7274
DECLARE_INDEX(pg_index_indrelid_index, 2678, IndexIndrelidIndexId, pg_index, btree(indrelid oid_ops));
7375
DECLARE_UNIQUE_INDEX_PKEY(pg_index_indexrelid_index, 2679, IndexRelidIndexId, pg_index, btree(indexrelid oid_ops));
7476

src/test/regress/expected/misc_sanity.out

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ WHERE refclassid = 0 OR refobjid = 0 OR
3535
-- Look for system tables with varlena columns but no toast table. All
3636
-- system tables with toastable columns should have toast tables, with
3737
-- the following exceptions:
38-
-- 1. pg_class, pg_attribute, and pg_index, due to fear of recursive
39-
-- dependencies as toast tables depend on them.
38+
-- 1. pg_class and pg_attribute, due to fear of recursive dependencies as
39+
-- toast tables depend on them.
4040
-- 2. pg_largeobject and pg_largeobject_metadata. Large object catalogs
4141
-- and toast tables are mutually exclusive and large object data is handled
4242
-- as user data by pg_upgrade, which would cause failures.
@@ -56,11 +56,9 @@ ORDER BY 1, 2;
5656
pg_class | relacl | aclitem[]
5757
pg_class | reloptions | text[]
5858
pg_class | relpartbound | pg_node_tree
59-
pg_index | indexprs | pg_node_tree
60-
pg_index | indpred | pg_node_tree
6159
pg_largeobject | data | bytea
6260
pg_largeobject_metadata | lomacl | aclitem[]
63-
(11 rows)
61+
(9 rows)
6462

6563
-- system catalogs without primary keys
6664
--

src/test/regress/sql/misc_sanity.sql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ WHERE refclassid = 0 OR refobjid = 0 OR
3838
-- Look for system tables with varlena columns but no toast table. All
3939
-- system tables with toastable columns should have toast tables, with
4040
-- the following exceptions:
41-
-- 1. pg_class, pg_attribute, and pg_index, due to fear of recursive
42-
-- dependencies as toast tables depend on them.
41+
-- 1. pg_class and pg_attribute, due to fear of recursive dependencies as
42+
-- toast tables depend on them.
4343
-- 2. pg_largeobject and pg_largeobject_metadata. Large object catalogs
4444
-- and toast tables are mutually exclusive and large object data is handled
4545
-- as user data by pg_upgrade, which would cause failures.

0 commit comments

Comments
 (0)