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