PostgreSQL Source Code  git master
bootstrap.c
Go to the documentation of this file.
1 /*-------------------------------------------------------------------------
2  *
3  * bootstrap.c
4  * routines to support running postgres in 'bootstrap' mode
5  * bootstrap mode is used to create the initial template database
6  *
7  * Portions Copyright (c) 1996-2020, PostgreSQL Global Development Group
8  * Portions Copyright (c) 1994, Regents of the University of California
9  *
10  * IDENTIFICATION
11  * src/backend/bootstrap/bootstrap.c
12  *
13  *-------------------------------------------------------------------------
14  */
15 #include "postgres.h"
16 
17 #include <unistd.h>
18 #include <signal.h>
19 
20 #include "access/genam.h"
21 #include "access/heapam.h"
22 #include "access/htup_details.h"
23 #include "access/tableam.h"
24 #include "access/xact.h"
25 #include "access/xlog_internal.h"
26 #include "bootstrap/bootstrap.h"
27 #include "catalog/index.h"
28 #include "catalog/pg_collation.h"
29 #include "catalog/pg_type.h"
30 #include "common/link-canary.h"
31 #include "libpq/pqsignal.h"
32 #include "miscadmin.h"
33 #include "nodes/makefuncs.h"
34 #include "pg_getopt.h"
35 #include "pgstat.h"
36 #include "postmaster/bgwriter.h"
37 #include "postmaster/startup.h"
38 #include "postmaster/walwriter.h"
40 #include "storage/bufmgr.h"
41 #include "storage/bufpage.h"
43 #include "storage/ipc.h"
44 #include "storage/proc.h"
45 #include "tcop/tcopprot.h"
46 #include "utils/builtins.h"
47 #include "utils/fmgroids.h"
48 #include "utils/memutils.h"
49 #include "utils/ps_status.h"
50 #include "utils/rel.h"
51 #include "utils/relmapper.h"
52 
54 
55 
56 static void CheckerModeMain(void);
57 static void BootstrapModeMain(void);
58 static void bootstrap_signals(void);
59 static void ShutdownAuxiliaryProcess(int code, Datum arg);
61 static void populate_typ_array(void);
62 static Oid gettype(char *type);
63 static void cleanup(void);
64 
65 /* ----------------
66  * global variables
67  * ----------------
68  */
69 
70 AuxProcType MyAuxProcType = NotAnAuxProcess; /* declared in miscadmin.h */
71 
72 Relation boot_reldesc; /* current relation descriptor */
73 
74 Form_pg_attribute attrtypes[MAXATTR]; /* points to attribute info */
75 int numattr; /* number of attributes for cur. rel */
76 
77 
78 /*
79  * Basic information associated with each type. This is used before
80  * pg_type is filled, so it has to cover the datatypes used as column types
81  * in the core "bootstrapped" catalogs.
82  *
83  * XXX several of these input/output functions do catalog scans
84  * (e.g., F_REGPROCIN scans pg_proc). this obviously creates some
85  * order dependencies in the catalog creation process.
86  */
87 struct typinfo
88 {
93  bool byval;
94  char align;
95  char storage;
99 };
100 
101 static const struct typinfo TypInfo[] = {
102  {"bool", BOOLOID, 0, 1, true, TYPALIGN_CHAR, TYPSTORAGE_PLAIN, InvalidOid,
103  F_BOOLIN, F_BOOLOUT},
104  {"bytea", BYTEAOID, 0, -1, false, TYPALIGN_INT, TYPSTORAGE_EXTENDED, InvalidOid,
105  F_BYTEAIN, F_BYTEAOUT},
106  {"char", CHAROID, 0, 1, true, TYPALIGN_CHAR, TYPSTORAGE_PLAIN, InvalidOid,
107  F_CHARIN, F_CHAROUT},
108  {"int2", INT2OID, 0, 2, true, TYPALIGN_SHORT, TYPSTORAGE_PLAIN, InvalidOid,
109  F_INT2IN, F_INT2OUT},
110  {"int4", INT4OID, 0, 4, true, TYPALIGN_INT, TYPSTORAGE_PLAIN, InvalidOid,
111  F_INT4IN, F_INT4OUT},
112  {"float4", FLOAT4OID, 0, 4, true, TYPALIGN_INT, TYPSTORAGE_PLAIN, InvalidOid,
113  F_FLOAT4IN, F_FLOAT4OUT},
114  {"name", NAMEOID, CHAROID, NAMEDATALEN, false, TYPALIGN_CHAR, TYPSTORAGE_PLAIN, C_COLLATION_OID,
115  F_NAMEIN, F_NAMEOUT},
116  {"regclass", REGCLASSOID, 0, 4, true, TYPALIGN_INT, TYPSTORAGE_PLAIN, InvalidOid,
117  F_REGCLASSIN, F_REGCLASSOUT},
118  {"regproc", REGPROCOID, 0, 4, true, TYPALIGN_INT, TYPSTORAGE_PLAIN, InvalidOid,
119  F_REGPROCIN, F_REGPROCOUT},
120  {"regtype", REGTYPEOID, 0, 4, true, TYPALIGN_INT, TYPSTORAGE_PLAIN, InvalidOid,
121  F_REGTYPEIN, F_REGTYPEOUT},
122  {"regrole", REGROLEOID, 0, 4, true, TYPALIGN_INT, TYPSTORAGE_PLAIN, InvalidOid,
123  F_REGROLEIN, F_REGROLEOUT},
124  {"regnamespace", REGNAMESPACEOID, 0, 4, true, TYPALIGN_INT, TYPSTORAGE_PLAIN, InvalidOid,
125  F_REGNAMESPACEIN, F_REGNAMESPACEOUT},
126  {"text", TEXTOID, 0, -1, false, TYPALIGN_INT, TYPSTORAGE_EXTENDED, DEFAULT_COLLATION_OID,
127  F_TEXTIN, F_TEXTOUT},
128  {"oid", OIDOID, 0, 4, true, TYPALIGN_INT, TYPSTORAGE_PLAIN, InvalidOid,
129  F_OIDIN, F_OIDOUT},
130  {"tid", TIDOID, 0, 6, false, TYPALIGN_SHORT, TYPSTORAGE_PLAIN, InvalidOid,
131  F_TIDIN, F_TIDOUT},
132  {"xid", XIDOID, 0, 4, true, TYPALIGN_INT, TYPSTORAGE_PLAIN, InvalidOid,
133  F_XIDIN, F_XIDOUT},
134  {"cid", CIDOID, 0, 4, true, TYPALIGN_INT, TYPSTORAGE_PLAIN, InvalidOid,
135  F_CIDIN, F_CIDOUT},
136  {"pg_node_tree", PGNODETREEOID, 0, -1, false, TYPALIGN_INT, TYPSTORAGE_EXTENDED, DEFAULT_COLLATION_OID,
137  F_PG_NODE_TREE_IN, F_PG_NODE_TREE_OUT},
138  {"int2vector", INT2VECTOROID, INT2OID, -1, false, TYPALIGN_INT, TYPSTORAGE_PLAIN, InvalidOid,
139  F_INT2VECTORIN, F_INT2VECTOROUT},
140  {"oidvector", OIDVECTOROID, OIDOID, -1, false, TYPALIGN_INT, TYPSTORAGE_PLAIN, InvalidOid,
141  F_OIDVECTORIN, F_OIDVECTOROUT},
142  {"_int4", INT4ARRAYOID, INT4OID, -1, false, TYPALIGN_INT, TYPSTORAGE_EXTENDED, InvalidOid,
143  F_ARRAY_IN, F_ARRAY_OUT},
144  {"_text", 1009, TEXTOID, -1, false, TYPALIGN_INT, TYPSTORAGE_EXTENDED, DEFAULT_COLLATION_OID,
145  F_ARRAY_IN, F_ARRAY_OUT},
146  {"_oid", 1028, OIDOID, -1, false, TYPALIGN_INT, TYPSTORAGE_EXTENDED, InvalidOid,
147  F_ARRAY_IN, F_ARRAY_OUT},
148  {"_char", 1002, CHAROID, -1, false, TYPALIGN_INT, TYPSTORAGE_EXTENDED, InvalidOid,
149  F_ARRAY_IN, F_ARRAY_OUT},
150  {"_aclitem", 1034, ACLITEMOID, -1, false, TYPALIGN_INT, TYPSTORAGE_EXTENDED, InvalidOid,
151  F_ARRAY_IN, F_ARRAY_OUT}
152 };
153 
154 static const int n_types = sizeof(TypInfo) / sizeof(struct typinfo);
155 
156 struct typmap
157 { /* a hack */
160 };
161 
162 static struct typmap **Typ = NULL;
163 static struct typmap *Ap = NULL;
164 
165 static Datum values[MAXATTR]; /* current row's attribute values */
166 static bool Nulls[MAXATTR];
167 
168 static MemoryContext nogc = NULL; /* special no-gc mem context */
169 
170 /*
171  * At bootstrap time, we first declare all the indices to be built, and
172  * then build them. The IndexList structure stores enough information
173  * to allow us to build the indices after they've been declared.
174  */
175 
176 typedef struct _IndexList
177 {
182 } IndexList;
183 
184 static IndexList *ILHead = NULL;
185 
186 
187 /*
188  * AuxiliaryProcessMain
189  *
190  * The main entry point for auxiliary processes, such as the bgwriter,
191  * walwriter, walreceiver, bootstrapper and the shared memory checker code.
192  *
193  * This code is here just because of historical reasons.
194  */
195 void
196 AuxiliaryProcessMain(int argc, char *argv[])
197 {
198  char *progname = argv[0];
199  int flag;
200  char *userDoption = NULL;
201 
202  /*
203  * Initialize process environment (already done if under postmaster, but
204  * not if standalone).
205  */
206  if (!IsUnderPostmaster)
207  InitStandaloneProcess(argv[0]);
208 
209  /*
210  * process command arguments
211  */
212 
213  /* Set defaults, to be overridden by explicit options below */
214  if (!IsUnderPostmaster)
216 
217  /* Ignore the initial --boot argument, if present */
218  if (argc > 1 && strcmp(argv[1], "--boot") == 0)
219  {
220  argv++;
221  argc--;
222  }
223 
224  /* If no -x argument, we are a CheckerProcess */
226 
227  while ((flag = getopt(argc, argv, "B:c:d:D:Fkr:x:X:-:")) != -1)
228  {
229  switch (flag)
230  {
231  case 'B':
232  SetConfigOption("shared_buffers", optarg, PGC_POSTMASTER, PGC_S_ARGV);
233  break;
234  case 'D':
235  userDoption = pstrdup(optarg);
236  break;
237  case 'd':
238  {
239  /* Turn on debugging for the bootstrap process. */
240  char *debugstr;
241 
242  debugstr = psprintf("debug%s", optarg);
243  SetConfigOption("log_min_messages", debugstr,
245  SetConfigOption("client_min_messages", debugstr,
247  pfree(debugstr);
248  }
249  break;
250  case 'F':
251  SetConfigOption("fsync", "false", PGC_POSTMASTER, PGC_S_ARGV);
252  break;
253  case 'k':
255  break;
256  case 'r':
258  break;
259  case 'x':
260  MyAuxProcType = atoi(optarg);
261  break;
262  case 'X':
263  {
264  int WalSegSz = strtoul(optarg, NULL, 0);
265 
266  if (!IsValidWalSegSize(WalSegSz))
267  ereport(ERROR,
268  (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
269  errmsg("-X requires a power of two value between 1 MB and 1 GB")));
270  SetConfigOption("wal_segment_size", optarg, PGC_INTERNAL,
272  }
273  break;
274  case 'c':
275  case '-':
276  {
277  char *name,
278  *value;
279 
280  ParseLongOption(optarg, &name, &value);
281  if (!value)
282  {
283  if (flag == '-')
284  ereport(ERROR,
285  (errcode(ERRCODE_SYNTAX_ERROR),
286  errmsg("--%s requires a value",
287  optarg)));
288  else
289  ereport(ERROR,
290  (errcode(ERRCODE_SYNTAX_ERROR),
291  errmsg("-c %s requires a value",
292  optarg)));
293  }
294 
296  free(name);
297  if (value)
298  free(value);
299  break;
300  }
301  default:
302  write_stderr("Try \"%s --help\" for more information.\n",
303  progname);
304  proc_exit(1);
305  break;
306  }
307  }
308 
309  if (argc != optind)
310  {
311  write_stderr("%s: invalid command-line arguments\n", progname);
312  proc_exit(1);
313  }
314 
315  switch (MyAuxProcType)
316  {
317  case StartupProcess:
319  break;
320  case BgWriterProcess:
322  break;
323  case CheckpointerProcess:
325  break;
326  case WalWriterProcess:
328  break;
329  case WalReceiverProcess:
331  break;
332  default:
334  }
335  if (IsUnderPostmaster)
336  init_ps_display(NULL);
337 
338  /* Acquire configuration parameters, unless inherited from postmaster */
339  if (!IsUnderPostmaster)
340  {
341  if (!SelectConfigFiles(userDoption, progname))
342  proc_exit(1);
343  }
344 
345  /*
346  * Validate we have been given a reasonable-looking DataDir and change
347  * into it (if under postmaster, should be done already).
348  */
349  if (!IsUnderPostmaster)
350  {
351  checkDataDir();
352  ChangeToDataDir();
353  }
354 
355  /* If standalone, create lockfile for data directory */
356  if (!IsUnderPostmaster)
357  CreateDataDirLockFile(false);
358 
360  IgnoreSystemIndexes = true;
361 
362  /* Initialize MaxBackends (if under postmaster, was done already) */
363  if (!IsUnderPostmaster)
365 
366  BaseInit();
367 
368  /*
369  * When we are an auxiliary process, we aren't going to do the full
370  * InitPostgres pushups, but there are a couple of things that need to get
371  * lit up even in an auxiliary process.
372  */
373  if (IsUnderPostmaster)
374  {
375  /*
376  * Create a PGPROC so we can use LWLocks. In the EXEC_BACKEND case,
377  * this was already done by SubPostmasterMain().
378  */
379 #ifndef EXEC_BACKEND
381 #endif
382 
383  /*
384  * Assign the ProcSignalSlot for an auxiliary process. Since it
385  * doesn't have a BackendId, the slot is statically allocated based on
386  * the auxiliary process type (MyAuxProcType). Backends use slots
387  * indexed in the range from 1 to MaxBackends (inclusive), so we use
388  * MaxBackends + AuxProcType + 1 as the index of the slot for an
389  * auxiliary process.
390  *
391  * This will need rethinking if we ever want more than one of a
392  * particular auxiliary process type.
393  */
395 
396  /* finish setting up bufmgr.c */
398 
399  /*
400  * Auxiliary processes don't run transactions, but they may need a
401  * resource owner anyway to manage buffer pins acquired outside
402  * transactions (and, perhaps, other things in future).
403  */
405 
406  /* Initialize backend status information */
408  pgstat_bestart();
409 
410  /* register a before-shutdown callback for LWLock cleanup */
412  }
413 
414  /*
415  * XLOG operations
416  */
418 
419  switch (MyAuxProcType)
420  {
421  case CheckerProcess:
422  /* don't set signals, they're useless here */
423  CheckerModeMain();
424  proc_exit(1); /* should never return */
425 
426  case BootstrapProcess:
427 
428  /*
429  * There was a brief instant during which mode was Normal; this is
430  * okay. We need to be in bootstrap mode during BootStrapXLOG for
431  * the sake of multixact initialization.
432  */
435  BootStrapXLOG();
437  proc_exit(1); /* should never return */
438 
439  case StartupProcess:
440  /* don't set signals, startup process has its own agenda */
442  proc_exit(1); /* should never return */
443 
444  case BgWriterProcess:
445  /* don't set signals, bgwriter has its own agenda */
447  proc_exit(1); /* should never return */
448 
449  case CheckpointerProcess:
450  /* don't set signals, checkpointer has its own agenda */
452  proc_exit(1); /* should never return */
453 
454  case WalWriterProcess:
455  /* don't set signals, walwriter has its own agenda */
456  InitXLOGAccess();
457  WalWriterMain();
458  proc_exit(1); /* should never return */
459 
460  case WalReceiverProcess:
461  /* don't set signals, walreceiver has its own agenda */
462  WalReceiverMain();
463  proc_exit(1); /* should never return */
464 
465  default:
466  elog(PANIC, "unrecognized process type: %d", (int) MyAuxProcType);
467  proc_exit(1);
468  }
469 }
470 
471 /*
472  * In shared memory checker mode, all we really want to do is create shared
473  * memory and semaphores (just to prove we can do it with the current GUC
474  * settings). Since, in fact, that was already done by BaseInit(),
475  * we have nothing more to do here.
476  */
477 static void
479 {
480  proc_exit(0);
481 }
482 
483 /*
484  * The main entry point for running the backend in bootstrap mode
485  *
486  * The bootstrap mode is used to initialize the template database.
487  * The bootstrap backend doesn't speak SQL, but instead expects
488  * commands in a special bootstrap language.
489  */
490 static void
492 {
493  int i;
494 
497 
498  /*
499  * To ensure that src/common/link-canary.c is linked into the backend, we
500  * must call it from somewhere. Here is as good as anywhere.
501  */
503  elog(ERROR, "backend is incorrectly linked to frontend functions");
504 
505  /*
506  * Do backend-like initialization for bootstrap mode
507  */
508  InitProcess();
509 
510  InitPostgres(NULL, InvalidOid, NULL, InvalidOid, NULL, false);
511 
512  /* Initialize stuff for bootstrap-file processing */
513  for (i = 0; i < MAXATTR; i++)
514  {
515  attrtypes[i] = NULL;
516  Nulls[i] = false;
517  }
518 
519  /*
520  * Process bootstrap input.
521  */
523  boot_yyparse();
525 
526  /*
527  * We should now know about all mapped relations, so it's okay to write
528  * out the initial relation mapping files.
529  */
531 
532  /* Clean up and exit */
533  cleanup();
534  proc_exit(0);
535 }
536 
537 
538 /* ----------------------------------------------------------------
539  * misc functions
540  * ----------------------------------------------------------------
541  */
542 
543 /*
544  * Set up signal handling for a bootstrap process
545  */
546 static void
548 {
550 
551  /*
552  * We don't actually need any non-default signal handling in bootstrap
553  * mode; "curl up and die" is a sufficient response for all these cases.
554  * Let's set that handling explicitly, as documentation if nothing else.
555  */
557  pqsignal(SIGINT, SIG_DFL);
558  pqsignal(SIGTERM, SIG_DFL);
560 }
561 
562 /*
563  * Begin shutdown of an auxiliary process. This is approximately the equivalent
564  * of ShutdownPostgres() in postinit.c. We can't run transactions in an
565  * auxiliary process, so most of the work of AbortTransaction() is not needed,
566  * but we do need to make sure we've released any LWLocks we are holding.
567  * (This is only critical during an error exit.)
568  */
569 static void
571 {
575 }
576 
577 /* ----------------------------------------------------------------
578  * MANUAL BACKEND INTERACTIVE INTERFACE COMMANDS
579  * ----------------------------------------------------------------
580  */
581 
582 /* ----------------
583  * boot_openrel
584  *
585  * Execute BKI OPEN command.
586  * ----------------
587  */
588 void
590 {
591  int i;
592 
593  if (strlen(relname) >= NAMEDATALEN)
594  relname[NAMEDATALEN - 1] = '\0';
595 
596  /*
597  * pg_type must be filled before any OPEN command is executed, hence we
598  * can now populate the Typ array if we haven't yet.
599  */
600  if (Typ == NULL)
602 
603  if (boot_reldesc != NULL)
604  closerel(NULL);
605 
606  elog(DEBUG4, "open relation %s, attrsize %d",
607  relname, (int) ATTRIBUTE_FIXED_PART_SIZE);
608 
609  boot_reldesc = table_openrv(makeRangeVar(NULL, relname, -1), NoLock);
610  numattr = RelationGetNumberOfAttributes(boot_reldesc);
611  for (i = 0; i < numattr; i++)
612  {
613  if (attrtypes[i] == NULL)
615  memmove((char *) attrtypes[i],
616  (char *) TupleDescAttr(boot_reldesc->rd_att, i),
617  ATTRIBUTE_FIXED_PART_SIZE);
618 
619  {
621 
622  elog(DEBUG4, "create attribute %d name %s len %d num %d type %u",
623  i, NameStr(at->attname), at->attlen, at->attnum,
624  at->atttypid);
625  }
626  }
627 }
628 
629 /* ----------------
630  * closerel
631  * ----------------
632  */
633 void
635 {
636  if (name)
637  {
638  if (boot_reldesc)
639  {
640  if (strcmp(RelationGetRelationName(boot_reldesc), name) != 0)
641  elog(ERROR, "close of %s when %s was expected",
642  name, RelationGetRelationName(boot_reldesc));
643  }
644  else
645  elog(ERROR, "close of %s before any relation was opened",
646  name);
647  }
648 
649  if (boot_reldesc == NULL)
650  elog(ERROR, "no open relation to close");
651  else
652  {
653  elog(DEBUG4, "close relation %s",
654  RelationGetRelationName(boot_reldesc));
655  table_close(boot_reldesc, NoLock);
656  boot_reldesc = NULL;
657  }
658 }
659 
660 
661 
662 /* ----------------
663  * DEFINEATTR()
664  *
665  * define a <field,type> pair
666  * if there are n fields in a relation to be created, this routine
667  * will be called n times
668  * ----------------
669  */
670 void
671 DefineAttr(char *name, char *type, int attnum, int nullness)
672 {
673  Oid typeoid;
674 
675  if (boot_reldesc != NULL)
676  {
677  elog(WARNING, "no open relations allowed with CREATE command");
678  closerel(NULL);
679  }
680 
681  if (attrtypes[attnum] == NULL)
684 
685  namestrcpy(&attrtypes[attnum]->attname, name);
686  elog(DEBUG4, "column %s %s", NameStr(attrtypes[attnum]->attname), type);
687  attrtypes[attnum]->attnum = attnum + 1;
688 
689  typeoid = gettype(type);
690 
691  if (Typ != NULL)
692  {
693  attrtypes[attnum]->atttypid = Ap->am_oid;
694  attrtypes[attnum]->attlen = Ap->am_typ.typlen;
695  attrtypes[attnum]->attbyval = Ap->am_typ.typbyval;
696  attrtypes[attnum]->attstorage = Ap->am_typ.typstorage;
697  attrtypes[attnum]->attalign = Ap->am_typ.typalign;
698  attrtypes[attnum]->attcollation = Ap->am_typ.typcollation;
699  /* if an array type, assume 1-dimensional attribute */
700  if (Ap->am_typ.typelem != InvalidOid && Ap->am_typ.typlen < 0)
701  attrtypes[attnum]->attndims = 1;
702  else
703  attrtypes[attnum]->attndims = 0;
704  }
705  else
706  {
707  attrtypes[attnum]->atttypid = TypInfo[typeoid].oid;
708  attrtypes[attnum]->attlen = TypInfo[typeoid].len;
709  attrtypes[attnum]->attbyval = TypInfo[typeoid].byval;
710  attrtypes[attnum]->attstorage = TypInfo[typeoid].storage;
711  attrtypes[attnum]->attalign = TypInfo[typeoid].align;
712  attrtypes[attnum]->attcollation = TypInfo[typeoid].collation;
713  /* if an array type, assume 1-dimensional attribute */
714  if (TypInfo[typeoid].elem != InvalidOid &&
715  attrtypes[attnum]->attlen < 0)
716  attrtypes[attnum]->attndims = 1;
717  else
718  attrtypes[attnum]->attndims = 0;
719  }
720 
721  /*
722  * If a system catalog column is collation-aware, force it to use C
723  * collation, so that its behavior is independent of the database's
724  * collation. This is essential to allow template0 to be cloned with a
725  * different database collation.
726  */
727  if (OidIsValid(attrtypes[attnum]->attcollation))
728  attrtypes[attnum]->attcollation = C_COLLATION_OID;
729 
730  attrtypes[attnum]->attstattarget = -1;
731  attrtypes[attnum]->attcacheoff = -1;
732  attrtypes[attnum]->atttypmod = -1;
733  attrtypes[attnum]->attislocal = true;
734 
735  if (nullness == BOOTCOL_NULL_FORCE_NOT_NULL)
736  {
737  attrtypes[attnum]->attnotnull = true;
738  }
739  else if (nullness == BOOTCOL_NULL_FORCE_NULL)
740  {
741  attrtypes[attnum]->attnotnull = false;
742  }
743  else
744  {
745  Assert(nullness == BOOTCOL_NULL_AUTO);
746 
747  /*
748  * Mark as "not null" if type is fixed-width and prior columns are
749  * likewise fixed-width and not-null. This corresponds to case where
750  * column can be accessed directly via C struct declaration.
751  */
752  if (attrtypes[attnum]->attlen > 0)
753  {
754  int i;
755 
756  /* check earlier attributes */
757  for (i = 0; i < attnum; i++)
758  {
759  if (attrtypes[i]->attlen <= 0 ||
760  !attrtypes[i]->attnotnull)
761  break;
762  }
763  if (i == attnum)
764  attrtypes[attnum]->attnotnull = true;
765  }
766  }
767 }
768 
769 
770 /* ----------------
771  * InsertOneTuple
772  *
773  * If objectid is not zero, it is a specific OID to assign to the tuple.
774  * Otherwise, an OID will be assigned (if necessary) by heap_insert.
775  * ----------------
776  */
777 void
779 {
780  HeapTuple tuple;
781  TupleDesc tupDesc;
782  int i;
783 
784  elog(DEBUG4, "inserting row with %d columns", numattr);
785 
786  tupDesc = CreateTupleDesc(numattr, attrtypes);
787  tuple = heap_form_tuple(tupDesc, values, Nulls);
788  pfree(tupDesc); /* just free's tupDesc, not the attrtypes */
789 
790  simple_heap_insert(boot_reldesc, tuple);
791  heap_freetuple(tuple);
792  elog(DEBUG4, "row inserted");
793 
794  /*
795  * Reset null markers for next tuple
796  */
797  for (i = 0; i < numattr; i++)
798  Nulls[i] = false;
799 }
800 
801 /* ----------------
802  * InsertOneValue
803  * ----------------
804  */
805 void
806 InsertOneValue(char *value, int i)
807 {
808  Oid typoid;
809  int16 typlen;
810  bool typbyval;
811  char typalign;
812  char typdelim;
813  Oid typioparam;
814  Oid typinput;
815  Oid typoutput;
816 
817  AssertArg(i >= 0 && i < MAXATTR);
818 
819  elog(DEBUG4, "inserting column %d value \"%s\"", i, value);
820 
821  typoid = TupleDescAttr(boot_reldesc->rd_att, i)->atttypid;
822 
823  boot_get_type_io_data(typoid,
824  &typlen, &typbyval, &typalign,
825  &typdelim, &typioparam,
826  &typinput, &typoutput);
827 
828  values[i] = OidInputFunctionCall(typinput, value, typioparam, -1);
829 
830  /*
831  * We use ereport not elog here so that parameters aren't evaluated unless
832  * the message is going to be printed, which generally it isn't
833  */
834  ereport(DEBUG4,
835  (errmsg_internal("inserted -> %s",
836  OidOutputFunctionCall(typoutput, values[i]))));
837 }
838 
839 /* ----------------
840  * InsertOneNull
841  * ----------------
842  */
843 void
845 {
846  elog(DEBUG4, "inserting column %d NULL", i);
847  Assert(i >= 0 && i < MAXATTR);
848  if (TupleDescAttr(boot_reldesc->rd_att, i)->attnotnull)
849  elog(ERROR,
850  "NULL value specified for not-null column \"%s\" of relation \"%s\"",
851  NameStr(TupleDescAttr(boot_reldesc->rd_att, i)->attname),
852  RelationGetRelationName(boot_reldesc));
853  values[i] = PointerGetDatum(NULL);
854  Nulls[i] = true;
855 }
856 
857 /* ----------------
858  * cleanup
859  * ----------------
860  */
861 static void
862 cleanup(void)
863 {
864  if (boot_reldesc != NULL)
865  closerel(NULL);
866 }
867 
868 /* ----------------
869  * populate_typ_array
870  *
871  * Load the Typ array by reading pg_type.
872  * ----------------
873  */
874 static void
876 {
877  Relation rel;
878  TableScanDesc scan;
879  HeapTuple tup;
880  int nalloc;
881  int i;
882 
883  Assert(Typ == NULL);
884 
885  nalloc = 512;
886  Typ = (struct typmap **)
887  MemoryContextAlloc(TopMemoryContext, nalloc * sizeof(struct typmap *));
888 
889  rel = table_open(TypeRelationId, NoLock);
890  scan = table_beginscan_catalog(rel, 0, NULL);
891  i = 0;
892  while ((tup = heap_getnext(scan, ForwardScanDirection)) != NULL)
893  {
894  Form_pg_type typForm = (Form_pg_type) GETSTRUCT(tup);
895 
896  /* make sure there will be room for a trailing NULL pointer */
897  if (i >= nalloc - 1)
898  {
899  nalloc *= 2;
900  Typ = (struct typmap **)
901  repalloc(Typ, nalloc * sizeof(struct typmap *));
902  }
903  Typ[i] = (struct typmap *)
904  MemoryContextAlloc(TopMemoryContext, sizeof(struct typmap));
905  Typ[i]->am_oid = typForm->oid;
906  memcpy(&(Typ[i]->am_typ), typForm, sizeof(Typ[i]->am_typ));
907  i++;
908  }
909  Typ[i] = NULL; /* Fill trailing NULL pointer */
910  table_endscan(scan);
911  table_close(rel, NoLock);
912 }
913 
914 /* ----------------
915  * gettype
916  *
917  * NB: this is really ugly; it will return an integer index into TypInfo[],
918  * and not an OID at all, until the first reference to a type not known in
919  * TypInfo[]. At that point it will read and cache pg_type in the Typ array,
920  * and subsequently return a real OID (and set the global pointer Ap to
921  * point at the found row in Typ). So caller must check whether Typ is
922  * still NULL to determine what the return value is!
923  * ----------------
924  */
925 static Oid
926 gettype(char *type)
927 {
928  if (Typ != NULL)
929  {
930  struct typmap **app;
931 
932  for (app = Typ; *app != NULL; app++)
933  {
934  if (strncmp(NameStr((*app)->am_typ.typname), type, NAMEDATALEN) == 0)
935  {
936  Ap = *app;
937  return (*app)->am_oid;
938  }
939  }
940  }
941  else
942  {
943  int i;
944 
945  for (i = 0; i < n_types; i++)
946  {
947  if (strncmp(type, TypInfo[i].name, NAMEDATALEN) == 0)
948  return i;
949  }
950  /* Not in TypInfo, so we'd better be able to read pg_type now */
951  elog(DEBUG4, "external type: %s", type);
953  return gettype(type);
954  }
955  elog(ERROR, "unrecognized type \"%s\"", type);
956  /* not reached, here to make compiler happy */
957  return 0;
958 }
959 
960 /* ----------------
961  * boot_get_type_io_data
962  *
963  * Obtain type I/O information at bootstrap time. This intentionally has
964  * almost the same API as lsyscache.c's get_type_io_data, except that
965  * we only support obtaining the typinput and typoutput routines, not
966  * the binary I/O routines. It is exported so that array_in and array_out
967  * can be made to work during early bootstrap.
968  * ----------------
969  */
970 void
972  int16 *typlen,
973  bool *typbyval,
974  char *typalign,
975  char *typdelim,
976  Oid *typioparam,
977  Oid *typinput,
978  Oid *typoutput)
979 {
980  if (Typ != NULL)
981  {
982  /* We have the boot-time contents of pg_type, so use it */
983  struct typmap **app;
984  struct typmap *ap;
985 
986  app = Typ;
987  while (*app && (*app)->am_oid != typid)
988  ++app;
989  ap = *app;
990  if (ap == NULL)
991  elog(ERROR, "type OID %u not found in Typ list", typid);
992 
993  *typlen = ap->am_typ.typlen;
994  *typbyval = ap->am_typ.typbyval;
995  *typalign = ap->am_typ.typalign;
996  *typdelim = ap->am_typ.typdelim;
997 
998  /* XXX this logic must match getTypeIOParam() */
999  if (OidIsValid(ap->am_typ.typelem))
1000  *typioparam = ap->am_typ.typelem;
1001  else
1002  *typioparam = typid;
1003 
1004  *typinput = ap->am_typ.typinput;
1005  *typoutput = ap->am_typ.typoutput;
1006  }
1007  else
1008  {
1009  /* We don't have pg_type yet, so use the hard-wired TypInfo array */
1010  int typeindex;
1011 
1012  for (typeindex = 0; typeindex < n_types; typeindex++)
1013  {
1014  if (TypInfo[typeindex].oid == typid)
1015  break;
1016  }
1017  if (typeindex >= n_types)
1018  elog(ERROR, "type OID %u not found in TypInfo", typid);
1019 
1020  *typlen = TypInfo[typeindex].len;
1021  *typbyval = TypInfo[typeindex].byval;
1022  *typalign = TypInfo[typeindex].align;
1023  /* We assume typdelim is ',' for all boot-time types */
1024  *typdelim = ',';
1025 
1026  /* XXX this logic must match getTypeIOParam() */
1027  if (OidIsValid(TypInfo[typeindex].elem))
1028  *typioparam = TypInfo[typeindex].elem;
1029  else
1030  *typioparam = typid;
1031 
1032  *typinput = TypInfo[typeindex].inproc;
1033  *typoutput = TypInfo[typeindex].outproc;
1034  }
1035 }
1036 
1037 /* ----------------
1038  * AllocateAttribute
1039  *
1040  * Note: bootstrap never sets any per-column ACLs, so we only need
1041  * ATTRIBUTE_FIXED_PART_SIZE space per attribute.
1042  * ----------------
1043  */
1044 static Form_pg_attribute
1046 {
1047  return (Form_pg_attribute)
1049 }
1050 
1051 /*
1052  * index_register() -- record an index that has been set up for building
1053  * later.
1054  *
1055  * At bootstrap time, we define a bunch of indexes on system catalogs.
1056  * We postpone actually building the indexes until just before we're
1057  * finished with initialization, however. This is because the indexes
1058  * themselves have catalog entries, and those have to be included in the
1059  * indexes on those catalogs. Doing it in two phases is the simplest
1060  * way of making sure the indexes have the right contents at the end.
1061  */
1062 void
1064  Oid ind,
1065  IndexInfo *indexInfo)
1066 {
1067  IndexList *newind;
1068  MemoryContext oldcxt;
1069 
1070  /*
1071  * XXX mao 10/31/92 -- don't gc index reldescs, associated info at
1072  * bootstrap time. we'll declare the indexes now, but want to create them
1073  * later.
1074  */
1075 
1076  if (nogc == NULL)
1077  nogc = AllocSetContextCreate(NULL,
1078  "BootstrapNoGC",
1080 
1081  oldcxt = MemoryContextSwitchTo(nogc);
1082 
1083  newind = (IndexList *) palloc(sizeof(IndexList));
1084  newind->il_heap = heap;
1085  newind->il_ind = ind;
1086  newind->il_info = (IndexInfo *) palloc(sizeof(IndexInfo));
1087 
1088  memcpy(newind->il_info, indexInfo, sizeof(IndexInfo));
1089  /* expressions will likely be null, but may as well copy it */
1090  newind->il_info->ii_Expressions =
1091  copyObject(indexInfo->ii_Expressions);
1092  newind->il_info->ii_ExpressionsState = NIL;
1093  /* predicate will likely be null, but may as well copy it */
1094  newind->il_info->ii_Predicate =
1095  copyObject(indexInfo->ii_Predicate);
1096  newind->il_info->ii_PredicateState = NULL;
1097  /* no exclusion constraints at bootstrap time, so no need to copy */
1098  Assert(indexInfo->ii_ExclusionOps == NULL);
1099  Assert(indexInfo->ii_ExclusionProcs == NULL);
1100  Assert(indexInfo->ii_ExclusionStrats == NULL);
1101 
1102  newind->il_next = ILHead;
1103  ILHead = newind;
1104 
1105  MemoryContextSwitchTo(oldcxt);
1106 }
1107 
1108 
1109 /*
1110  * build_indices -- fill in all the indexes registered earlier
1111  */
1112 void
1114 {
1115  for (; ILHead != NULL; ILHead = ILHead->il_next)
1116  {
1117  Relation heap;
1118  Relation ind;
1119 
1120  /* need not bother with locks during bootstrap */
1121  heap = table_open(ILHead->il_heap, NoLock);
1122  ind = index_open(ILHead->il_ind, NoLock);
1123 
1124  index_build(heap, ind, ILHead->il_info, false, false);
1125 
1126  index_close(ind, NoLock);
1127  table_close(heap, NoLock);
1128  }
1129 }
AuxProcType
Definition: miscadmin.h:414
void InitAuxiliaryProcess(void)
Definition: proc.c:511
struct _IndexList * il_next
Definition: bootstrap.c:181
signed short int16
Definition: c.h:362
#define IsValidWalSegSize(size)
Definition: xlog_internal.h:94
#define NIL
Definition: pg_list.h:65
void RelationMapFinishBootstrap(void)
Definition: relmapper.c:560
#define SIGQUIT
Definition: win32_port.h:160
#define BOOTCOL_NULL_FORCE_NULL
Definition: bootstrap.h:27
#define AllocSetContextCreate
Definition: memutils.h:170
Oid il_ind
Definition: bootstrap.c:179
int16 len
Definition: bootstrap.c:92
void table_close(Relation relation, LOCKMODE lockmode)
Definition: table.c:167
#define GETSTRUCT(TUP)
Definition: htup_details.h:655
List * ii_Predicate
Definition: execnodes.h:162
void WalWriterMain(void)
Definition: walwriter.c:88
bool attnotnull
Definition: pg_attribute.h:125
char align
Definition: bootstrap.c:94
TableScanDesc table_beginscan_catalog(Relation relation, int nkeys, struct ScanKeyData *key)
Definition: tableam.c:112
int numattr
Definition: bootstrap.c:75
char name[NAMEDATALEN]
Definition: bootstrap.c:89
BackendType MyBackendType
Definition: miscinit.c:62
void namestrcpy(Name name, const char *str)
Definition: name.c:233
#define RelationGetNumberOfAttributes(relation)
Definition: rel.h:462
#define PointerGetDatum(X)
Definition: postgres.h:556
#define TupleDescAttr(tupdesc, i)
Definition: tupdesc.h:92
ExprState * ii_PredicateState
Definition: execnodes.h:163
char * pstrdup(const char *in)
Definition: mcxt.c:1187
void CommitTransactionCommand(void)
Definition: xact.c:2947
char * psprintf(const char *fmt,...)
Definition: psprintf.c:46
void InitStandaloneProcess(const char *argv0)
Definition: miscinit.c:165
Relation boot_reldesc
Definition: bootstrap.c:72
void ParseLongOption(const char *string, char **name, char **value)
Definition: guc.c:10557
#define BOOTCOL_NULL_AUTO
Definition: bootstrap.h:26
void StartupProcessMain(void)
Definition: startup.c:170
int boot_yyparse(void)
static MemoryContext MemoryContextSwitchTo(MemoryContext context)
Definition: palloc.h:109
#define write_stderr(str)
Definition: parallel.c:186
static IndexList * ILHead
Definition: bootstrap.c:184
Oid * ii_ExclusionProcs
Definition: execnodes.h:165
void proc_exit(int code)
Definition: ipc.c:104
int errcode(int sqlerrcode)
Definition: elog.c:610
#define MemSet(start, val, len)
Definition: c.h:950
#define SetProcessingMode(mode)
Definition: miscadmin.h:399
void BootStrapXLOG(void)
Definition: xlog.c:5196
void BaseInit(void)
Definition: postinit.c:548
bool IgnoreSystemIndexes
Definition: miscinit.c:79
static MemoryContext nogc
Definition: bootstrap.c:168
HeapTuple heap_form_tuple(TupleDesc tupleDescriptor, Datum *values, bool *isnull)
Definition: heaptuple.c:1020
Oid inproc
Definition: bootstrap.c:97
void checkDataDir(void)
Definition: miscinit.c:302
void heap_freetuple(HeapTuple htup)
Definition: heaptuple.c:1338
NameData relname
Definition: pg_class.h:38
unsigned int Oid
Definition: postgres_ext.h:31
void closerel(char *name)
Definition: bootstrap.c:634
static void bootstrap_signals(void)
Definition: bootstrap.c:547
static struct typmap * Ap
Definition: bootstrap.c:163
const char * progname
Definition: pg_standby.c:36
#define DEBUG4
Definition: elog.h:22
#define OidIsValid(objectId)
Definition: c.h:652
#define BOOTCOL_NULL_FORCE_NOT_NULL
Definition: bootstrap.h:28
#define PANIC
Definition: elog.h:53
static void BootstrapModeMain(void)
Definition: bootstrap.c:491
int getopt(int nargc, char *const *nargv, const char *ostr)
Definition: getopt.c:71
FormData_pg_type
Definition: pg_type.h:248
static void populate_typ_array(void)
Definition: bootstrap.c:875
#define NAMEDATALEN
void WalReceiverMain(void)
Definition: walreceiver.c:178
List * ii_ExpressionsState
Definition: execnodes.h:161
void pfree(void *pointer)
Definition: mcxt.c:1057
char typalign
Definition: pg_type.h:170
int optind
Definition: getopt.c:50
void ConditionVariableCancelSleep(void)
void InsertOneValue(char *value, int i)
Definition: bootstrap.c:806
#define ERROR
Definition: elog.h:43
void CreateDataDirLockFile(bool amPostmaster)
Definition: miscinit.c:1273
NameData attname
Definition: pg_attribute.h:40
void InitXLOGAccess(void)
Definition: xlog.c:8342
Oid elem
Definition: bootstrap.c:91
#define MAXPGPATH
int MaxBackends
Definition: globals.c:136
#define ALLOCSET_DEFAULT_SIZES
Definition: memutils.h:192
Oid attcollation
Definition: pg_attribute.h:157
void InitProcess(void)
Definition: proc.c:301
struct _IndexList IndexList
#define NoLock
Definition: lockdefs.h:34
char OutputFileName[MAXPGPATH]
Definition: globals.c:70
void SetConfigOption(const char *name, const char *value, GucContext context, GucSource source)
Definition: guc.c:7742
HeapTuple heap_getnext(TableScanDesc sscan, ScanDirection direction)
Definition: heapam.c:1286
void InsertOneTuple(void)
Definition: bootstrap.c:778
bool IsUnderPostmaster
Definition: globals.c:109
IndexInfo * il_info
Definition: bootstrap.c:180
char * flag(int b)
Definition: test-ctype.c:33
#define SIGHUP
Definition: win32_port.h:159
void before_shmem_exit(pg_on_exit_callback function, Datum arg)
Definition: ipc.c:333
#define RelationGetRelationName(relation)
Definition: rel.h:490
void ChangeToDataDir(void)
Definition: miscinit.c:416
FormData_pg_attribute * Form_pg_attribute
Definition: pg_attribute.h:193
unsigned int uint32
Definition: c.h:375
void boot_openrel(char *relname)
Definition: bootstrap.c:589
void pgstat_initialize(void)
Definition: pgstat.c:3024
static void pgstat_report_wait_end(void)
Definition: pgstat.h:1460
#define MAXATTR
Definition: bootstrap.h:24
#define ATTRIBUTE_FIXED_PART_SIZE
Definition: pg_attribute.h:185
void index_register(Oid heap, Oid ind, IndexInfo *indexInfo)
Definition: bootstrap.c:1063
void DefineAttr(char *name, char *type, int attnum, int nullness)
Definition: bootstrap.c:671
#define AssertArg(condition)
Definition: c.h:748
MemoryContext TopMemoryContext
Definition: mcxt.c:44
int16 attlen
Definition: pg_attribute.h:64
void simple_heap_insert(Relation relation, HeapTuple tup)
Definition: heapam.c:2384
#define WARNING
Definition: elog.h:40
Oid collation
Definition: bootstrap.c:96
static struct typmap ** Typ
Definition: bootstrap.c:162
static void ShutdownAuxiliaryProcess(int code, Datum arg)
Definition: bootstrap.c:570
uintptr_t Datum
Definition: postgres.h:367
bool SelectConfigFiles(const char *userDoption, const char *progname)
Definition: guc.c:5566
AuxProcType MyAuxProcType
Definition: bootstrap.c:70
static void cleanup(void)
Definition: bootstrap.c:862
TupleDesc rd_att
Definition: rel.h:110
void * MemoryContextAllocZero(MemoryContext context, Size size)
Definition: mcxt.c:840
Relation table_openrv(const RangeVar *relation, LOCKMODE lockmode)
Definition: table.c:102
#define InvalidOid
Definition: postgres_ext.h:36
void CheckpointerMain(void)
Definition: checkpointer.c:183
int16 attnum
Definition: pg_attribute.h:79
static struct @143 value
#define ereport(elevel,...)
Definition: elog.h:144
void InitPostgres(const char *in_dbname, Oid dboid, const char *username, Oid useroid, char *out_dbname, bool override_allow_connections)
Definition: postinit.c:590
pqsigfunc pqsignal(int signum, pqsigfunc handler)
Definition: signal.c:170
#define free(a)
Definition: header.h:65
size_t strlcpy(char *dst, const char *src, size_t siz)
Definition: strlcpy.c:45
int errmsg_internal(const char *fmt,...)
Definition: elog.c:908
#define SIG_DFL
Definition: win32_port.h:154
void index_build(Relation heapRelation, Relation indexRelation, IndexInfo *indexInfo, bool isreindex, bool parallel)
Definition: index.c:2821
List * ii_Expressions
Definition: execnodes.h:160
#define Assert(condition)
Definition: c.h:746
void StartTransactionCommand(void)
Definition: xact.c:2846
void CreateAuxProcessResourceOwner(void)
Definition: resowner.c:858
char storage
Definition: bootstrap.c:95
FormData_pg_type am_typ
Definition: bootstrap.c:159
void InitializeMaxBackends(void)
Definition: postinit.c:526
static Form_pg_attribute AllocateAttribute(void)
Definition: bootstrap.c:1045
static const int n_types
Definition: bootstrap.c:154
FormData_pg_type * Form_pg_type
Definition: pg_type.h:255
static const struct typinfo TypInfo[]
Definition: bootstrap.c:101
void * repalloc(void *pointer, Size size)
Definition: mcxt.c:1070
void BackgroundWriterMain(void)
Definition: bgwriter.c:94
bool byval
Definition: bootstrap.c:93
Oid il_heap
Definition: bootstrap.c:178
void index_close(Relation relation, LOCKMODE lockmode)
Definition: indexam.c:158
int WalSegSz
Definition: pg_standby.c:38
static const char * userDoption
Definition: postgres.c:157
static void table_endscan(TableScanDesc scan)
Definition: tableam.h:863
static Datum values[MAXATTR]
Definition: bootstrap.c:165
#define IsBootstrapProcessingMode()
Definition: miscadmin.h:393
void ProcSignalInit(int pss_idx)
Definition: procsignal.c:151
#define PG_DATA_CHECKSUM_VERSION
Definition: bufpage.h:200
static Oid gettype(char *type)
Definition: bootstrap.c:926
Oid * ii_ExclusionOps
Definition: execnodes.h:164
char * OidOutputFunctionCall(Oid functionId, Datum val)
Definition: fmgr.c:1657
Oid am_oid
Definition: bootstrap.c:158
void * palloc(Size size)
Definition: mcxt.c:950
int errmsg(const char *fmt,...)
Definition: elog.c:821
void pgstat_bestart(void)
Definition: pgstat.c:3066
char * optarg
Definition: getopt.c:52
void * MemoryContextAlloc(MemoryContext context, Size size)
Definition: mcxt.c:797
#define elog(elevel,...)
Definition: elog.h:214
int i
#define NameStr(name)
Definition: c.h:623
static void CheckerModeMain(void)
Definition: bootstrap.c:478
void * arg
void AuxiliaryProcessMain(int argc, char *argv[])
Definition: bootstrap.c:196
void InitBufferPoolBackend(void)
Definition: bufmgr.c:2524
uint32 bootstrap_data_checksum_version
Definition: bootstrap.c:53
Oid outproc
Definition: bootstrap.c:98
Oid oid
Definition: bootstrap.c:90
void init_ps_display(const char *fixed_part)
Definition: ps_status.c:258
void build_indices(void)
Definition: bootstrap.c:1113
void LWLockReleaseAll(void)
Definition: lwlock.c:1911
#define copyObject(obj)
Definition: nodes.h:644
TupleDesc CreateTupleDesc(int natts, Form_pg_attribute *attrs)
Definition: tupdesc.c:89
uint16 * ii_ExclusionStrats
Definition: execnodes.h:166
Relation table_open(Oid relationId, LOCKMODE lockmode)
Definition: table.c:39
void InsertOneNull(int i)
Definition: bootstrap.c:844
Datum OidInputFunctionCall(Oid functionId, char *str, Oid typioparam, int32 typmod)
Definition: fmgr.c:1648
Relation index_open(Oid relationId, LOCKMODE lockmode)
Definition: indexam.c:132
RangeVar * makeRangeVar(char *schemaname, char *relname, int location)
Definition: makefuncs.c:422
void InitializeGUCOptions(void)
Definition: guc.c:5344
void boot_get_type_io_data(Oid typid, int16 *typlen, bool *typbyval, char *typalign, char *typdelim, Oid *typioparam, Oid *typinput, Oid *typoutput)
Definition: bootstrap.c:971
static bool Nulls[MAXATTR]
Definition: bootstrap.c:166
Form_pg_attribute attrtypes[MAXATTR]
Definition: bootstrap.c:74