From 7adbc02fc5c1f7dda42c6dc96ded3a1a60beb7b8 Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Thu, 22 Oct 2020 11:57:22 +0200 Subject: [PATCH 1/2] Move catalog toast table declarations --- doc/src/sgml/bki.sgml | 3 +- src/backend/catalog/Makefile | 5 +- src/backend/catalog/catalog.c | 3 +- src/backend/catalog/toasting.c | 2 +- src/include/catalog/duplicate_oids | 2 +- src/include/catalog/genbki.h | 13 ++++ src/include/catalog/pg_aggregate.h | 2 + src/include/catalog/pg_attrdef.h | 2 + src/include/catalog/pg_authid.h | 4 + src/include/catalog/pg_collation.h | 2 + src/include/catalog/pg_constraint.h | 2 + src/include/catalog/pg_database.h | 4 + src/include/catalog/pg_db_role_setting.h | 4 + src/include/catalog/pg_default_acl.h | 2 + src/include/catalog/pg_description.h | 2 + src/include/catalog/pg_event_trigger.h | 2 + src/include/catalog/pg_extension.h | 2 + src/include/catalog/pg_foreign_data_wrapper.h | 2 + src/include/catalog/pg_foreign_server.h | 2 + src/include/catalog/pg_foreign_table.h | 2 + src/include/catalog/pg_init_privs.h | 2 + src/include/catalog/pg_language.h | 2 + src/include/catalog/pg_namespace.h | 2 + src/include/catalog/pg_partitioned_table.h | 2 + src/include/catalog/pg_policy.h | 2 + src/include/catalog/pg_proc.h | 2 + src/include/catalog/pg_replication_origin.h | 4 + src/include/catalog/pg_rewrite.h | 2 + src/include/catalog/pg_seclabel.h | 2 + src/include/catalog/pg_shdescription.h | 4 + src/include/catalog/pg_shseclabel.h | 4 + src/include/catalog/pg_statistic.h | 2 + src/include/catalog/pg_statistic_ext.h | 2 + src/include/catalog/pg_statistic_ext_data.h | 2 + src/include/catalog/pg_subscription.h | 4 + src/include/catalog/pg_tablespace.h | 4 + src/include/catalog/pg_trigger.h | 2 + src/include/catalog/pg_ts_dict.h | 2 + src/include/catalog/pg_type.h | 2 + src/include/catalog/pg_user_mapping.h | 2 + src/include/catalog/renumber_oids.pl | 4 +- src/include/catalog/toasting.h | 75 ------------------- src/include/catalog/unused_oids | 2 +- src/tools/msvc/Solution.pm | 1 - 44 files changed, 105 insertions(+), 89 deletions(-) diff --git a/doc/src/sgml/bki.sgml b/doc/src/sgml/bki.sgml index 62fc9cbea3..ed61752e7f 100644 --- a/doc/src/sgml/bki.sgml +++ b/doc/src/sgml/bki.sgml @@ -24,8 +24,7 @@ System Catalog Declarations and Initial Contents the catalog has, as well as some other basic properties such as its OID. Other critical files defining the catalog structure include indexing.h, which defines the indexes present - on all the system catalogs, and toasting.h, which - defines TOAST tables for catalogs that need one. + on all the system catalogs. diff --git a/src/backend/catalog/Makefile b/src/backend/catalog/Makefile index 93cf6d4368..be88eb1be6 100644 --- a/src/backend/catalog/Makefile +++ b/src/backend/catalog/Makefile @@ -72,11 +72,8 @@ CATALOG_HEADERS := \ GENERATED_HEADERS := $(CATALOG_HEADERS:%.h=%_d.h) schemapg.h -# In the list of headers used to assemble postgres.bki, indexing.h needs -# be last, and toasting.h just before it. This ensures we don't try to -# create indexes or toast tables before their catalogs exist. POSTGRES_BKI_SRCS := $(addprefix $(top_srcdir)/src/include/catalog/,\ - $(CATALOG_HEADERS) toasting.h indexing.h \ + $(CATALOG_HEADERS) indexing.h \ ) # The .dat files we need can just be listed alphabetically. diff --git a/src/backend/catalog/catalog.c b/src/backend/catalog/catalog.c index 7d6acaed92..9be6423e44 100644 --- a/src/backend/catalog/catalog.c +++ b/src/backend/catalog/catalog.c @@ -40,7 +40,6 @@ #include "catalog/pg_subscription.h" #include "catalog/pg_tablespace.h" #include "catalog/pg_type.h" -#include "catalog/toasting.h" #include "miscadmin.h" #include "storage/fd.h" #include "utils/fmgroids.h" @@ -268,7 +267,7 @@ IsSharedRelation(Oid relationId) relationId == SubscriptionObjectIndexId || relationId == SubscriptionNameIndexId) return true; - /* These are their toast tables and toast indexes (see toasting.h) */ + /* These are their toast tables and toast indexes */ if (relationId == PgAuthidToastTable || relationId == PgAuthidToastIndex || relationId == PgDatabaseToastTable || diff --git a/src/backend/catalog/toasting.c b/src/backend/catalog/toasting.c index c40d25b301..f1850436bd 100644 --- a/src/backend/catalog/toasting.c +++ b/src/backend/catalog/toasting.c @@ -391,7 +391,7 @@ needs_toast_table(Relation rel) /* * Ignore attempts to create toast tables on catalog tables after initdb. * Which catalogs get toast tables is explicitly chosen in - * catalog/toasting.h. (We could get here via some ALTER TABLE command if + * catalog/pg_*.h. (We could get here via some ALTER TABLE command if * the catalog doesn't have a toast table.) */ if (IsCatalogRelation(rel) && !IsBootstrapProcessingMode()) diff --git a/src/include/catalog/duplicate_oids b/src/include/catalog/duplicate_oids index 9e5e9a15be..1f863cb5ed 100755 --- a/src/include/catalog/duplicate_oids +++ b/src/include/catalog/duplicate_oids @@ -26,7 +26,7 @@ chdir $FindBin::RealBin or die "could not cd to $FindBin::RealBin: $!\n"; use lib "$FindBin::RealBin/../../backend/catalog/"; use Catalog; -my @input_files = (glob("pg_*.h"), qw(indexing.h toasting.h)); +my @input_files = (glob("pg_*.h"), qw(indexing.h)); my $oids = Catalog::FindAllOidsFromHeaders(@input_files); diff --git a/src/include/catalog/genbki.h b/src/include/catalog/genbki.h index 8cac7ec878..e73ca23ef2 100644 --- a/src/include/catalog/genbki.h +++ b/src/include/catalog/genbki.h @@ -41,6 +41,19 @@ */ #define BKI_LOOKUP(catalog) +/* + * These lines are processed by genbki.pl to create the statements + * the bootstrap parser will turn into BootstrapToastTable commands. + * Each line specifies the system catalog that needs a toast table, + * the OID to assign to the toast table, and the OID to assign to the + * toast table's index. The reason we hard-wire these OIDs is that we + * need stable OIDs for shared relations, and that includes toast tables + * of shared relations. + * + * The macro definition is just to keep the C compiler from spitting up. + */ +#define DECLARE_TOAST(name,toastoid,indexoid) extern int no_such_variable + /* The following are never defined; they are here only for documentation. */ /* diff --git a/src/include/catalog/pg_aggregate.h b/src/include/catalog/pg_aggregate.h index 457ca18444..52b8281594 100644 --- a/src/include/catalog/pg_aggregate.h +++ b/src/include/catalog/pg_aggregate.h @@ -108,6 +108,8 @@ CATALOG(pg_aggregate,2600,AggregateRelationId) */ typedef FormData_pg_aggregate *Form_pg_aggregate; +DECLARE_TOAST(pg_aggregate, 4159, 4160); + #ifdef EXPOSE_TO_CLIENT_CODE /* diff --git a/src/include/catalog/pg_attrdef.h b/src/include/catalog/pg_attrdef.h index 7b661df311..0ac27574fd 100644 --- a/src/include/catalog/pg_attrdef.h +++ b/src/include/catalog/pg_attrdef.h @@ -46,4 +46,6 @@ CATALOG(pg_attrdef,2604,AttrDefaultRelationId) */ typedef FormData_pg_attrdef *Form_pg_attrdef; +DECLARE_TOAST(pg_attrdef, 2830, 2831); + #endif /* PG_ATTRDEF_H */ diff --git a/src/include/catalog/pg_authid.h b/src/include/catalog/pg_authid.h index 88a5373080..310dc6b8a5 100644 --- a/src/include/catalog/pg_authid.h +++ b/src/include/catalog/pg_authid.h @@ -55,4 +55,8 @@ CATALOG(pg_authid,1260,AuthIdRelationId) BKI_SHARED_RELATION BKI_ROWTYPE_OID(284 */ typedef FormData_pg_authid *Form_pg_authid; +DECLARE_TOAST(pg_authid, 4175, 4176); +#define PgAuthidToastTable 4175 +#define PgAuthidToastIndex 4176 + #endif /* PG_AUTHID_H */ diff --git a/src/include/catalog/pg_collation.h b/src/include/catalog/pg_collation.h index 27618b324d..33ddd1c6df 100644 --- a/src/include/catalog/pg_collation.h +++ b/src/include/catalog/pg_collation.h @@ -50,6 +50,8 @@ CATALOG(pg_collation,3456,CollationRelationId) */ typedef FormData_pg_collation *Form_pg_collation; +DECLARE_TOAST(pg_collation, 4161, 4162); + #ifdef EXPOSE_TO_CLIENT_CODE #define COLLPROVIDER_DEFAULT 'd' diff --git a/src/include/catalog/pg_constraint.h b/src/include/catalog/pg_constraint.h index 9600ece93c..6db4bf6ce3 100644 --- a/src/include/catalog/pg_constraint.h +++ b/src/include/catalog/pg_constraint.h @@ -153,6 +153,8 @@ CATALOG(pg_constraint,2606,ConstraintRelationId) */ typedef FormData_pg_constraint *Form_pg_constraint; +DECLARE_TOAST(pg_constraint, 2832, 2833); + #ifdef EXPOSE_TO_CLIENT_CODE /* Valid values for contype */ diff --git a/src/include/catalog/pg_database.h b/src/include/catalog/pg_database.h index f623ee81b7..58bf3c1084 100644 --- a/src/include/catalog/pg_database.h +++ b/src/include/catalog/pg_database.h @@ -80,4 +80,8 @@ CATALOG(pg_database,1262,DatabaseRelationId) BKI_SHARED_RELATION BKI_ROWTYPE_OID */ typedef FormData_pg_database *Form_pg_database; +DECLARE_TOAST(pg_database, 4177, 4178); +#define PgDatabaseToastTable 4177 +#define PgDatabaseToastIndex 4178 + #endif /* PG_DATABASE_H */ diff --git a/src/include/catalog/pg_db_role_setting.h b/src/include/catalog/pg_db_role_setting.h index 5713fa2315..5b0771e5f9 100644 --- a/src/include/catalog/pg_db_role_setting.h +++ b/src/include/catalog/pg_db_role_setting.h @@ -43,6 +43,10 @@ CATALOG(pg_db_role_setting,2964,DbRoleSettingRelationId) BKI_SHARED_RELATION typedef FormData_pg_db_role_setting * Form_pg_db_role_setting; +DECLARE_TOAST(pg_db_role_setting, 2966, 2967); +#define PgDbRoleSettingToastTable 2966 +#define PgDbRoleSettingToastIndex 2967 + /* * prototypes for functions in pg_db_role_setting.h */ diff --git a/src/include/catalog/pg_default_acl.h b/src/include/catalog/pg_default_acl.h index 2bac5e23e1..e22ee897f8 100644 --- a/src/include/catalog/pg_default_acl.h +++ b/src/include/catalog/pg_default_acl.h @@ -47,6 +47,8 @@ CATALOG(pg_default_acl,826,DefaultAclRelationId) */ typedef FormData_pg_default_acl *Form_pg_default_acl; +DECLARE_TOAST(pg_default_acl, 4143, 4144); + #ifdef EXPOSE_TO_CLIENT_CODE /* diff --git a/src/include/catalog/pg_description.h b/src/include/catalog/pg_description.h index c40e8b7373..93eb041bac 100644 --- a/src/include/catalog/pg_description.h +++ b/src/include/catalog/pg_description.h @@ -63,4 +63,6 @@ CATALOG(pg_description,2609,DescriptionRelationId) */ typedef FormData_pg_description * Form_pg_description; +DECLARE_TOAST(pg_description, 2834, 2835); + #endif /* PG_DESCRIPTION_H */ diff --git a/src/include/catalog/pg_event_trigger.h b/src/include/catalog/pg_event_trigger.h index 24e4b1a181..abe92cf499 100644 --- a/src/include/catalog/pg_event_trigger.h +++ b/src/include/catalog/pg_event_trigger.h @@ -48,4 +48,6 @@ CATALOG(pg_event_trigger,3466,EventTriggerRelationId) */ typedef FormData_pg_event_trigger *Form_pg_event_trigger; +DECLARE_TOAST(pg_event_trigger, 4145, 4146); + #endif /* PG_EVENT_TRIGGER_H */ diff --git a/src/include/catalog/pg_extension.h b/src/include/catalog/pg_extension.h index b6f4128cf3..57e1272cd2 100644 --- a/src/include/catalog/pg_extension.h +++ b/src/include/catalog/pg_extension.h @@ -49,4 +49,6 @@ CATALOG(pg_extension,3079,ExtensionRelationId) */ typedef FormData_pg_extension *Form_pg_extension; +DECLARE_TOAST(pg_extension, 4147, 4148); + #endif /* PG_EXTENSION_H */ diff --git a/src/include/catalog/pg_foreign_data_wrapper.h b/src/include/catalog/pg_foreign_data_wrapper.h index 44d8558c41..3f0d0b0249 100644 --- a/src/include/catalog/pg_foreign_data_wrapper.h +++ b/src/include/catalog/pg_foreign_data_wrapper.h @@ -47,4 +47,6 @@ CATALOG(pg_foreign_data_wrapper,2328,ForeignDataWrapperRelationId) */ typedef FormData_pg_foreign_data_wrapper *Form_pg_foreign_data_wrapper; +DECLARE_TOAST(pg_foreign_data_wrapper, 4149, 4150); + #endif /* PG_FOREIGN_DATA_WRAPPER_H */ diff --git a/src/include/catalog/pg_foreign_server.h b/src/include/catalog/pg_foreign_server.h index 5c17004151..d24af91c80 100644 --- a/src/include/catalog/pg_foreign_server.h +++ b/src/include/catalog/pg_foreign_server.h @@ -47,4 +47,6 @@ CATALOG(pg_foreign_server,1417,ForeignServerRelationId) */ typedef FormData_pg_foreign_server *Form_pg_foreign_server; +DECLARE_TOAST(pg_foreign_server, 4151, 4152); + #endif /* PG_FOREIGN_SERVER_H */ diff --git a/src/include/catalog/pg_foreign_table.h b/src/include/catalog/pg_foreign_table.h index 31c1faed03..1f01c552d6 100644 --- a/src/include/catalog/pg_foreign_table.h +++ b/src/include/catalog/pg_foreign_table.h @@ -42,4 +42,6 @@ CATALOG(pg_foreign_table,3118,ForeignTableRelationId) */ typedef FormData_pg_foreign_table *Form_pg_foreign_table; +DECLARE_TOAST(pg_foreign_table, 4153, 4154); + #endif /* PG_FOREIGN_TABLE_H */ diff --git a/src/include/catalog/pg_init_privs.h b/src/include/catalog/pg_init_privs.h index 7734b72c04..314e83daef 100644 --- a/src/include/catalog/pg_init_privs.h +++ b/src/include/catalog/pg_init_privs.h @@ -62,6 +62,8 @@ CATALOG(pg_init_privs,3394,InitPrivsRelationId) */ typedef FormData_pg_init_privs * Form_pg_init_privs; +DECLARE_TOAST(pg_init_privs, 4155, 4156); + /* * It is important to know if the initial privileges are from initdb or from an * extension. This enum is used to provide that differentiation and the two diff --git a/src/include/catalog/pg_language.h b/src/include/catalog/pg_language.h index 937bacbf98..d38ba7a8a6 100644 --- a/src/include/catalog/pg_language.h +++ b/src/include/catalog/pg_language.h @@ -64,4 +64,6 @@ CATALOG(pg_language,2612,LanguageRelationId) */ typedef FormData_pg_language *Form_pg_language; +DECLARE_TOAST(pg_language, 4157, 4158); + #endif /* PG_LANGUAGE_H */ diff --git a/src/include/catalog/pg_namespace.h b/src/include/catalog/pg_namespace.h index db93b27015..da380e17a8 100644 --- a/src/include/catalog/pg_namespace.h +++ b/src/include/catalog/pg_namespace.h @@ -51,6 +51,8 @@ CATALOG(pg_namespace,2615,NamespaceRelationId) */ typedef FormData_pg_namespace *Form_pg_namespace; +DECLARE_TOAST(pg_namespace, 4163, 4164); + /* * prototypes for functions in pg_namespace.c */ diff --git a/src/include/catalog/pg_partitioned_table.h b/src/include/catalog/pg_partitioned_table.h index 7ee0419373..cf92234d7e 100644 --- a/src/include/catalog/pg_partitioned_table.h +++ b/src/include/catalog/pg_partitioned_table.h @@ -64,4 +64,6 @@ CATALOG(pg_partitioned_table,3350,PartitionedRelationId) */ typedef FormData_pg_partitioned_table *Form_pg_partitioned_table; +DECLARE_TOAST(pg_partitioned_table, 4165, 4166); + #endif /* PG_PARTITIONED_TABLE_H */ diff --git a/src/include/catalog/pg_policy.h b/src/include/catalog/pg_policy.h index 97954cdc8a..22018acfd1 100644 --- a/src/include/catalog/pg_policy.h +++ b/src/include/catalog/pg_policy.h @@ -49,4 +49,6 @@ CATALOG(pg_policy,3256,PolicyRelationId) */ typedef FormData_pg_policy *Form_pg_policy; +DECLARE_TOAST(pg_policy, 4167, 4168); + #endif /* PG_POLICY_H */ diff --git a/src/include/catalog/pg_proc.h b/src/include/catalog/pg_proc.h index 268c810896..bcdef18c34 100644 --- a/src/include/catalog/pg_proc.h +++ b/src/include/catalog/pg_proc.h @@ -132,6 +132,8 @@ CATALOG(pg_proc,1255,ProcedureRelationId) BKI_BOOTSTRAP BKI_ROWTYPE_OID(81,Proce */ typedef FormData_pg_proc *Form_pg_proc; +DECLARE_TOAST(pg_proc, 2836, 2837); + #ifdef EXPOSE_TO_CLIENT_CODE /* diff --git a/src/include/catalog/pg_replication_origin.h b/src/include/catalog/pg_replication_origin.h index 7477ce49cc..fb07116ada 100644 --- a/src/include/catalog/pg_replication_origin.h +++ b/src/include/catalog/pg_replication_origin.h @@ -54,4 +54,8 @@ CATALOG(pg_replication_origin,6000,ReplicationOriginRelationId) BKI_SHARED_RELAT typedef FormData_pg_replication_origin *Form_pg_replication_origin; +DECLARE_TOAST(pg_replication_origin, 4181, 4182); +#define PgReplicationOriginToastTable 4181 +#define PgReplicationOriginToastIndex 4182 + #endif /* PG_REPLICATION_ORIGIN_H */ diff --git a/src/include/catalog/pg_rewrite.h b/src/include/catalog/pg_rewrite.h index 4369fc87c6..cba92d95cc 100644 --- a/src/include/catalog/pg_rewrite.h +++ b/src/include/catalog/pg_rewrite.h @@ -51,4 +51,6 @@ CATALOG(pg_rewrite,2618,RewriteRelationId) */ typedef FormData_pg_rewrite *Form_pg_rewrite; +DECLARE_TOAST(pg_rewrite, 2838, 2839); + #endif /* PG_REWRITE_H */ diff --git a/src/include/catalog/pg_seclabel.h b/src/include/catalog/pg_seclabel.h index 07d4bff119..b92118cb67 100644 --- a/src/include/catalog/pg_seclabel.h +++ b/src/include/catalog/pg_seclabel.h @@ -37,4 +37,6 @@ CATALOG(pg_seclabel,3596,SecLabelRelationId) #endif } FormData_pg_seclabel; +DECLARE_TOAST(pg_seclabel, 3598, 3599); + #endif /* PG_SECLABEL_H */ diff --git a/src/include/catalog/pg_shdescription.h b/src/include/catalog/pg_shdescription.h index a8238aa793..ba8f4f795b 100644 --- a/src/include/catalog/pg_shdescription.h +++ b/src/include/catalog/pg_shdescription.h @@ -55,4 +55,8 @@ CATALOG(pg_shdescription,2396,SharedDescriptionRelationId) BKI_SHARED_RELATION */ typedef FormData_pg_shdescription * Form_pg_shdescription; +DECLARE_TOAST(pg_shdescription, 2846, 2847); +#define PgShdescriptionToastTable 2846 +#define PgShdescriptionToastIndex 2847 + #endif /* PG_SHDESCRIPTION_H */ diff --git a/src/include/catalog/pg_shseclabel.h b/src/include/catalog/pg_shseclabel.h index 331e066448..7dae0d8b2a 100644 --- a/src/include/catalog/pg_shseclabel.h +++ b/src/include/catalog/pg_shseclabel.h @@ -38,4 +38,8 @@ CATALOG(pg_shseclabel,3592,SharedSecLabelRelationId) BKI_SHARED_RELATION BKI_ROW typedef FormData_pg_shseclabel * Form_pg_shseclabel; +DECLARE_TOAST(pg_shseclabel, 4060, 4061); +#define PgShseclabelToastTable 4060 +#define PgShseclabelToastIndex 4061 + #endif /* PG_SHSECLABEL_H */ diff --git a/src/include/catalog/pg_statistic.h b/src/include/catalog/pg_statistic.h index 40a7260165..262ab7be7f 100644 --- a/src/include/catalog/pg_statistic.h +++ b/src/include/catalog/pg_statistic.h @@ -133,6 +133,8 @@ CATALOG(pg_statistic,2619,StatisticRelationId) */ typedef FormData_pg_statistic *Form_pg_statistic; +DECLARE_TOAST(pg_statistic, 2840, 2841); + #ifdef EXPOSE_TO_CLIENT_CODE /* diff --git a/src/include/catalog/pg_statistic_ext.h b/src/include/catalog/pg_statistic_ext.h index 8747903fc7..346482b16f 100644 --- a/src/include/catalog/pg_statistic_ext.h +++ b/src/include/catalog/pg_statistic_ext.h @@ -63,6 +63,8 @@ CATALOG(pg_statistic_ext,3381,StatisticExtRelationId) */ typedef FormData_pg_statistic_ext *Form_pg_statistic_ext; +DECLARE_TOAST(pg_statistic_ext, 3439, 3440); + #ifdef EXPOSE_TO_CLIENT_CODE #define STATS_EXT_NDISTINCT 'd' diff --git a/src/include/catalog/pg_statistic_ext_data.h b/src/include/catalog/pg_statistic_ext_data.h index 0ef4ecb64a..a92ef85fb7 100644 --- a/src/include/catalog/pg_statistic_ext_data.h +++ b/src/include/catalog/pg_statistic_ext_data.h @@ -49,4 +49,6 @@ CATALOG(pg_statistic_ext_data,3429,StatisticExtDataRelationId) */ typedef FormData_pg_statistic_ext_data * Form_pg_statistic_ext_data; +DECLARE_TOAST(pg_statistic_ext_data, 3430, 3431); + #endif /* PG_STATISTIC_EXT_DATA_H */ diff --git a/src/include/catalog/pg_subscription.h b/src/include/catalog/pg_subscription.h index 9ebec7bf0b..c5fbc9e535 100644 --- a/src/include/catalog/pg_subscription.h +++ b/src/include/catalog/pg_subscription.h @@ -70,6 +70,10 @@ CATALOG(pg_subscription,6100,SubscriptionRelationId) BKI_SHARED_RELATION BKI_ROW typedef FormData_pg_subscription *Form_pg_subscription; +DECLARE_TOAST(pg_subscription, 4183, 4184); +#define PgSubscriptionToastTable 4183 +#define PgSubscriptionToastIndex 4184 + typedef struct Subscription { Oid oid; /* Oid of the subscription */ diff --git a/src/include/catalog/pg_tablespace.h b/src/include/catalog/pg_tablespace.h index 1daf2dd9c2..22f294ed6f 100644 --- a/src/include/catalog/pg_tablespace.h +++ b/src/include/catalog/pg_tablespace.h @@ -45,4 +45,8 @@ CATALOG(pg_tablespace,1213,TableSpaceRelationId) BKI_SHARED_RELATION */ typedef FormData_pg_tablespace *Form_pg_tablespace; +DECLARE_TOAST(pg_tablespace, 4185, 4186); +#define PgTablespaceToastTable 4185 +#define PgTablespaceToastIndex 4186 + #endif /* PG_TABLESPACE_H */ diff --git a/src/include/catalog/pg_trigger.h b/src/include/catalog/pg_trigger.h index fa5761b784..078fd0641c 100644 --- a/src/include/catalog/pg_trigger.h +++ b/src/include/catalog/pg_trigger.h @@ -72,6 +72,8 @@ CATALOG(pg_trigger,2620,TriggerRelationId) */ typedef FormData_pg_trigger *Form_pg_trigger; +DECLARE_TOAST(pg_trigger, 2336, 2337); + #ifdef EXPOSE_TO_CLIENT_CODE /* Bits within tgtype */ diff --git a/src/include/catalog/pg_ts_dict.h b/src/include/catalog/pg_ts_dict.h index 38128a313f..1b7cc30828 100644 --- a/src/include/catalog/pg_ts_dict.h +++ b/src/include/catalog/pg_ts_dict.h @@ -51,4 +51,6 @@ CATALOG(pg_ts_dict,3600,TSDictionaryRelationId) typedef FormData_pg_ts_dict *Form_pg_ts_dict; +DECLARE_TOAST(pg_ts_dict, 4169, 4170); + #endif /* PG_TS_DICT_H */ diff --git a/src/include/catalog/pg_type.h b/src/include/catalog/pg_type.h index 7b37562648..e71b49f8a0 100644 --- a/src/include/catalog/pg_type.h +++ b/src/include/catalog/pg_type.h @@ -254,6 +254,8 @@ CATALOG(pg_type,1247,TypeRelationId) BKI_BOOTSTRAP BKI_ROWTYPE_OID(71,TypeRelati */ typedef FormData_pg_type *Form_pg_type; +DECLARE_TOAST(pg_type, 4171, 4172); + #ifdef EXPOSE_TO_CLIENT_CODE /* diff --git a/src/include/catalog/pg_user_mapping.h b/src/include/catalog/pg_user_mapping.h index f5ccdb857a..65558e3333 100644 --- a/src/include/catalog/pg_user_mapping.h +++ b/src/include/catalog/pg_user_mapping.h @@ -45,4 +45,6 @@ CATALOG(pg_user_mapping,1418,UserMappingRelationId) */ typedef FormData_pg_user_mapping *Form_pg_user_mapping; +DECLARE_TOAST(pg_user_mapping, 4173, 4174); + #endif /* PG_USER_MAPPING_H */ diff --git a/src/include/catalog/renumber_oids.pl b/src/include/catalog/renumber_oids.pl index 690869d404..ee6409b57f 100755 --- a/src/include/catalog/renumber_oids.pl +++ b/src/include/catalog/renumber_oids.pl @@ -61,7 +61,7 @@ } # Collect all the existing assigned OIDs (including those to be remapped). -my @header_files = (glob("pg_*.h"), qw(indexing.h toasting.h)); +my @header_files = (glob("pg_*.h"), qw(indexing.h)); my $oids = Catalog::FindAllOidsFromHeaders(@header_files); # Hash-ify the existing OIDs for convenient lookup. @@ -173,7 +173,7 @@ } } - # In indexing.h and toasting.h only, check for #define SYM nnnn, + # In indexing.h only, check for #define SYM nnnn, # and replace if within mapped range. elsif ($line =~ m/^(\s*#\s*define\s+\w+\s+)(\d+)\b/) { diff --git a/src/include/catalog/toasting.h b/src/include/catalog/toasting.h index 51491c4513..a80c620c5b 100644 --- a/src/include/catalog/toasting.h +++ b/src/include/catalog/toasting.h @@ -3,9 +3,6 @@ * toasting.h * This file provides some definitions to support creation of toast tables * - * Caution: all #define's with numeric values in this file had better be - * object OIDs, else renumber_oids.pl might change them inappropriately. - * * * Portions Copyright (c) 1996-2020, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California @@ -30,76 +27,4 @@ extern void AlterTableCreateToastTable(Oid relOid, Datum reloptions, extern void BootstrapToastTable(char *relName, Oid toastOid, Oid toastIndexOid); - -/* - * This macro is just to keep the C compiler from spitting up on the - * upcoming commands for Catalog.pm. - */ -#define DECLARE_TOAST(name,toastoid,indexoid) extern int no_such_variable - - -/* - * What follows are lines processed by genbki.pl to create the statements - * the bootstrap parser will turn into BootstrapToastTable commands. - * Each line specifies the system catalog that needs a toast table, - * the OID to assign to the toast table, and the OID to assign to the - * toast table's index. The reason we hard-wire these OIDs is that we - * need stable OIDs for shared relations, and that includes toast tables - * of shared relations. - */ - -/* normal catalogs */ -DECLARE_TOAST(pg_aggregate, 4159, 4160); -DECLARE_TOAST(pg_attrdef, 2830, 2831); -DECLARE_TOAST(pg_collation, 4161, 4162); -DECLARE_TOAST(pg_constraint, 2832, 2833); -DECLARE_TOAST(pg_default_acl, 4143, 4144); -DECLARE_TOAST(pg_description, 2834, 2835); -DECLARE_TOAST(pg_event_trigger, 4145, 4146); -DECLARE_TOAST(pg_extension, 4147, 4148); -DECLARE_TOAST(pg_foreign_data_wrapper, 4149, 4150); -DECLARE_TOAST(pg_foreign_server, 4151, 4152); -DECLARE_TOAST(pg_foreign_table, 4153, 4154); -DECLARE_TOAST(pg_init_privs, 4155, 4156); -DECLARE_TOAST(pg_language, 4157, 4158); -DECLARE_TOAST(pg_namespace, 4163, 4164); -DECLARE_TOAST(pg_partitioned_table, 4165, 4166); -DECLARE_TOAST(pg_policy, 4167, 4168); -DECLARE_TOAST(pg_proc, 2836, 2837); -DECLARE_TOAST(pg_rewrite, 2838, 2839); -DECLARE_TOAST(pg_seclabel, 3598, 3599); -DECLARE_TOAST(pg_statistic, 2840, 2841); -DECLARE_TOAST(pg_statistic_ext, 3439, 3440); -DECLARE_TOAST(pg_statistic_ext_data, 3430, 3431); -DECLARE_TOAST(pg_trigger, 2336, 2337); -DECLARE_TOAST(pg_ts_dict, 4169, 4170); -DECLARE_TOAST(pg_type, 4171, 4172); -DECLARE_TOAST(pg_user_mapping, 4173, 4174); - -/* shared catalogs */ -DECLARE_TOAST(pg_authid, 4175, 4176); -#define PgAuthidToastTable 4175 -#define PgAuthidToastIndex 4176 -DECLARE_TOAST(pg_database, 4177, 4178); -#define PgDatabaseToastTable 4177 -#define PgDatabaseToastIndex 4178 -DECLARE_TOAST(pg_db_role_setting, 2966, 2967); -#define PgDbRoleSettingToastTable 2966 -#define PgDbRoleSettingToastIndex 2967 -DECLARE_TOAST(pg_replication_origin, 4181, 4182); -#define PgReplicationOriginToastTable 4181 -#define PgReplicationOriginToastIndex 4182 -DECLARE_TOAST(pg_shdescription, 2846, 2847); -#define PgShdescriptionToastTable 2846 -#define PgShdescriptionToastIndex 2847 -DECLARE_TOAST(pg_shseclabel, 4060, 4061); -#define PgShseclabelToastTable 4060 -#define PgShseclabelToastIndex 4061 -DECLARE_TOAST(pg_subscription, 4183, 4184); -#define PgSubscriptionToastTable 4183 -#define PgSubscriptionToastIndex 4184 -DECLARE_TOAST(pg_tablespace, 4185, 4186); -#define PgTablespaceToastTable 4185 -#define PgTablespaceToastIndex 4186 - #endif /* TOASTING_H */ diff --git a/src/include/catalog/unused_oids b/src/include/catalog/unused_oids index 83adbd5774..d120703f4a 100755 --- a/src/include/catalog/unused_oids +++ b/src/include/catalog/unused_oids @@ -28,7 +28,7 @@ chdir $FindBin::RealBin or die "could not cd to $FindBin::RealBin: $!\n"; use lib "$FindBin::RealBin/../../backend/catalog/"; use Catalog; -my @input_files = (glob("pg_*.h"), qw(indexing.h toasting.h)); +my @input_files = (glob("pg_*.h"), qw(indexing.h)); my $oids = Catalog::FindAllOidsFromHeaders(@input_files); diff --git a/src/tools/msvc/Solution.pm b/src/tools/msvc/Solution.pm index bc8904732f..fb738e90e1 100644 --- a/src/tools/msvc/Solution.pm +++ b/src/tools/msvc/Solution.pm @@ -762,7 +762,6 @@ EOF $mf =~ /^CATALOG_HEADERS\s*:?=(.*)$/gm || croak "Could not find CATALOG_HEADERS in Makefile\n"; my @bki_srcs = split /\s+/, $1; - push @bki_srcs, 'toasting.h'; push @bki_srcs, 'indexing.h'; $mf =~ /^POSTGRES_BKI_DATA\s*:?=[^,]+,(.*)\)$/gm || croak "Could not find POSTGRES_BKI_DATA in Makefile\n"; -- 2.28.0