10000 Move catalog toast table declarations · postgrespro/postgres@b4c9695 · GitHub
[go: up one dir, main page]

Skip to content

Commit b4c9695

Browse files
committed
Move catalog toast table declarations
Move the system catalog toast table declarations from catalog/toasting.h to the respective parent tables' catalog/pg_*.h files. The original reason for having it split was that the old genbki system produced the output in the order of the catalog files it read, so all the toasting stuff needed to come separately. But this is no longer the case, and keeping it together makes more sense. Reviewed-by: John Naylor <john.naylor@enterprisedb.com> Discussion: https://www.postgresql.org/message-id/flat/c7cc82d6-f976-75d6-2e3e-b03d2cab26bb@2ndquadrant.com
1 parent 623644f commit b4c9695

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+105
-89
lines changed

doc/src/sgml/bki.sgml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,7 @@
2424
the catalog has, as well as some other basic properties such as its OID.
2525
Other critical files defining the catalog structure
2626
include <filename>indexing.h</filename>, which defines the indexes present
27-
on all the system catalogs, and <filename>toasting.h</filename>, which
28-
defines TOAST tables for catalogs that need one.
27+
on all the system catalogs.
2928
</para>
3029

3130
<para>

src/backend/catalog/Makefile

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,11 +72,8 @@ CATALOG_HEADERS := \
7272

7373
GENERATED_HEADERS := $(CATALOG_HEADERS:%.h=%_d.h) schemapg.h
7474

75-
# In the list of headers used to assemble postgres.bki, indexing.h needs
76-
# be last, and toasting.h just before it. This ensures we don't try to
77-
# create indexes or toast tables before their catalogs exist.
7875
POSTGRES_BKI_SRCS := $(addprefix $(top_srcdir)/src/include/catalog/,\
79-
$(CATALOG_HEADERS) toasting.h indexing.h \
76+
$(CATALOG_HEADERS) indexing.h \
8077
)
8178

8279
# The .dat files we need can just be listed alphabetically.

src/backend/catalog/catalog.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@
4040
#include "catalog/pg_subscription.h"
4141
#include "catalog/pg_tablespace.h"
4242
#include "catalog/pg_type.h"
43-
#include "catalog/toasting.h"
4443
#include "miscadmin.h"
4544
#include "storage/fd.h"
4645
#include "utils/fmgroids.h"
@@ -268,7 +267,7 @@ IsSharedRelation(Oid relationId)
268267
relationId == SubscriptionObjectIndexId ||
269268
relationId == SubscriptionNameIndexId)
270269
return true;
271-
/* These are their toast tables and toast indexes (see toasting.h) */
270+
/* These are their toast tables and toast indexes */
272271
if (relationId == PgAuthidToastTable ||
273272
relationId == PgAuthidToastIndex ||
274273
relationId == PgDatabaseToastTable ||

src/backend/catalog/toasting.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,7 @@ needs_toast_table(Relation rel)
391391
/*
392392
* Ignore attempts to create toast tables on catalog tables after initdb.
393393
* Which catalogs get toast tables is explicitly chosen in
394-
* catalog/toasting.h. (We could get here via some ALTER TABLE command if
394+
* catalog/pg_*.h. (We could get here via some ALTER TABLE command if
395395
* the catalog doesn't have a toast table.)
396396
*/
397397
if (IsCatalogRelation(rel) && !IsBootstrapProcessingMode())

src/include/catalog/duplicate_oids

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ chdir $FindBin::RealBin or die "could not cd to $FindBin::RealBin: $!\n";
2626
use lib "$FindBin::RealBin/../../backend/catalog/";
2727
use Catalog;
2828

29-
my @input_files = (glob("pg_*.h"), qw(indexing.h toasting.h));
29+
my @input_files = (glob("pg_*.h"), qw(indexing.h));
3030

3131
my $oids = Catalog::FindAllOidsFromHeaders(@input_files);
3232

src/include/catalog/genbki.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,19 @@
4141
*/
4242
#define BKI_LOOKUP(catalog)
4343

44+
/*
45+
* These lines are processed by genbki.pl to create the statements
46+
* the bootstrap parser will turn into BootstrapToastTable commands.
47+
* Each line specifies the system catalog that needs a toast table,
48+
* the OID to assign to the toast table, and the OID to assign to the
49+
* toast table's index. The reason we hard-wire these OIDs is that we
50+
* need stable OIDs for shared relations, and that includes toast tables
51+
* of shared relations.
52+
*
53+
* The macro definition is just to keep the C compiler from spitting up.
54+
*/
55+
#define DECLARE_TOAST(name,toastoid,indexoid) extern int no_such_variable
56+
4457
/* The following are never defined; they are here only for documentation. */
4558

4659
/*

src/include/catalog/pg_aggregate.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,8 @@ CATALOG(pg_aggregate,2600,AggregateRelationId)
108108
*/
109109
typedef FormData_pg_aggregate *Form_pg_aggregate;
110110

111+
DECLARE_TOAST(pg_aggregate, 4159, 4160);
112+
111113
#ifdef EXPOSE_TO_CLIENT_CODE
112114

113115
/*

src/include/catalog/pg_attrdef.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,4 +46,6 @@ CATALOG(pg_attrdef,2604,AttrDefaultRelationId)
4646
*/
4747
typedef FormData_pg_attrdef *Form_pg_attrdef;
4848

49+
DECLARE_TOAST(pg_attrdef, 2830, 2831);
50+
4951
#endif /* PG_ATTRDEF_H */

src/include/catalog/pg_authid.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,4 +55,8 @@ CATALOG(pg_authid,1260,AuthIdRelationId) BKI_SHARED_RELATION BKI_ROWTYPE_OID(284
5555
*/
5656
typedef FormData_pg_authid *Form_pg_authid;
5757

58+
DECLARE_TOAST(pg_authid, 4175, 4176);
59+
#define PgAuthidToastTable 4175
60+
#define PgAuthidToastIndex 4176
61+
5862
#endif /* PG_AUTHID_H */

src/include/catalog/pg_constraint.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,8 @@ CATALOG(pg_constraint,2606,ConstraintRelationId)
153153
*/
154154
typedef FormData_pg_constraint *Form_pg_constraint;
155155

156+
DECLARE_TOAST(pg_constraint, 2832, 2833);
157+
156158
#ifdef EXPOSE_TO_CLIENT_CODE
157159

158160
/* Valid values for contype */

0 commit comments

Comments
 (0)
0