38 #include "utils/fmgroids.h"
87 {
"bool", BOOLOID, 0, 1,
true, TYPALIGN_CHAR, TYPSTORAGE_PLAIN,
InvalidOid,
89 {
"bytea", BYTEAOID, 0, -1,
false, TYPALIGN_INT, TYPSTORAGE_EXTENDED,
InvalidOid,
90 F_BYTEAIN, F_BYTEAOUT},
91 {
"char", CHAROID, 0, 1,
true, TYPALIGN_CHAR, TYPSTORAGE_PLAIN,
InvalidOid,
93 {
"int2", INT2OID, 0, 2,
true, TYPALIGN_SHORT, TYPSTORAGE_PLAIN,
InvalidOid,
95 {
"int4", INT4OID, 0, 4,
true, TYPALIGN_INT, TYPSTORAGE_PLAIN,
InvalidOid,
97 {
"float4", FLOAT4OID, 0, 4,
true, TYPALIGN_INT, TYPSTORAGE_PLAIN,
InvalidOid,
98 F_FLOAT4IN, F_FLOAT4OUT},
99 {
"name", NAMEOID, CHAROID,
NAMEDATALEN,
false, TYPALIGN_CHAR, TYPSTORAGE_PLAIN, C_COLLATION_OID,
100 F_NAMEIN, F_NAMEOUT},
101 {
"regclass", REGCLASSOID, 0, 4,
true, TYPALIGN_INT, TYPSTORAGE_PLAIN,
InvalidOid,
102 F_REGCLASSIN, F_REGCLASSOUT},
103 {
"regproc", REGPROCOID, 0, 4,
true, TYPALIGN_INT, TYPSTORAGE_PLAIN,
InvalidOid,
104 F_REGPROCIN, F_REGPROCOUT},
105 {
"regtype", REGTYPEOID, 0, 4,
true, TYPALIGN_INT, TYPSTORAGE_PLAIN,
InvalidOid,
106 F_REGTYPEIN, F_REGTYPEOUT},
107 {
"regrole", REGROLEOID, 0, 4,
true, TYPALIGN_INT, TYPSTORAGE_PLAIN,
InvalidOid,
108 F_REGROLEIN, F_REGROLEOUT},
109 {
"regnamespace", REGNAMESPACEOID, 0, 4,
true, TYPALIGN_INT, TYPSTORAGE_PLAIN,
InvalidOid,
110 F_REGNAMESPACEIN, F_REGNAMESPACEOUT},
111 {
"text", TEXTOID, 0, -1,
false, TYPALIGN_INT, TYPSTORAGE_EXTENDED, DEFAULT_COLLATION_OID,
112 F_TEXTIN, F_TEXTOUT},
113 {
"oid", OIDOID, 0, 4,
true, TYPALIGN_INT, TYPSTORAGE_PLAIN,
InvalidOid,
115 {
"tid", TIDOID, 0, 6,
false, TYPALIGN_SHORT, TYPSTORAGE_PLAIN,
InvalidOid,
117 {
"xid", XIDOID, 0, 4,
true, TYPALIGN_INT, TYPSTORAGE_PLAIN,
InvalidOid,
119 {
"cid", CIDOID, 0, 4,
true, TYPALIGN_INT, TYPSTORAGE_PLAIN,
InvalidOid,
121 {
"pg_node_tree", PG_NODE_TREEOID, 0, -1,
false, TYPALIGN_INT, TYPSTORAGE_EXTENDED, DEFAULT_COLLATION_OID,
122 F_PG_NODE_TREE_IN, F_PG_NODE_TREE_OUT},
123 {
"int2vector", INT2VECTOROID, INT2OID, -1,
false, TYPALIGN_INT, TYPSTORAGE_PLAIN,
InvalidOid,
124 F_INT2VECTORIN, F_INT2VECTOROUT},
125 {
"oidvector", OIDVECTOROID, OIDOID, -1,
false, TYPALIGN_INT, TYPSTORAGE_PLAIN,
InvalidOid,
126 F_OIDVECTORIN, F_OIDVECTOROUT},
127 {
"_int4", INT4ARRAYOID, INT4OID, -1,
false, TYPALIGN_INT, TYPSTORAGE_EXTENDED,
InvalidOid,
128 F_ARRAY_IN, F_ARRAY_OUT},
129 {
"_text", 1009, TEXTOID, -1,
false, TYPALIGN_INT, TYPSTORAGE_EXTENDED, DEFAULT_COLLATION_OID,
130 F_ARRAY_IN, F_ARRAY_OUT},
131 {
"_oid", 1028, OIDOID, -1,
false, TYPALIGN_INT, TYPSTORAGE_EXTENDED,
InvalidOid,
132 F_ARRAY_IN, F_ARRAY_OUT},
133 {
"_char", 1002, CHAROID, -1,
false, TYPALIGN_INT, TYPSTORAGE_EXTENDED,
InvalidOid,
134 F_ARRAY_IN, F_ARRAY_OUT},
135 {
"_aclitem", 1034, ACLITEMOID, -1,
false, TYPALIGN_INT, TYPSTORAGE_EXTENDED,
InvalidOid,
136 F_ARRAY_IN, F_ARRAY_OUT}
203 uint32 bootstrap_data_checksum_version = 0;
214 && (strcmp(argv[1],
"--boot") == 0
215 || strcmp(argv[1],
"--check") == 0));
219 while ((
flag =
getopt(argc, argv,
"B:c:d:D:Fkr:X:-:")) != -1)
237 (
errcode(ERRCODE_SYNTAX_ERROR),
238 errmsg(
"--%s requires a value",
242 (
errcode(ERRCODE_SYNTAX_ERROR),
243 errmsg(
"-c %s requires a value",
281 write_stderr(
"Try \"%s --help\" for more information.\n",
341 elog(
ERROR,
"backend is incorrectly linked to frontend functions");
440 elog(
DEBUG4,
"create attribute %d name %s len %d num %d type %u",
441 i,
NameStr(at->attname), at->attlen, at->attnum,
459 elog(
ERROR,
"close of %s when %s was expected",
463 elog(
ERROR,
"close of %s before any relation was opened",
468 elog(
ERROR,
"no open relation to close");
495 elog(
WARNING,
"no open relations allowed with CREATE command");
644 &typdelim, &typioparam,
645 &typinput, &typoutput);
669 "NULL value specified for not-null column \"%s\" of relation \"%s\"",
714 newtyp->
am_oid = typForm->oid;
715 memcpy(&newtyp->
am_typ, typForm,
sizeof(newtyp->
am_typ));
827 if (!ap || ap->
am_oid != typid)
828 elog(
ERROR,
"type OID %u not found in Typ list", typid);
830 *typlen = ap->
am_typ.typlen;
831 *typbyval = ap->
am_typ.typbyval;
833 *typdelim = ap->
am_typ.typdelim;
837 *typioparam = ap->
am_typ.typelem;
841 *typinput = ap->
am_typ.typinput;
842 *typoutput = ap->
am_typ.typoutput;
849 for (typeindex = 0; typeindex <
n_types; typeindex++)
851 if (
TypInfo[typeindex].oid == typid)
855 elog(
ERROR,
"type OID %u not found in TypInfo", typid);
#define write_stderr(str)
static Oid gettype(char *type)
static Datum values[MAXATTR]
void closerel(char *relname)
static void populate_typ_list(void)
static void CheckerModeMain(void)
void InsertOneValue(char *value, int i)
static void cleanup(void)
void InsertOneNull(int i)
static const struct typinfo TypInfo[]
static struct typmap * Ap
void InsertOneTuple(void)
struct _IndexList IndexList
static void bootstrap_signals(void)
Form_pg_attribute attrtypes[MAXATTR]
void boot_get_type_io_data(Oid typid, int16 *typlen, bool *typbyval, char *typalign, char *typdelim, Oid *typioparam, Oid *typinput, Oid *typoutput)
static Form_pg_attribute AllocateAttribute(void)
static MemoryContext nogc
void BootstrapModeMain(int argc, char *argv[], bool check_only)
void DefineAttr(char *name, char *type, int attnum, int nullness)
static bool Nulls[MAXATTR]
void index_register(Oid heap, Oid ind, const IndexInfo *indexInfo)
void boot_openrel(char *relname)
static IndexList * ILHead
#define BOOTCOL_NULL_FORCE_NULL
#define BOOTCOL_NULL_FORCE_NOT_NULL
#define BOOTCOL_NULL_AUTO
#define PG_DATA_CHECKSUM_VERSION
#define Assert(condition)
#define MemSet(start, val, len)
#define OidIsValid(objectId)
int errmsg_internal(const char *fmt,...)
int errcode(int sqlerrcode)
int errmsg(const char *fmt,...)
#define ereport(elevel,...)
Datum OidInputFunctionCall(Oid functionId, char *str, Oid typioparam, int32 typmod)
char * OidOutputFunctionCall(Oid functionId, Datum val)
char OutputFileName[MAXPGPATH]
void SetConfigOption(const char *name, const char *value, GucContext context, GucSource source)
bool SelectConfigFiles(const char *userDoption, const char *progname)
void ParseLongOption(const char *string, char **name, char **value)
void InitializeGUCOptions(void)
HeapTuple heap_getnext(TableScanDesc sscan, ScanDirection direction)
void simple_heap_insert(Relation relation, HeapTuple tup)
HeapTuple heap_form_tuple(TupleDesc tupleDescriptor, const Datum *values, const bool *isnull)
void heap_freetuple(HeapTuple htup)
void index_build(Relation heapRelation, Relation indexRelation, IndexInfo *indexInfo, bool isreindex, bool parallel)
void index_close(Relation relation, LOCKMODE lockmode)
Relation index_open(Oid relationId, LOCKMODE lockmode)
void CreateSharedMemoryAndSemaphores(void)
bool pg_link_canary_is_frontend(void)
List * lappend(List *list, void *datum)
void list_free_deep(List *list)
RangeVar * makeRangeVar(char *schemaname, char *relname, int location)
char * pstrdup(const char *in)
void pfree(void *pointer)
MemoryContext TopMemoryContext
void * MemoryContextAllocZero(MemoryContext context, Size size)
#define AllocSetContextCreate
#define ALLOCSET_DEFAULT_SIZES
#define SetProcessingMode(mode)
void ChangeToDataDir(void)
void InitStandaloneProcess(const char *argv0)
void CreateDataDirLockFile(bool amPostmaster)
void namestrcpy(Name name, const char *str)
#define ATTRIBUTE_FIXED_PART_SIZE
FormData_pg_attribute * Form_pg_attribute
int getopt(int nargc, char *const *nargv, const char *ostr)
PGDLLIMPORT char * optarg
FormData_pg_type * Form_pg_type
pqsigfunc pqsignal(int signo, pqsigfunc func)
size_t strlcpy(char *dst, const char *src, size_t siz)
static const char * userDoption
static Datum PointerGetDatum(const void *X)
void InitializeMaxBackends(void)
void InitPostgres(const char *in_dbname, Oid dboid, const char *username, Oid useroid, bits32 flags, char *out_dbname)
char * psprintf(const char *fmt,...)
MemoryContextSwitchTo(old_ctx)
#define RelationGetNumberOfAttributes(relation)
#define RelationGetRelationName(relation)
void RelationMapFinishBootstrap(void)
uint16 * ii_ExclusionStrats
ExprState * ii_PredicateState
List * ii_ExpressionsState
struct _IndexList * il_next
void table_close(Relation relation, LOCKMODE lockmode)
Relation table_open(Oid relationId, LOCKMODE lockmode)
Relation table_openrv(const RangeVar *relation, LOCKMODE lockmode)
TableScanDesc table_beginscan_catalog(Relation relation, int nkeys, struct ScanKeyData *key)
static void table_endscan(TableScanDesc scan)
#define InvalidCompressionMethod
TupleDesc CreateTupleDesc(int natts, Form_pg_attribute *attrs)
#define TupleDescAttr(tupdesc, i)
void StartTransactionCommand(void)
void CommitTransactionCommand(void)
void BootStrapXLOG(uint32 data_checksum_version)