Re: WIP: a way forward on bootstrap data - Mailing list pgsql-hackers
From | Tom Lane |
---|---|
Subject | Re: WIP: a way forward on bootstrap data |
Date | |
Msg-id | 14725.1522949021@sss.pgh.pa.us Whole thread Raw |
In response to | Re: WIP: a way forward on bootstrap data (Tom Lane <tgl@sss.pgh.pa.us>) |
Responses |
Re: WIP: a way forward on bootstrap data
Re: WIP: a way forward on bootstrap data Re: WIP: a way forward on bootstrap data |
List | pgsql-hackers |
I experimented with converting all frontend code to include just the catalog/pg_foo_d.h files instead of catalog/pg_foo.h, as per the proposed new policy. I soon found that we'd overlooked one thing: some clients expect to see the relation OID macros, eg LargeObjectRelationId. Attached is a patch that changes things around so that those appear in the _d files instead of the master files. This is cleaner anyway because it removes duplication of the OIDs in the master files, with attendant risk of error. For example we have this change in pg_aggregate.h: -#define AggregateRelationId 2600 - -CATALOG(pg_aggregate,2600) BKI_WITHOUT_OIDS +CATALOG(pg_aggregate,2600,AggregateRelationId) BKI_WITHOUT_OIDS Some of the CATALOG lines spill well past 80 characters with this, although many of the affected ones already were overlength, eg -#define DatabaseRelationId 1262 -#define DatabaseRelation_Rowtype_Id 1248 - -CATALOG(pg_database,1262) BKI_SHARED_RELATION BKI_ROWTYPE_OID(1248) BKI_SCHEMA_MACRO +CATALOG(pg_database,1262,DatabaseRelationId) BKI_SHARED_RELATION BKI_ROWTYPE_OID(1248,DatabaseRelation_Rowtype_Id) BKI_SCHEMA_MACRO I thought about improving that by removing the restriction that these BKI annotations appear on the same line as the CATALOG macro, so that we could break the above into several lines. I think the original key reason for the restriction was to avoid accidentally taking some bit of a DATA line as a BKI annotation. With the DATA lines gone from these files, that's no longer a significant hazard (although passing references to BKI keywords in comments might still be hazards for the Perl scripts). However, if we try to format things like CATALOG(pg_database,1262,DatabaseRelationId) BKI_SHARED_RELATION BKI_ROWTYPE_OID(1248,DatabaseRelation_Rowtype_Id) BKI_SCHEMA_MACRO { fields... } I'm afraid that neither pgindent nor a lot of common editors would indent that very nicely. So at least for the moment I'm inclined to just keep it all on one line ... we know how that behaves, anyway. regards, tom lane diff --git a/src/backend/catalog/Catalog.pm b/src/backend/catalog/Catalog.pm index 519247e..fb3d62a 100644 --- a/src/backend/catalog/Catalog.pm +++ b/src/backend/catalog/Catalog.pm @@ -104,18 +104,29 @@ sub ParseHeader { push @{ $catalog{indexing} }, "build indices\n"; } - elsif (/^CATALOG\(([^,]*),(\d+)\)/) + elsif (/^CATALOG\(([^,]*),(\d+),(\w+)\)/) { $catalog{catname} = $1; $catalog{relation_oid} = $2; + $catalog{relation_oid_macro} = $3; $catalog{bootstrap} = /BKI_BOOTSTRAP/ ? ' bootstrap' : ''; $catalog{shared_relation} = /BKI_SHARED_RELATION/ ? ' shared_relation' : ''; $catalog{without_oids} = /BKI_WITHOUT_OIDS/ ? ' without_oids' : ''; - $catalog{rowtype_oid} = - /BKI_ROWTYPE_OID\((\d+)\)/ ? " rowtype_oid $1" : ''; + if (/BKI_ROWTYPE_OID\((\d+),(\w+)\)/) + { + $catalog{rowtype_oid} = $1; + $catalog{rowtype_oid_clause} = " rowtype_oid $1"; + $catalog{rowtype_oid_macro} = $2; + } + else + { + $catalog{rowtype_oid} = ''; + $catalog{rowtype_oid_clause} = ''; + $catalog{rowtype_oid_macro} = ''; + } $catalog{schema_macro} = /BKI_SCHEMA_MACRO/ ? 1 : 0; $declaring_attributes = 1; } diff --git a/src/backend/catalog/genbki.pl b/src/backend/catalog/genbki.pl index f6be50a..fe8c3ca 100644 --- a/src/backend/catalog/genbki.pl +++ b/src/backend/catalog/genbki.pl @@ -228,6 +228,7 @@ my @tables_needing_macros; # produce output, one catalog at a time foreach my $catname (@catnames) { + my $catalog = $catalogs{$catname}; # Create one definition header with macro definitions for each catalog. my $def_file = $output_path . $catname . '_d.h'; @@ -258,13 +259,21 @@ foreach my $catname (@catnames) EOM + # Emit OID macros for catalog's OID and rowtype OID, if wanted + print $def + sprintf("#define %s %s\n", $catalog->{relation_oid_macro}, $catalog->{relation_oid}) + if $catalog->{relation_oid_macro} ne ''; + print $def + sprintf("#define %s %s\n", $catalog->{rowtype_oid_macro}, $catalog->{rowtype_oid}) + if $catalog->{rowtype_oid_macro} ne ''; + print $def "\n"; + # .bki CREATE command for this catalog - my $catalog = $catalogs{$catname}; print $bki "create $catname $catalog->{relation_oid}" . $catalog->{shared_relation} . $catalog->{bootstrap} . $catalog->{without_oids} - . $catalog->{rowtype_oid} . "\n"; + . $catalog->{rowtype_oid_clause} . "\n"; my $first = 1; diff --git a/src/include/catalog/duplicate_oids b/src/include/catalog/duplicate_oids index 9732f61..0e6285f 100755 --- a/src/include/catalog/duplicate_oids +++ b/src/include/catalog/duplicate_oids @@ -15,7 +15,7 @@ while (<>) next if /^CATALOG\(.*BKI_BOOTSTRAP/; next unless /\boid *=> *'(\d+)'/ - || /^CATALOG\([^,]*, *(\d+).*BKI_ROWTYPE_OID\((\d+)\)/ + || /^CATALOG\([^,]*, *(\d+).*BKI_ROWTYPE_OID\((\d+),/ || /^CATALOG\([^,]*, *(\d+)/ || /^DECLARE_INDEX\([^,]*, *(\d+)/ || /^DECLARE_UNIQUE_INDEX\([^,]*, *(\d+)/ diff --git a/src/include/catalog/genbki.h b/src/include/catalog/genbki.h index af064fc..02c38c4 100644 --- a/src/include/catalog/genbki.h +++ b/src/include/catalog/genbki.h @@ -20,13 +20,13 @@ #define GENBKI_H /* Introduces a catalog's structure definition */ -#define CATALOG(name,oid) typedef struct CppConcat(FormData_,name) +#define CATALOG(name,oid,oidmacro) typedef struct CppConcat(FormData_,name) /* Options that may appear after CATALOG (on the same line) */ #define BKI_BOOTSTRAP #define BKI_SHARED_RELATION #define BKI_WITHOUT_OIDS -#define BKI_ROWTYPE_OID(oid) +#define BKI_ROWTYPE_OID(oid,oidmacro) #define BKI_SCHEMA_MACRO /* Options that may appear after an attribute (on the same line) */ @@ -34,7 +34,7 @@ #define BKI_FORCE_NOT_NULL /* Specifies a default value for a catalog field */ #define BKI_DEFAULT(value) -/* Indicates where to perform lookups for OID macros */ +/* Indicates how to perform name lookups for OID fields */ #define BKI_LOOKUP(catalog) /* 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 767bab5..4d0ec01 100644 --- a/src/include/catalog/pg_aggregate.h +++ b/src/include/catalog/pg_aggregate.h @@ -26,9 +26,7 @@ * cpp turns this into typedef struct FormData_pg_aggregate * ---------------------------------------------------------------- */ -#define AggregateRelationId 2600 - -CATALOG(pg_aggregate,2600) BKI_WITHOUT_OIDS +CATALOG(pg_aggregate,2600,AggregateRelationId) BKI_WITHOUT_OIDS { /* pg_proc OID of the aggregate itself */ regproc aggfnoid BKI_LOOKUP(pg_proc); diff --git a/src/include/catalog/pg_am.h b/src/include/catalog/pg_am.h index d6454c5..5aa2bac 100644 --- a/src/include/catalog/pg_am.h +++ b/src/include/catalog/pg_am.h @@ -26,9 +26,7 @@ * typedef struct FormData_pg_am * ---------------- */ -#define AccessMethodRelationId 2601 - -CATALOG(pg_am,2601) +CATALOG(pg_am,2601,AccessMethodRelationId) { /* access method name */ NameData amname; diff --git a/src/include/catalog/pg_amop.h b/src/include/catalog/pg_amop.h index 59842a6..a481691 100644 --- a/src/include/catalog/pg_amop.h +++ b/src/include/catalog/pg_amop.h @@ -51,9 +51,7 @@ * typedef struct FormData_pg_amop * ---------------- */ -#define AccessMethodOperatorRelationId 2602 - -CATALOG(pg_amop,2602) +CATALOG(pg_amop,2602,AccessMethodOperatorRelationId) { /* the index opfamily this entry is for */ Oid amopfamily BKI_LOOKUP(pg_opfamily); diff --git a/src/include/catalog/pg_amproc.h b/src/include/catalog/pg_amproc.h index accbe83..d638e0c 100644 --- a/src/include/catalog/pg_amproc.h +++ b/src/include/catalog/pg_amproc.h @@ -40,9 +40,7 @@ * typedef struct FormData_pg_amproc * ---------------- */ -#define AccessMethodProcedureRelationId 2603 - -CATALOG(pg_amproc,2603) +CATALOG(pg_amproc,2603,AccessMethodProcedureRelationId) { /* the index opfamily this entry is for */ Oid amprocfamily BKI_LOOKUP(pg_opfamily); diff --git a/src/include/catalog/pg_attrdef.h b/src/include/catalog/pg_attrdef.h index 068ab64..16b106d 100644 --- a/src/include/catalog/pg_attrdef.h +++ b/src/include/catalog/pg_attrdef.h @@ -26,9 +26,7 @@ * typedef struct FormData_pg_attrdef * ---------------- */ -#define AttrDefaultRelationId 2604 - -CATALOG(pg_attrdef,2604) +CATALOG(pg_attrdef,2604,AttrDefaultRelationId) { Oid adrelid; /* OID of table containing attribute */ int16 adnum; /* attnum of attribute */ diff --git a/src/include/catalog/pg_attribute.h b/src/include/catalog/pg_attribute.h index 1b3f306..69b651a 100644 --- a/src/include/catalog/pg_attribute.h +++ b/src/include/catalog/pg_attribute.h @@ -34,10 +34,7 @@ * You may need to change catalog/genbki.pl as well. * ---------------- */ -#define AttributeRelationId 1249 -#define AttributeRelation_Rowtype_Id 75 - -CATALOG(pg_attribute,1249) BKI_BOOTSTRAP BKI_WITHOUT_OIDS BKI_ROWTYPE_OID(75) BKI_SCHEMA_MACRO +CATALOG(pg_attribute,1249,AttributeRelationId) BKI_BOOTSTRAP BKI_WITHOUT_OIDS BKI_ROWTYPE_OID(75,AttributeRelation_Rowtype_Id)BKI_SCHEMA_MACRO { Oid attrelid; /* OID of relation containing this attribute */ NameData attname; /* name of attribute */ diff --git a/src/include/catalog/pg_auth_members.h b/src/include/catalog/pg_auth_members.h index b8ac653..75bc2ba 100644 --- a/src/include/catalog/pg_auth_members.h +++ b/src/include/catalog/pg_auth_members.h @@ -27,10 +27,7 @@ * typedef struct FormData_pg_auth_members * ---------------- */ -#define AuthMemRelationId 1261 -#define AuthMemRelation_Rowtype_Id 2843 - -CATALOG(pg_auth_members,1261) BKI_SHARED_RELATION BKI_WITHOUT_OIDS BKI_ROWTYPE_OID(2843) BKI_SCHEMA_MACRO +CATALOG(pg_auth_members,1261,AuthMemRelationId) BKI_SHARED_RELATION BKI_WITHOUT_OIDS BKI_ROWTYPE_OID(2843,AuthMemRelation_Rowtype_Id)BKI_SCHEMA_MACRO { Oid roleid; /* ID of a role */ Oid member; /* ID of a member of that role */ diff --git a/src/include/catalog/pg_authid.h b/src/include/catalog/pg_authid.h index f27906f..863ef65 100644 --- a/src/include/catalog/pg_authid.h +++ b/src/include/catalog/pg_authid.h @@ -28,10 +28,7 @@ * typedef struct FormData_pg_authid * ---------------- */ -#define AuthIdRelationId 1260 -#define AuthIdRelation_Rowtype_Id 2842 - -CATALOG(pg_authid,1260) BKI_SHARED_RELATION BKI_ROWTYPE_OID(2842) BKI_SCHEMA_MACRO +CATALOG(pg_authid,1260,AuthIdRelationId) BKI_SHARED_RELATION BKI_ROWTYPE_OID(2842,AuthIdRelation_Rowtype_Id) BKI_SCHEMA_MACRO { NameData rolname; /* name of role */ bool rolsuper; /* read this field via superuser() only! */ diff --git a/src/include/catalog/pg_cast.h b/src/include/catalog/pg_cast.h index 8a5b7f9..a9e7e2b 100644 --- a/src/include/catalog/pg_cast.h +++ b/src/include/catalog/pg_cast.h @@ -28,9 +28,7 @@ * typedef struct FormData_pg_cast * ---------------- */ -#define CastRelationId 2605 - -CATALOG(pg_cast,2605) +CATALOG(pg_cast,2605,CastRelationId) { /* source datatype for cast */ Oid castsource BKI_LOOKUP(pg_type); diff --git a/src/include/catalog/pg_class.h b/src/include/catalog/pg_class.h index 914aa63..28d939d 100644 --- a/src/include/catalog/pg_class.h +++ b/src/include/catalog/pg_class.h @@ -26,10 +26,7 @@ * typedef struct FormData_pg_class * ---------------- */ -#define RelationRelationId 1259 -#define RelationRelation_Rowtype_Id 83 - -CATALOG(pg_class,1259) BKI_BOOTSTRAP BKI_ROWTYPE_OID(83) BKI_SCHEMA_MACRO +CATALOG(pg_class,1259,RelationRelationId) BKI_BOOTSTRAP BKI_ROWTYPE_OID(83,RelationRelation_Rowtype_Id) BKI_SCHEMA_MACRO { NameData relname; /* class name */ Oid relnamespace; /* OID of namespace containing this class */ diff --git a/src/include/catalog/pg_collation.h b/src/include/catalog/pg_collation.h index 0c6d47f..9c643cf 100644 --- a/src/include/catalog/pg_collation.h +++ b/src/include/catalog/pg_collation.h @@ -27,9 +27,7 @@ * typedef struct FormData_pg_collation * ---------------- */ -#define CollationRelationId 3456 - -CATALOG(pg_collation,3456) +CATALOG(pg_collation,3456,CollationRelationId) { NameData collname; /* collation name */ Oid collnamespace; /* OID of namespace containing collation */ diff --git a/src/include/catalog/pg_constraint.h b/src/include/catalog/pg_constraint.h index 2024c45..e1ef9cc 100644 --- a/src/include/catalog/pg_constraint.h +++ b/src/include/catalog/pg_constraint.h @@ -26,9 +26,7 @@ * typedef struct FormData_pg_constraint * ---------------- */ -#define ConstraintRelationId 2606 - -CATALOG(pg_constraint,2606) +CATALOG(pg_constraint,2606,ConstraintRelationId) { /* * conname + connamespace is deliberately not unique; we allow, for diff --git a/src/include/catalog/pg_conversion.h b/src/include/catalog/pg_conversion.h index eacc09a..2a38d71 100644 --- a/src/include/catalog/pg_conversion.h +++ b/src/include/catalog/pg_conversion.h @@ -35,9 +35,7 @@ * condefault true if this is a default conversion * ---------------------------------------------------------------- */ -#define ConversionRelationId 2607 - -CATALOG(pg_conversion,2607) +CATALOG(pg_conversion,2607,ConversionRelationId) { NameData conname; Oid connamespace; diff --git a/src/include/catalog/pg_database.h b/src/include/catalog/pg_database.h index 9435f24..7f03d24 100644 --- a/src/include/catalog/pg_database.h +++ b/src/include/catalog/pg_database.h @@ -26,10 +26,7 @@ * typedef struct FormData_pg_database * ---------------- */ -#define DatabaseRelationId 1262 -#define DatabaseRelation_Rowtype_Id 1248 - -CATALOG(pg_database,1262) BKI_SHARED_RELATION BKI_ROWTYPE_OID(1248) BKI_SCHEMA_MACRO +CATALOG(pg_database,1262,DatabaseRelationId) BKI_SHARED_RELATION BKI_ROWTYPE_OID(1248,DatabaseRelation_Rowtype_Id) BKI_SCHEMA_MACRO { NameData datname; /* database name */ Oid datdba; /* owner of database */ diff --git a/src/include/catalog/pg_db_role_setting.h b/src/include/catalog/pg_db_role_setting.h index 9793c69..cccb28a 100644 --- a/src/include/catalog/pg_db_role_setting.h +++ b/src/include/catalog/pg_db_role_setting.h @@ -29,9 +29,7 @@ * typedef struct FormData_pg_db_role_setting * ---------------- */ -#define DbRoleSettingRelationId 2964 - -CATALOG(pg_db_role_setting,2964) BKI_SHARED_RELATION BKI_WITHOUT_OIDS +CATALOG(pg_db_role_setting,2964,DbRoleSettingRelationId) BKI_SHARED_RELATION BKI_WITHOUT_OIDS { Oid setdatabase; /* database */ Oid setrole; /* role */ diff --git a/src/include/catalog/pg_default_acl.h b/src/include/catalog/pg_default_acl.h index 868ac0c..ac81df1 100644 --- a/src/include/catalog/pg_default_acl.h +++ b/src/include/catalog/pg_default_acl.h @@ -26,9 +26,7 @@ * typedef struct FormData_pg_default_acl * ---------------- */ -#define DefaultAclRelationId 826 - -CATALOG(pg_default_acl,826) +CATALOG(pg_default_acl,826,DefaultAclRelationId) { Oid defaclrole; /* OID of role owning this ACL */ Oid defaclnamespace; /* OID of namespace, or 0 for all */ diff --git a/src/include/catalog/pg_depend.h b/src/include/catalog/pg_depend.h index 030f655..bf31c1a 100644 --- a/src/include/catalog/pg_depend.h +++ b/src/include/catalog/pg_depend.h @@ -38,9 +38,7 @@ * typedef struct FormData_pg_depend * ---------------- */ -#define DependRelationId 2608 - -CATALOG(pg_depend,2608) BKI_WITHOUT_OIDS +CATALOG(pg_depend,2608,DependRelationId) BKI_WITHOUT_OIDS { /* * Identification of the dependent (referencing) object. diff --git a/src/include/catalog/pg_description.h b/src/include/catalog/pg_description.h index d3c8644..b95b188 100644 --- a/src/include/catalog/pg_description.h +++ b/src/include/catalog/pg_description.h @@ -45,9 +45,7 @@ * typedef struct FormData_pg_description * ---------------- */ -#define DescriptionRelationId 2609 - -CATALOG(pg_description,2609) BKI_WITHOUT_OIDS +CATALOG(pg_description,2609,DescriptionRelationId) BKI_WITHOUT_OIDS { Oid objoid; /* OID of object itself */ Oid classoid; /* OID of table containing object */ diff --git a/src/include/catalog/pg_enum.h b/src/include/catalog/pg_enum.h index edea5e3..a0922be 100644 --- a/src/include/catalog/pg_enum.h +++ b/src/include/catalog/pg_enum.h @@ -26,9 +26,7 @@ * typedef struct FormData_pg_enum * ---------------- */ -#define EnumRelationId 3501 - -CATALOG(pg_enum,3501) +CATALOG(pg_enum,3501,EnumRelationId) { Oid enumtypid; /* OID of owning enum type */ float4 enumsortorder; /* sort position of this enum value */ diff --git a/src/include/catalog/pg_event_trigger.h b/src/include/catalog/pg_event_trigger.h index 3ca0a88..f06cbe0 100644 --- a/src/include/catalog/pg_event_trigger.h +++ b/src/include/catalog/pg_event_trigger.h @@ -26,9 +26,7 @@ * typedef struct FormData_pg_event_trigger * ---------------- */ -#define EventTriggerRelationId 3466 - -CATALOG(pg_event_trigger,3466) +CATALOG(pg_event_trigger,3466,EventTriggerRelationId) { NameData evtname; /* trigger's name */ NameData evtevent; /* trigger's event */ diff --git a/src/include/catalog/pg_extension.h b/src/include/catalog/pg_extension.h index a60bd44..10bbb69 100644 --- a/src/include/catalog/pg_extension.h +++ b/src/include/catalog/pg_extension.h @@ -26,9 +26,7 @@ * typedef struct FormData_pg_extension * ---------------- */ -#define ExtensionRelationId 3079 - -CATALOG(pg_extension,3079) +CATALOG(pg_extension,3079,ExtensionRelationId) { NameData extname; /* extension name */ Oid extowner; /* extension owner */ diff --git a/src/include/catalog/pg_foreign_data_wrapper.h b/src/include/catalog/pg_foreign_data_wrapper.h index ae9b0be..67e3319 100644 --- a/src/include/catalog/pg_foreign_data_wrapper.h +++ b/src/include/catalog/pg_foreign_data_wrapper.h @@ -26,9 +26,7 @@ * typedef struct FormData_pg_foreign_data_wrapper * ---------------- */ -#define ForeignDataWrapperRelationId 2328 - -CATALOG(pg_foreign_data_wrapper,2328) +CATALOG(pg_foreign_data_wrapper,2328,ForeignDataWrapperRelationId) { NameData fdwname; /* foreign-data wrapper name */ Oid fdwowner; /* FDW owner */ diff --git a/src/include/catalog/pg_foreign_server.h b/src/include/catalog/pg_foreign_server.h index 34fc827..0d25839 100644 --- a/src/include/catalog/pg_foreign_server.h +++ b/src/include/catalog/pg_foreign_server.h @@ -25,9 +25,7 @@ * typedef struct FormData_pg_foreign_server * ---------------- */ -#define ForeignServerRelationId 1417 - -CATALOG(pg_foreign_server,1417) +CATALOG(pg_foreign_server,1417,ForeignServerRelationId) { NameData srvname; /* foreign server name */ Oid srvowner; /* server owner */ diff --git a/src/include/catalog/pg_foreign_table.h b/src/include/catalog/pg_foreign_table.h index 1a1fefc..13de918 100644 --- a/src/include/catalog/pg_foreign_table.h +++ b/src/include/catalog/pg_foreign_table.h @@ -25,9 +25,7 @@ * typedef struct FormData_pg_foreign_table * ---------------- */ -#define ForeignTableRelationId 3118 - -CATALOG(pg_foreign_table,3118) BKI_WITHOUT_OIDS +CATALOG(pg_foreign_table,3118,ForeignTableRelationId) BKI_WITHOUT_OIDS { Oid ftrelid; /* OID of foreign table */ Oid ftserver; /* OID of foreign server */ diff --git a/src/include/catalog/pg_index.h b/src/include/catalog/pg_index.h index ecae0db..b70ad73 100644 --- a/src/include/catalog/pg_index.h +++ b/src/include/catalog/pg_index.h @@ -26,9 +26,7 @@ * typedef struct FormData_pg_index. * ---------------- */ -#define IndexRelationId 2610 - -CATALOG(pg_index,2610) BKI_WITHOUT_OIDS BKI_SCHEMA_MACRO +CATALOG(pg_index,2610,IndexRelationId) BKI_WITHOUT_OIDS BKI_SCHEMA_MACRO { Oid indexrelid; /* OID of the index */ Oid indrelid; /* OID of the relation it indexes */ diff --git a/src/include/catalog/pg_inherits.h b/src/include/catalog/pg_inherits.h index 478a587..3b2e03c 100644 --- a/src/include/catalog/pg_inherits.h +++ b/src/include/catalog/pg_inherits.h @@ -26,9 +26,7 @@ * typedef struct FormData_pg_inherits * ---------------- */ -#define InheritsRelationId 2611 - -CATALOG(pg_inherits,2611) BKI_WITHOUT_OIDS +CATALOG(pg_inherits,2611,InheritsRelationId) BKI_WITHOUT_OIDS { Oid inhrelid; Oid inhparent; diff --git a/src/include/catalog/pg_init_privs.h b/src/include/catalog/pg_init_privs.h index 7dcb70c..6ce2646 100644 --- a/src/include/catalog/pg_init_privs.h +++ b/src/include/catalog/pg_init_privs.h @@ -43,9 +43,7 @@ * typedef struct FormData_pg_init_privs * ---------------- */ -#define InitPrivsRelationId 3394 - -CATALOG(pg_init_privs,3394) BKI_WITHOUT_OIDS +CATALOG(pg_init_privs,3394,InitPrivsRelationId) BKI_WITHOUT_OIDS { Oid objoid; /* OID of object itself */ Oid classoid; /* OID of table containing object */ diff --git a/src/include/catalog/pg_language.h b/src/include/catalog/pg_language.h index d2d878c..e2d8d15 100644 --- a/src/include/catalog/pg_language.h +++ b/src/include/catalog/pg_language.h @@ -26,9 +26,7 @@ * typedef struct FormData_pg_language * ---------------- */ -#define LanguageRelationId 2612 - -CATALOG(pg_language,2612) +CATALOG(pg_language,2612,LanguageRelationId) { NameData lanname; /* Language name */ Oid lanowner; /* Language's owner */ diff --git a/src/include/catalog/pg_largeobject.h b/src/include/catalog/pg_largeobject.h index 2157bab..07adca0 100644 --- a/src/include/catalog/pg_largeobject.h +++ b/src/include/catalog/pg_largeobject.h @@ -24,9 +24,7 @@ * typedef struct FormData_pg_largeobject * ---------------- */ -#define LargeObjectRelationId 2613 - -CATALOG(pg_largeobject,2613) BKI_WITHOUT_OIDS +CATALOG(pg_largeobject,2613,LargeObjectRelationId) BKI_WITHOUT_OIDS { Oid loid; /* Identifier of large object */ int32 pageno; /* Page number (starting from 0) */ diff --git a/src/include/catalog/pg_largeobject_metadata.h b/src/include/catalog/pg_largeobject_metadata.h index 3d5e0cd..a8732bc 100644 --- a/src/include/catalog/pg_largeobject_metadata.h +++ b/src/include/catalog/pg_largeobject_metadata.h @@ -26,9 +26,7 @@ * typedef struct FormData_pg_largeobject_metadata * ---------------- */ -#define LargeObjectMetadataRelationId 2995 - -CATALOG(pg_largeobject_metadata,2995) +CATALOG(pg_largeobject_metadata,2995,LargeObjectMetadataRelationId) { Oid lomowner; /* OID of the largeobject owner */ diff --git a/src/include/catalog/pg_namespace.h b/src/include/catalog/pg_namespace.h index 5f80e86..0d9cada 100644 --- a/src/include/catalog/pg_namespace.h +++ b/src/include/catalog/pg_namespace.h @@ -31,9 +31,7 @@ * nspacl access privilege list * ---------------------------------------------------------------- */ -#define NamespaceRelationId 2615 - -CATALOG(pg_namespace,2615) +CATALOG(pg_namespace,2615,NamespaceRelationId) { NameData nspname; Oid nspowner; diff --git a/src/include/catalog/pg_opclass.h b/src/include/catalog/pg_opclass.h index 1b20d0d..16c3875 100644 --- a/src/include/catalog/pg_opclass.h +++ b/src/include/catalog/pg_opclass.h @@ -46,9 +46,7 @@ * typedef struct FormData_pg_opclass * ---------------- */ -#define OperatorClassRelationId 2616 - -CATALOG(pg_opclass,2616) +CATALOG(pg_opclass,2616,OperatorClassRelationId) { /* index access method opclass is for */ Oid opcmethod BKI_LOOKUP(pg_am); diff --git a/src/include/catalog/pg_operator.h b/src/include/catalog/pg_operator.h index 9c829d0..4950d28 100644 --- a/src/include/catalog/pg_operator.h +++ b/src/include/catalog/pg_operator.h @@ -26,9 +26,7 @@ * typedef struct FormData_pg_operator * ---------------- */ -#define OperatorRelationId 2617 - -CATALOG(pg_operator,2617) +CATALOG(pg_operator,2617,OperatorRelationId) { /* name of operator */ NameData oprname; diff --git a/src/include/catalog/pg_opfamily.h b/src/include/catalog/pg_opfamily.h index 598e546..4bedc9a 100644 --- a/src/include/catalog/pg_opfamily.h +++ b/src/include/catalog/pg_opfamily.h @@ -26,9 +26,7 @@ * typedef struct FormData_pg_opfamily * ---------------- */ -#define OperatorFamilyRelationId 2753 - -CATALOG(pg_opfamily,2753) +CATALOG(pg_opfamily,2753,OperatorFamilyRelationId) { /* index access method opfamily is for */ Oid opfmethod BKI_LOOKUP(pg_am); diff --git a/src/include/catalog/pg_partitioned_table.h b/src/include/catalog/pg_partitioned_table.h index 39ee67e..676532a 100644 --- a/src/include/catalog/pg_partitioned_table.h +++ b/src/include/catalog/pg_partitioned_table.h @@ -25,9 +25,7 @@ * typedef struct FormData_pg_partitioned_table * ---------------- */ -#define PartitionedRelationId 3350 - -CATALOG(pg_partitioned_table,3350) BKI_WITHOUT_OIDS +CATALOG(pg_partitioned_table,3350,PartitionedRelationId) BKI_WITHOUT_OIDS { Oid partrelid; /* partitioned table oid */ char partstrat; /* partitioning strategy */ diff --git a/src/include/catalog/pg_pltemplate.h b/src/include/catalog/pg_pltemplate.h index 116a4a0..d84c86b 100644 --- a/src/include/catalog/pg_pltemplate.h +++ b/src/include/catalog/pg_pltemplate.h @@ -26,9 +26,7 @@ * typedef struct FormData_pg_pltemplate * ---------------- */ -#define PLTemplateRelationId 1136 - -CATALOG(pg_pltemplate,1136) BKI_SHARED_RELATION BKI_WITHOUT_OIDS +CATALOG(pg_pltemplate,1136,PLTemplateRelationId) BKI_SHARED_RELATION BKI_WITHOUT_OIDS { NameData tmplname; /* name of PL */ bool tmpltrusted; /* PL is trusted? */ diff --git a/src/include/catalog/pg_policy.h b/src/include/catalog/pg_policy.h index 543077c..7ad0cde 100644 --- a/src/include/catalog/pg_policy.h +++ b/src/include/catalog/pg_policy.h @@ -20,9 +20,7 @@ * typedef struct FormData_pg_policy * ---------------- */ -#define PolicyRelationId 3256 - -CATALOG(pg_policy,3256) +CATALOG(pg_policy,3256,PolicyRelationId) { NameData polname; /* Policy name. */ Oid polrelid; /* Oid of the relation with policy. */ diff --git a/src/include/catalog/pg_proc.h b/src/include/catalog/pg_proc.h index b9d9cfd..fd0b909 100644 --- a/src/include/catalog/pg_proc.h +++ b/src/include/catalog/pg_proc.h @@ -25,10 +25,7 @@ * typedef struct FormData_pg_proc * ---------------- */ -#define ProcedureRelationId 1255 -#define ProcedureRelation_Rowtype_Id 81 - -CATALOG(pg_proc,1255) BKI_BOOTSTRAP BKI_ROWTYPE_OID(81) BKI_SCHEMA_MACRO +CATALOG(pg_proc,1255,ProcedureRelationId) BKI_BOOTSTRAP BKI_ROWTYPE_OID(81,ProcedureRelation_Rowtype_Id) BKI_SCHEMA_MACRO { /* procedure name */ NameData proname; diff --git a/src/include/catalog/pg_publication.h b/src/include/catalog/pg_publication.h index 92cdcf1..9a6a64d 100644 --- a/src/include/catalog/pg_publication.h +++ b/src/include/catalog/pg_publication.h @@ -26,9 +26,7 @@ * typedef struct FormData_pg_publication * ---------------- */ -#define PublicationRelationId 6104 - -CATALOG(pg_publication,6104) +CATALOG(pg_publication,6104,PublicationRelationId) { NameData pubname; /* name of the publication */ diff --git a/src/include/catalog/pg_publication_rel.h b/src/include/catalog/pg_publication_rel.h index 864d6ca..2208e42 100644 --- a/src/include/catalog/pg_publication_rel.h +++ b/src/include/catalog/pg_publication_rel.h @@ -25,9 +25,7 @@ * typedef struct FormData_pg_publication_rel * ---------------- */ -#define PublicationRelRelationId 6106 - -CATALOG(pg_publication_rel,6106) +CATALOG(pg_publication_rel,6106,PublicationRelRelationId) { Oid prpubid; /* Oid of the publication */ Oid prrelid; /* Oid of the relation */ diff --git a/src/include/catalog/pg_range.h b/src/include/catalog/pg_range.h index d507e4e..3762b3e 100644 --- a/src/include/catalog/pg_range.h +++ b/src/include/catalog/pg_range.h @@ -26,9 +26,7 @@ * typedef struct FormData_pg_range * ---------------- */ -#define RangeRelationId 3541 - -CATALOG(pg_range,3541) BKI_WITHOUT_OIDS +CATALOG(pg_range,3541,RangeRelationId) BKI_WITHOUT_OIDS { /* OID of owning range type */ Oid rngtypid BKI_LOOKUP(pg_type); diff --git a/src/include/catalog/pg_replication_origin.h b/src/include/catalog/pg_replication_origin.h index 02856dd..1adc3f7 100644 --- a/src/include/catalog/pg_replication_origin.h +++ b/src/include/catalog/pg_replication_origin.h @@ -26,9 +26,7 @@ * typedef struct FormData_pg_replication_origin * ---------------- */ -#define ReplicationOriginRelationId 6000 - -CATALOG(pg_replication_origin,6000) BKI_SHARED_RELATION BKI_WITHOUT_OIDS +CATALOG(pg_replication_origin,6000,ReplicationOriginRelationId) BKI_SHARED_RELATION BKI_WITHOUT_OIDS { /* * Locally known id that get included into WAL. diff --git a/src/include/catalog/pg_rewrite.h b/src/include/catalog/pg_rewrite.h index d656990..7712586 100644 --- a/src/include/catalog/pg_rewrite.h +++ b/src/include/catalog/pg_rewrite.h @@ -29,9 +29,7 @@ * typedef struct FormData_pg_rewrite * ---------------- */ -#define RewriteRelationId 2618 - -CATALOG(pg_rewrite,2618) +CATALOG(pg_rewrite,2618,RewriteRelationId) { NameData rulename; Oid ev_class; diff --git a/src/include/catalog/pg_seclabel.h b/src/include/catalog/pg_seclabel.h index d6d2f97..48d4548 100644 --- a/src/include/catalog/pg_seclabel.h +++ b/src/include/catalog/pg_seclabel.h @@ -19,9 +19,7 @@ * typedef struct FormData_pg_seclabel * ---------------- */ -#define SecLabelRelationId 3596 - -CATALOG(pg_seclabel,3596) BKI_WITHOUT_OIDS +CATALOG(pg_seclabel,3596,SecLabelRelationId) BKI_WITHOUT_OIDS { Oid objoid; /* OID of the object itself */ Oid classoid; /* OID of table containing the object */ diff --git a/src/include/catalog/pg_sequence.h b/src/include/catalog/pg_sequence.h index de6ed1a..a13b05e 100644 --- a/src/include/catalog/pg_sequence.h +++ b/src/include/catalog/pg_sequence.h @@ -14,9 +14,7 @@ #include "catalog/genbki.h" #include "catalog/pg_sequence_d.h" -#define SequenceRelationId 2224 - -CATALOG(pg_sequence,2224) BKI_WITHOUT_OIDS +CATALOG(pg_sequence,2224,SequenceRelationId) BKI_WITHOUT_OIDS { Oid seqrelid; Oid seqtypid; diff --git a/src/include/catalog/pg_shdepend.h b/src/include/catalog/pg_shdepend.h index 708980b..9f4dcb9 100644 --- a/src/include/catalog/pg_shdepend.h +++ b/src/include/catalog/pg_shdepend.h @@ -35,9 +35,7 @@ * typedef struct FormData_pg_shdepend * ---------------- */ -#define SharedDependRelationId 1214 - -CATALOG(pg_shdepend,1214) BKI_SHARED_RELATION BKI_WITHOUT_OIDS +CATALOG(pg_shdepend,1214,SharedDependRelationId) BKI_SHARED_RELATION BKI_WITHOUT_OIDS { /* * Identification of the dependent (referencing) object. diff --git a/src/include/catalog/pg_shdescription.h b/src/include/catalog/pg_shdescription.h index 1777144..00fd0e0 100644 --- a/src/include/catalog/pg_shdescription.h +++ b/src/include/catalog/pg_shdescription.h @@ -38,9 +38,7 @@ * typedef struct FormData_pg_shdescription * ---------------- */ -#define SharedDescriptionRelationId 2396 - -CATALOG(pg_shdescription,2396) BKI_SHARED_RELATION BKI_WITHOUT_OIDS +CATALOG(pg_shdescription,2396,SharedDescriptionRelationId) BKI_SHARED_RELATION BKI_WITHOUT_OIDS { Oid objoid; /* OID of object itself */ Oid classoid; /* OID of table containing object */ diff --git a/src/include/catalog/pg_shseclabel.h b/src/include/catalog/pg_shseclabel.h index 9fceeee..22ecf98 100644 --- a/src/include/catalog/pg_shseclabel.h +++ b/src/include/catalog/pg_shseclabel.h @@ -19,10 +19,7 @@ * typedef struct FormData_pg_shseclabel * ---------------- */ -#define SharedSecLabelRelationId 3592 -#define SharedSecLabelRelation_Rowtype_Id 4066 - -CATALOG(pg_shseclabel,3592) BKI_SHARED_RELATION BKI_ROWTYPE_OID(4066) BKI_WITHOUT_OIDS BKI_SCHEMA_MACRO +CATALOG(pg_shseclabel,3592,SharedSecLabelRelationId) BKI_SHARED_RELATION BKI_ROWTYPE_OID(4066,SharedSecLabelRelation_Rowtype_Id)BKI_WITHOUT_OIDS BKI_SCHEMA_MACRO { Oid objoid; /* OID of the shared object itself */ Oid classoid; /* OID of table containing the shared object */ diff --git a/src/include/catalog/pg_statistic.h b/src/include/catalog/pg_statistic.h index ea4d1be..c0ab74b 100644 --- a/src/include/catalog/pg_statistic.h +++ b/src/include/catalog/pg_statistic.h @@ -26,9 +26,7 @@ * typedef struct FormData_pg_statistic * ---------------- */ -#define StatisticRelationId 2619 - -CATALOG(pg_statistic,2619) BKI_WITHOUT_OIDS +CATALOG(pg_statistic,2619,StatisticRelationId) BKI_WITHOUT_OIDS { /* These fields form the unique key for the entry: */ Oid starelid; /* relation containing attribute */ diff --git a/src/include/catalog/pg_statistic_ext.h b/src/include/catalog/pg_statistic_ext.h index 3c6be71..5d57b81 100644 --- a/src/include/catalog/pg_statistic_ext.h +++ b/src/include/catalog/pg_statistic_ext.h @@ -26,9 +26,7 @@ * typedef struct FormData_pg_statistic_ext * ---------------- */ -#define StatisticExtRelationId 3381 - -CATALOG(pg_statistic_ext,3381) +CATALOG(pg_statistic_ext,3381,StatisticExtRelationId) { Oid stxrelid; /* relation containing attributes */ diff --git a/src/include/catalog/pg_subscription.h b/src/include/catalog/pg_subscription.h index 1b2981f..93b249f 100644 --- a/src/include/catalog/pg_subscription.h +++ b/src/include/catalog/pg_subscription.h @@ -20,8 +20,6 @@ * typedef struct FormData_pg_subscription * ---------------- */ -#define SubscriptionRelationId 6100 -#define SubscriptionRelation_Rowtype_Id 6101 /* * Technically, the subscriptions live inside the database, so a shared catalog @@ -31,7 +29,7 @@ * * NOTE: When adding a column, also update system_views.sql. */ -CATALOG(pg_subscription,6100) BKI_SHARED_RELATION BKI_ROWTYPE_OID(6101) BKI_SCHEMA_MACRO +CATALOG(pg_subscription,6100,SubscriptionRelationId) BKI_SHARED_RELATION BKI_ROWTYPE_OID(6101,SubscriptionRelation_Rowtype_Id)BKI_SCHEMA_MACRO { Oid subdbid; /* Database the subscription is in. */ NameData subname; /* Name of the subscription */ diff --git a/src/include/catalog/pg_subscription_rel.h b/src/include/catalog/pg_subscription_rel.h index 64aa121..d82b262 100644 --- a/src/include/catalog/pg_subscription_rel.h +++ b/src/include/catalog/pg_subscription_rel.h @@ -22,9 +22,7 @@ * typedef struct FormData_pg_subscription_rel * ---------------- */ -#define SubscriptionRelRelationId 6102 - -CATALOG(pg_subscription_rel,6102) BKI_WITHOUT_OIDS +CATALOG(pg_subscription_rel,6102,SubscriptionRelRelationId) BKI_WITHOUT_OIDS { Oid srsubid; /* Oid of subscription */ Oid srrelid; /* Oid of relation */ diff --git a/src/include/catalog/pg_tablespace.h b/src/include/catalog/pg_tablespace.h index bd9c118..4782e78 100644 --- a/src/include/catalog/pg_tablespace.h +++ b/src/include/catalog/pg_tablespace.h @@ -26,9 +26,7 @@ * typedef struct FormData_pg_tablespace * ---------------- */ -#define TableSpaceRelationId 1213 - -CATALOG(pg_tablespace,1213) BKI_SHARED_RELATION +CATALOG(pg_tablespace,1213,TableSpaceRelationId) BKI_SHARED_RELATION { NameData spcname; /* tablespace name */ Oid spcowner; /* owner of tablespace */ diff --git a/src/include/catalog/pg_transform.h b/src/include/catalog/pg_transform.h index c571fb5..6059b89 100644 --- a/src/include/catalog/pg_transform.h +++ b/src/include/catalog/pg_transform.h @@ -26,9 +26,7 @@ * typedef struct FormData_pg_transform * ---------------- */ -#define TransformRelationId 3576 - -CATALOG(pg_transform,3576) +CATALOG(pg_transform,3576,TransformRelationId) { Oid trftype; Oid trflang; diff --git a/src/include/catalog/pg_trigger.h b/src/include/catalog/pg_trigger.h index eabd301..7d60861 100644 --- a/src/include/catalog/pg_trigger.h +++ b/src/include/catalog/pg_trigger.h @@ -31,9 +31,7 @@ * to be associated with a deferrable constraint. * ---------------- */ -#define TriggerRelationId 2620 - -CATALOG(pg_trigger,2620) +CATALOG(pg_trigger,2620,TriggerRelationId) { Oid tgrelid; /* relation trigger is attached to */ NameData tgname; /* trigger's name */ diff --git a/src/include/catalog/pg_ts_config.h b/src/include/catalog/pg_ts_config.h index d0b7aa9..d344bb7 100644 --- a/src/include/catalog/pg_ts_config.h +++ b/src/include/catalog/pg_ts_config.h @@ -26,9 +26,7 @@ * typedef struct FormData_pg_ts_config * ---------------- */ -#define TSConfigRelationId 3602 - -CATALOG(pg_ts_config,3602) +CATALOG(pg_ts_config,3602,TSConfigRelationId) { NameData cfgname; /* name of configuration */ Oid cfgnamespace; /* name space */ diff --git a/src/include/catalog/pg_ts_config_map.h b/src/include/catalog/pg_ts_config_map.h index cdee4b4..2120021 100644 --- a/src/include/catalog/pg_ts_config_map.h +++ b/src/include/catalog/pg_ts_config_map.h @@ -26,9 +26,7 @@ * typedef struct FormData_pg_ts_config_map * ---------------- */ -#define TSConfigMapRelationId 3603 - -CATALOG(pg_ts_config_map,3603) BKI_WITHOUT_OIDS +CATALOG(pg_ts_config_map,3603,TSConfigMapRelationId) BKI_WITHOUT_OIDS { Oid mapcfg; /* OID of configuration owning this entry */ int32 maptokentype; /* token type from parser */ diff --git a/src/include/catalog/pg_ts_dict.h b/src/include/catalog/pg_ts_dict.h index 58af179..1e285ad 100644 --- a/src/include/catalog/pg_ts_dict.h +++ b/src/include/catalog/pg_ts_dict.h @@ -26,9 +26,7 @@ * typedef struct FormData_pg_ts_dict * ---------------- */ -#define TSDictionaryRelationId 3600 - -CATALOG(pg_ts_dict,3600) +CATALOG(pg_ts_dict,3600,TSDictionaryRelationId) { NameData dictname; /* dictionary name */ Oid dictnamespace; /* name space */ diff --git a/src/include/catalog/pg_ts_parser.h b/src/include/catalog/pg_ts_parser.h index 51b70ae..ccaf40b 100644 --- a/src/include/catalog/pg_ts_parser.h +++ b/src/include/catalog/pg_ts_parser.h @@ -26,9 +26,7 @@ * typedef struct FormData_pg_ts_parser * ---------------- */ -#define TSParserRelationId 3601 - -CATALOG(pg_ts_parser,3601) +CATALOG(pg_ts_parser,3601,TSParserRelationId) { /* parser's name */ NameData prsname; diff --git a/src/include/catalog/pg_ts_template.h b/src/include/catalog/pg_ts_template.h index cfb97925..5e66e02 100644 --- a/src/include/catalog/pg_ts_template.h +++ b/src/include/catalog/pg_ts_template.h @@ -26,9 +26,7 @@ * typedef struct FormData_pg_ts_template * ---------------- */ -#define TSTemplateRelationId 3764 - -CATALOG(pg_ts_template,3764) +CATALOG(pg_ts_template,3764,TSTemplateRelationId) { /* template name */ NameData tmplname; diff --git a/src/include/catalog/pg_type.h b/src/include/catalog/pg_type.h index 8992fcd..4ddc09a 100644 --- a/src/include/catalog/pg_type.h +++ b/src/include/catalog/pg_type.h @@ -31,10 +31,7 @@ * See struct FormData_pg_attribute for details. * ---------------- */ -#define TypeRelationId 1247 -#define TypeRelation_Rowtype_Id 71 - -CATALOG(pg_type,1247) BKI_BOOTSTRAP BKI_ROWTYPE_OID(71) BKI_SCHEMA_MACRO +CATALOG(pg_type,1247,TypeRelationId) BKI_BOOTSTRAP BKI_ROWTYPE_OID(71,TypeRelation_Rowtype_Id) BKI_SCHEMA_MACRO { /* type name */ NameData typname; diff --git a/src/include/catalog/pg_user_mapping.h b/src/include/catalog/pg_user_mapping.h index ec62ee2..6efbed0 100644 --- a/src/include/catalog/pg_user_mapping.h +++ b/src/include/catalog/pg_user_mapping.h @@ -25,9 +25,7 @@ * typedef struct FormData_pg_user_mapping * ---------------- */ -#define UserMappingRelationId 1418 - -CATALOG(pg_user_mapping,1418) +CATALOG(pg_user_mapping,1418,UserMappingRelationId) { Oid umuser; /* Id of the user, InvalidOid if PUBLIC is * wanted */ diff --git a/src/include/catalog/unused_oids b/src/include/catalog/unused_oids index e8be34c..f71222d 100755 --- a/src/include/catalog/unused_oids +++ b/src/include/catalog/unused_oids @@ -30,7 +30,7 @@ export FIRSTOBJECTID cat pg_*.h pg_*.dat toasting.h indexing.h | egrep -v -e '^CATALOG\(.*BKI_BOOTSTRAP' | \ sed -n -e 's/.*\boid *=> *'\''\([0-9][0-9]*\)'\''.*$/\1/p' \ - -e 's/^CATALOG([^,]*, *\([0-9][0-9]*\).*BKI_ROWTYPE_OID(\([0-9][0-9]*\)).*$/\1,\2/p' \ + -e 's/^CATALOG([^,]*, *\([0-9][0-9]*\).*BKI_ROWTYPE_OID(\([0-9][0-9]*\),.*$/\1,\2/p' \ -e 's/^CATALOG([^,]*, *\([0-9][0-9]*\).*$/\1/p' \ -e 's/^DECLARE_INDEX([^,]*, *\([0-9][0-9]*\).*$/\1/p' \ -e 's/^DECLARE_UNIQUE_INDEX([^,]*, *\([0-9][0-9]*\).*$/\1/p' \
pgsql-hackers by date: