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