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