70 #include "utils/fmgroids.h"
102 bool is_validated,
bool is_local,
int inhcount,
103 bool is_no_inherit,
bool is_internal);
107 bool allow_merge,
bool is_local,
111 Node *raw_constraint,
141 false,
'p',
's',
true,
false,
false,
true, 0
147 true,
'p',
'i',
true,
false,
false,
true, 0
153 true,
'p',
'i',
true,
false,
false,
true, 0
159 true,
'p',
'i',
true,
false,
false,
true, 0
165 true,
'p',
'i',
true,
false,
false,
true, 0
171 true,
'p',
'i',
true,
false,
false,
true, 0
183 true,
'p',
'i',
true,
false,
false,
true, 0
196 if (attno >= 0 || attno < -(
int)
lengthof(SysAtt))
197 elog(
ERROR,
"invalid system attribute number %d", attno);
199 elog(
ERROR,
"invalid system attribute number %d", attno);
200 return SysAtt[-attno - 1];
212 for (j = 0; j < (int)
lengthof(SysAtt); j++)
218 if (strcmp(
NameStr(att->attname), attname) == 0)
252 bool shared_relation,
253 bool mapped_relation,
254 bool allow_system_table_mods)
271 if (!allow_system_table_mods &&
276 (
errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
277 errmsg(
"permission denied to create \"%s.%s\"",
279 errdetail(
"System catalog modifications are currently disallowed.")));
290 create_storage =
false;
299 create_storage =
true;
308 create_storage =
true;
318 create_storage =
false;
404 bool allow_system_table_mods)
408 int natts = tupdesc->
natts;
413 (
errcode(ERRCODE_TOO_MANY_COLUMNS),
414 errmsg(
"tables can have at most %d columns",
415 MaxHeapAttributeNumber)));
425 for (i = 0; i < natts; i++)
430 (
errcode(ERRCODE_DUPLICATE_COLUMN),
431 errmsg(
"column name \"%s\" conflicts with a system column name",
439 for (i = 1; i < natts; i++)
441 for (j = 0; j <
i; j++)
446 (
errcode(ERRCODE_DUPLICATE_COLUMN),
447 errmsg(
"column name \"%s\" specified more than once",
455 for (i = 0; i < natts; i++)
458 tupdesc->
attrs[i]->atttypid,
459 tupdesc->
attrs[i]->attcollation,
461 allow_system_table_mods);
482 Oid atttypid,
Oid attcollation,
483 List *containing_rowtypes,
484 bool allow_system_table_mods)
496 (
errcode(ERRCODE_INVALID_TABLE_DEFINITION),
497 errmsg(
"column \"%s\" has type \"unknown\"", attname),
498 errdetail(
"Proceeding with relation creation anyway.")));
508 if (atttypid !=
ANYARRAYOID || !allow_system_table_mods)
510 (
errcode(ERRCODE_INVALID_TABLE_DEFINITION),
511 errmsg(
"column \"%s\" has pseudo-type %s",
521 allow_system_table_mods);
540 (
errcode(ERRCODE_INVALID_TABLE_DEFINITION),
541 errmsg(
"composite type %s cannot be made a member of itself",
544 containing_rowtypes =
lcons_oid(atttypid, containing_rowtypes);
550 for (i = 0; i < tupdesc->
natts; i++)
554 if (attr->attisdropped)
557 attr->atttypid, attr->attcollation,
559 allow_system_table_mods);
573 allow_system_table_mods);
582 (
errcode(ERRCODE_INVALID_TABLE_DEFINITION),
583 errmsg(
"no collation was derived for column \"%s\" with collatable type %s",
585 errhint(
"Use the COLLATE clause to set the collation explicitly.")));
610 memset(values, 0,
sizeof(values));
611 memset(nulls,
false,
sizeof(nulls));
642 if (indstate !=
NULL)
668 int natts = tupdesc->
natts;
683 for (i = 0; i < natts; i++)
687 attr->attrelid = new_rel_oid;
689 attr->attstattarget = -1;
690 attr->attcacheoff = -1;
699 referenced.
objectId = attr->atttypid;
708 referenced.
objectId = attr->attcollation;
721 for (i = 0; i < (int)
lengthof(SysAtt); i++)
733 attStruct.attrelid = new_rel_oid;
738 attStruct.attislocal = oidislocal;
739 attStruct.attinhcount = oidinhcount;
780 memset(values, 0,
sizeof(values));
781 memset(nulls,
false,
sizeof(nulls));
812 if (relacl != (
Datum) 0)
816 if (reloptions != (
Datum) 0)
861 new_rel_reltup = new_rel_desc->
rd_rel;
870 new_rel_reltup->relpages = 0;
871 new_rel_reltup->reltuples = 0;
872 new_rel_reltup->relallvisible = 0;
876 new_rel_reltup->relpages = 1;
877 new_rel_reltup->reltuples = 1;
878 new_rel_reltup->relallvisible = 0;
882 new_rel_reltup->relpages = 0;
883 new_rel_reltup->reltuples = 0;
884 new_rel_reltup->relallvisible = 0;
922 new_rel_reltup->relowner = relowner;
923 new_rel_reltup->reltype = new_type_oid;
924 new_rel_reltup->reloftype = reloftype;
1026 List *cooked_constraints,
1028 char relpersistence,
1029 bool shared_relation,
1030 bool mapped_relation,
1036 bool allow_system_table_mods,
1065 (
errcode(ERRCODE_DUPLICATE_TABLE),
1066 errmsg(
"relation \"%s\" already exists", relname)));
1082 errmsg(
"type \"%s\" already exists", relname),
1083 errhint(
"A relation has an associated type of the same name, "
1084 "so you must use a name that doesn't conflict "
1085 "with any existing type.")));
1092 elog(
ERROR,
"shared relations must be placed in pg_global tablespace");
1110 (
errcode(ERRCODE_INVALID_PARAMETER_VALUE),
1111 errmsg(
"pg_class heap OID value not set when in binary upgrade mode")));
1170 allow_system_table_mods);
1204 new_type_oid = new_type_addr.
objectId;
1206 *typaddress = new_type_addr;
1249 pfree(relarrayname);
1273 oidislocal, oidinhcount);
1305 referenced.
objectId = relnamespace;
1327 nnewmembers =
aclmembers(relacl, &newmembers);
1331 nnewmembers, newmembers);
1440 elog(
ERROR,
"cache lookup failed for relation %u", relid);
1560 elog(
ERROR,
"cache lookup failed for attribute %d of relation %u",
1575 attStruct->attisdropped =
true;
1589 attStruct->attnotnull =
false;
1592 attStruct->attstattarget = 0;
1597 snprintf(newattname,
sizeof(newattname),
1598 "........pg.dropped.%d........", attnum);
1599 namestrcpy(&(attStruct->attname), newattname);
1658 object.objectSubId = 0;
1669 if (complain && !found)
1670 elog(
ERROR,
"could not find attrdef tuple for relation %u attnum %d",
1707 elog(
ERROR,
"could not find tuple for attrdef %u", attrdefId);
1728 elog(
ERROR,
"cache lookup failed for attribute %d of relation %u",
1794 elog(
ERROR,
"cache lookup failed for foreign table %u", relid);
1862 Node *expr,
bool is_internal)
1869 static bool nulls[4] = {
false,
false,
false,
false};
1927 elog(
ERROR,
"cache lookup failed for attribute %d of relation %u",
1930 if (!attStruct->atthasdef)
1932 attStruct->atthasdef =
true;
1979 bool is_validated,
bool is_local,
int inhcount,
1980 bool is_no_inherit,
bool is_internal)
2018 foreach(vl, varList)
2023 for (j = 0; j <
i; j++)
2089 if (cooked_constraints ==
NIL)
2099 foreach(lc, cooked_constraints)
2118 elog(
ERROR,
"unrecognized constraint type: %d",
2155 List *newColDefaults,
2156 List *newConstraints,
2161 List *cookedConstraints =
NIL;
2177 oldconstr = tupleDesc->
constr;
2198 foreach(cell, newColDefaults)
2205 atp->atttypid, atp->atttypmod,
2230 cooked->
expr = expr;
2233 cooked->
inhcount = is_local ? 0 : 1;
2235 cookedConstraints =
lappend(cookedConstraints, cooked);
2241 numchecks = numoldchecks;
2243 foreach(cell, newConstraints)
2284 foreach(cell2, checknames)
2286 if (strcmp((
char *)
lfirst(cell2), ccname) == 0)
2289 errmsg(
"check constraint \"%s\" already exists",
2294 checknames =
lappend(checknames, ccname);
2303 allow_merge, is_local,
2342 checknames =
lappend(checknames, ccname);
2356 cooked->
conoid = constrOid;
2357 cooked->
name = ccname;
2359 cooked->
expr = expr;
2362 cooked->
inhcount = is_local ? 0 : 1;
2364 cookedConstraints =
lappend(cookedConstraints, cooked);
2376 return cookedConstraints;
2391 bool allow_merge,
bool is_local,
2432 conDesc->
rd_att, &isnull);
2439 if (!found || !allow_merge)
2442 errmsg(
"constraint \"%s\" for relation \"%s\" already exists",
2449 if (con->connoinherit)
2451 (
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
2452 errmsg(
"constraint \"%s\" conflicts with non-inherited constraint on relation \"%s\"",
2456 con->conislocal =
true;
2462 con->connoinherit =
true;
2466 (
errmsg(
"merging constraint \"%s\" with inherited definition",
2501 elog(
ERROR,
"cache lookup failed for relation %u",
2505 if (relStruct->relchecks != numchecks)
2507 relStruct->relchecks = numchecks;
2558 (
errcode(ERRCODE_INVALID_COLUMN_REFERENCE),
2559 errmsg(
"cannot use column references in default expression")));
2569 (
errcode(ERRCODE_DATATYPE_MISMATCH),
2570 errmsg(
"default expression must not return a set")));
2582 atttypid, atttypmod,
2588 (
errcode(ERRCODE_DATATYPE_MISMATCH),
2589 errmsg(
"column \"%s\" is of type %s"
2590 " but default expression is of type %s",
2594 errhint(
"You will need to rewrite or cast the expression.")));
2614 Node *raw_constraint,
2640 (
errcode(ERRCODE_INVALID_COLUMN_REFERENCE),
2641 errmsg(
"only table \"%s\" can be referenced in check constraint",
2726 index_build(heapRelation, currentIndex, indexInfo,
false,
true);
2749 foreach(cell, relids)
2755 relations =
lappend(relations, rel);
2762 foreach(cell, relations)
2795 toastrelid = rel->
rd_rel->reltoastrelid;
2833 foreach(cell, relations)
2837 if (rel->
rd_rel->relhastriggers)
2852 if (dependents ==
NIL)
2869 foreach(cell2, dependents)
2880 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
2881 errmsg(
"unsupported ON COMMIT and foreign key combination"),
2882 errdetail(
"Table \"%s\" references \"%s\", but they do not have the same ON COMMIT setting.",
2883 relname2, relname)));
2886 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
2887 errmsg(
"cannot truncate a table referenced in a foreign key constraint"),
2888 errdetail(
"Table \"%s\" references \"%s\".",
2890 errhint(
"Truncate table \"%s\" at the same time, "
2891 "or use TRUNCATE ... CASCADE.",
#define AttributeRelidNumIndexId
HeapTuple heap_copytuple(HeapTuple tuple)
static const Form_pg_attribute SysAtt[]
void updateAclDependencies(Oid classId, Oid objectId, int32 objsubId, Oid ownerId, int noldmembers, Oid *oldmembers, int nnewmembers, Oid *newmembers)
char * ChooseConstraintName(const char *name1, const char *name2, const char *label, Oid namespaceid, List *others)
#define Anum_pg_attribute_attrelid
#define Anum_pg_attribute_attinhcount
static bool MergeWithExistingConstraint(Relation rel, char *ccname, Node *expr, bool allow_merge, bool is_local, bool is_no_inherit)
#define Anum_pg_class_relhasindex
#define Anum_pg_inherits_inhrelid
#define CONSTRAINT_FOREIGN
#define Anum_pg_attribute_atttypid
#define Anum_pg_class_relpersistence
#define NamespaceRelationId
#define Anum_pg_attribute_attlen
void * stringToNode(char *str)
void register_on_commit_action(Oid relid, OnCommitAction action)
#define IsA(nodeptr, _type_)
char * makeArrayTypeName(const char *typeName, Oid typeNamespace)
static void SetRelationNumChecks(Relation rel, int numchecks)
int errhint(const char *fmt,...)
Relation RelationBuildLocalRelation(const char *relname, Oid relnamespace, TupleDesc tupDesc, Oid relid, Oid relfilenode, Oid reltablespace, bool shared_relation, bool mapped_relation, char relpersistence, char relkind)
void systable_endscan(SysScanDesc sysscan)
void smgrcreate(SMgrRelation reln, ForkNumber forknum, bool isRedo)
#define fastgetattr(tup, attnum, tupleDesc, isnull)
#define Anum_pg_class_relacl
#define MultiXactIdGetDatum(X)
#define RELPERSISTENCE_UNLOGGED
void CheckAttributeNamesTypes(TupleDesc tupdesc, char relkind, bool allow_system_table_mods)
#define Anum_pg_attribute_attbyval
Oid binary_upgrade_next_heap_pg_class_oid
Node * cookDefault(ParseState *pstate, Node *raw_default, Oid atttypid, int32 atttypmod, char *attname)
#define Anum_pg_attribute_attnum
bool equal(const void *a, const void *b)
#define RelationGetDescr(relation)
#define ObjectIdAttributeNumber
Oid binary_upgrade_next_toast_pg_class_oid
#define TYPTYPE_COMPOSITE
static Oid StoreRelCheck(Relation rel, char *ccname, Node *expr, bool is_validated, bool is_local, int inhcount, bool is_no_inherit, bool is_internal)
Oid get_element_type(Oid typid)
#define PointerGetDatum(X)
#define Anum_pg_class_reloptions
struct SMgrRelationData * rd_smgr
#define RelationRelationId
static Node * cookConstraint(ParseState *pstate, Node *raw_constraint, char *relname)
void heap_truncate_one_rel(Relation rel)
bool expression_returns_set(Node *clause)
#define Anum_pg_class_reltablespace
#define Anum_pg_attribute_atthasdef
Node * transformExpr(ParseState *pstate, Node *expr, ParseExprKind exprKind)
Form_pg_attribute * attrs
Form_pg_attribute SystemAttributeByName(const char *attname, bool relhasoids)
#define Anum_pg_attribute_attndims
#define GLOBALTABLESPACE_OID
static FormData_pg_attribute a3
#define AttrDefaultOidIndexId
#define AttributeRelationId
void remove_on_commit_action(Oid relid)
int errcode(int sqlerrcode)
#define Anum_pg_attribute_attacl
void heap_truncate_check_FKs(List *relations, bool tempTables)
#define Anum_pg_attrdef_adbin
char get_typtype(Oid typid)
void relation_close(Relation relation, LOCKMODE lockmode)
#define Anum_pg_statistic_staattnum
int snprintf(char *str, size_t count, const char *fmt,...) pg_attribute_printf(3
void RelationForgetRelation(Oid rid)
void recordDependencyOn(const ObjectAddress *depender, const ObjectAddress *referenced, DependencyType behavior)
List * pull_var_clause(Node *node, int flags)
HeapTuple heap_form_tuple(TupleDesc tupleDescriptor, Datum *values, bool *isnull)
List * lcons_oid(Oid datum, List *list)
List * list_union(const List *list1, const List *list2)
IndexInfo * BuildIndexInfo(Relation index)
bool contain_var_clause(Node *node)
void recordDependencyOnOwner(Oid classId, Oid objectId, Oid owner)
#define MinCommandIdAttributeNumber
#define Anum_pg_constraint_conname
static FormData_pg_attribute a7
bool IsToastNamespace(Oid namespaceId)
void heap_freetuple(HeapTuple htup)
int namestrcpy(Name name, const char *str)
List * lappend_oid(List *list, Oid datum)
#define OidIsValid(objectId)
#define Anum_pg_constraint_conbin
#define Anum_pg_class_relispopulated
#define Anum_pg_class_relnatts
SysScanDesc systable_beginscan(Relation heapRelation, Oid indexId, bool indexOK, Snapshot snapshot, int nkeys, ScanKey key)
#define Anum_pg_class_relnamespace
#define RELKIND_COMPOSITE_TYPE
#define SearchSysCache1(cacheId, key1)
#define Anum_pg_class_relfilenode
#define GetSysCacheOid2(cacheId, key1, key2)
#define BTLessEqualStrategyNumber
char * get_attname(Oid relid, AttrNumber attnum)
ParseState * make_parsestate(ParseState *parentParseState)
#define Anum_pg_attribute_attislocal
#define HeapTupleSetOid(tuple, oid)
static char * relname(char const *dir, char const *base)
#define Anum_pg_class_relhasrules
#define Anum_pg_class_relkind
void assign_expr_collations(ParseState *pstate, Node *expr)
#define Anum_pg_class_relhasoids
#define Anum_pg_attribute_attisdropped
void InsertPgClassTuple(Relation pg_class_desc, Relation new_rel_desc, Oid new_rel_oid, Datum relacl, Datum reloptions)
#define RelationOpenSmgr(relation)
HeapTuple systable_getnext(SysScanDesc sysscan)
Oid get_typ_typrelid(Oid typid)
void pfree(void *pointer)
#define ObjectIdGetDatum(X)
Relation heap_create(const char *relname, Oid relnamespace, Oid reltablespace, Oid relid, Oid relfilenode, TupleDesc tupDesc, char relkind, char relpersistence, bool shared_relation, bool mapped_relation, bool allow_system_table_mods)
#define Anum_pg_class_reltype
#define Anum_pg_attribute_attstattarget
#define Anum_pg_attribute_atttypmod
Node * coerce_to_target_type(ParseState *pstate, Node *expr, Oid exprtype, Oid targettype, int32 targettypmod, CoercionContext ccontext, CoercionForm cformat, int location)
#define Anum_pg_class_reloftype
Datum Float4GetDatum(float4 X)
#define AttrDefaultIndexId
#define TYPCATEGORY_ARRAY
const ObjectAddress * object
Oid get_relname_relid(const char *relname, Oid relnamespace)
RelFileNodeBackend smgr_rnode
ListCell * lappend_cell_oid(List *list, ListCell *prev, Oid datum)
char * get_namespace_name(Oid nspid)
bool moveArrayTypeName(Oid typeOid, const char *typeName, Oid typeNamespace)
#define IsNormalProcessingMode()
#define Anum_pg_class_relname
void heap_create_init_fork(Relation rel)
#define DEFAULT_COLLATION_OID
List * deparse_context_for(const char *aliasname, Oid relid)
int errdetail(const char *fmt,...)
Acl * get_user_default_acl(GrantObjectType objtype, Oid ownerId, Oid nsp_oid)
#define CStringGetDatum(X)
void recordDependencyOnExpr(const ObjectAddress *depender, Node *expr, List *rtable, DependencyType behavior)
void RemoveAttributeById(Oid relid, AttrNumber attnum)
void performDeletion(const ObjectAddress *object, DropBehavior behavior, int flags)
static ObjectAddress AddNewRelationType(const char *typeName, Oid typeNamespace, Oid new_rel_oid, char new_rel_kind, Oid ownerid, Oid new_row_type, Oid new_array_type)
#define InvalidTransactionId
static void StoreConstraints(Relation rel, List *cooked_constraints, bool is_internal)
#define RelationGetRelationName(relation)
static ListCell * list_head(const List *l)
FormData_pg_attribute * Form_pg_attribute
#define TableOidAttributeNumber
#define Anum_pg_class_relpages
#define RELKIND_FOREIGN_TABLE
#define Anum_pg_class_relminmxid
void CheckTableNotInUse(Relation rel, const char *stmt)
#define Anum_pg_statistic_starelid
void RemoveAttrDefaultById(Oid attrdefId)
#define ereport(elevel, rest)
static void AddNewAttributeTuples(Oid new_rel_oid, TupleDesc tupdesc, char relkind, bool oidislocal, int oidinhcount)
void addRTEtoQuery(ParseState *pstate, RangeTblEntry *rte, bool addToJoinList, bool addToRelNameSpace, bool addToVarNameSpace)
#define MaxCommandIdAttributeNumber
#define MaxTransactionIdAttributeNumber
List * lappend(List *list, void *datum)
void CheckAttributeType(const char *attname, Oid atttypid, Oid attcollation, List *containing_rowtypes, bool allow_system_table_mods)
FormData_pg_attrdef * Form_pg_attrdef
void index_build(Relation heapRelation, Relation indexRelation, IndexInfo *indexInfo, bool isprimary, bool isreindex)
#define Anum_pg_attribute_attcacheoff
#define Anum_pg_class_relreplident
#define TextDatumGetCString(d)
#define TransactionIdGetDatum(X)
MultiXactId GetOldestMultiXactId(void)
#define Anum_pg_class_relhassubclass
static FormData_pg_attribute a4
#define TYPCATEGORY_COMPOSITE
#define RELKIND_TOASTVALUE
void RelationDropStorage(Relation rel)
#define Anum_pg_class_relisshared
void CommandCounterIncrement(void)
void ReleaseSysCache(HeapTuple tuple)
#define StatisticRelationId
#define Anum_pg_attrdef_adsrc
#define list_make1_oid(x1)
#define Anum_pg_class_reltuples
#define Anum_pg_attribute_attalign
Oid simple_heap_insert(Relation relation, HeapTuple tup)
#define Anum_pg_constraint_connamespace
Relation heap_open(Oid relationId, LOCKMODE lockmode)
#define InvalidMultiXactId
#define InvokeObjectPostCreateHookArg(classId, objectId, subId, is_internal)
#define CollationRelationId
static FormData_pg_attribute a6
bool IsSystemNamespace(Oid namespaceId)
Form_pg_attribute SystemAttributeDefinition(AttrNumber attno, bool relhasoids)
#define Anum_pg_attrdef_adrelid
void DeleteRelationTuple(Oid relid)
#define ConstraintNameNspIndexId
static FormData_pg_attribute a1
#define MaxHeapAttributeNumber
#define Anum_pg_attrdef_adnum
FormData_pg_constraint * Form_pg_constraint
bool list_member_oid(const List *list, Oid datum)
#define HeapTupleIsValid(tuple)
int aclmembers(const Acl *acl, Oid **roleids)
#define Anum_pg_attribute_attnotnull
#define Assert(condition)
static void RelationRemoveInheritance(Oid relid)
#define StatisticRelidAttnumInhIndexId
#define Anum_pg_class_relhaspkey
#define Anum_pg_class_relallvisible
void CatalogUpdateIndexes(Relation heapRel, HeapTuple heapTuple)
void recordDependencyOnCurrentExtension(const ObjectAddress *object, bool isReplace)
CatalogIndexState CatalogOpenIndexes(Relation heapRel)
struct ItemPointerData ItemPointerData
char * deparse_expression(Node *expr, List *dpcontext, bool forceprefix, bool showimplicit)
static List * insert_ordered_unique_oid(List *list, Oid datum)
#define InheritsRelidSeqnoIndexId
Oid exprType(const Node *expr)
void heap_truncate(List *relids)
static int list_length(const List *l)
void simple_heap_delete(Relation relation, ItemPointer tid)
void simple_heap_update(Relation relation, ItemPointer otid, HeapTuple tup)
Oid GetNewRelFileNode(Oid reltablespace, Relation pg_class, char relpersistence)
RangeTblEntry * addRangeTableEntryForRelation(ParseState *pstate, Relation rel, Alias *alias, bool inh, bool inFromCl)
void CheckTableForSerializableConflictIn(Relation relation)
void DeleteAttributeTuples(Oid relid)
List * RelationGetIndexList(Relation relation)
#define Anum_pg_class_reltoastrelid
#define Anum_pg_attribute_attfdwoptions
Oid AssignTypeArrayOid(void)
void CatalogIndexInsert(CatalogIndexState indstate, HeapTuple heapTuple)
#define InheritsRelationId
void index_close(Relation relation, LOCKMODE lockmode)
static void AddNewRelationTuple(Relation pg_class_desc, Relation new_rel_desc, Oid new_rel_oid, Oid new_type_oid, Oid reloftype, Oid relowner, char relkind, Datum relacl, Datum reloptions)
#define DatumGetPointer(X)
void CacheInvalidateRelcache(Relation relation)
void RemoveStatistics(Oid relid, AttrNumber attnum)
static Datum values[MAXATTR]
#define IsBootstrapProcessingMode()
FormData_pg_class * Form_pg_class
#define SearchSysCacheCopy1(cacheId, key1)
#define AccessExclusiveLock
void InsertPgAttributeTuple(Relation pg_attribute_rel, Form_pg_attribute new_attribute, CatalogIndexState indstate)
#define Anum_pg_attribute_attoptions
int errmsg(const char *fmt,...)
#define Anum_pg_class_relforcerowsecurity
ObjectAddress TypeCreate(Oid newTypeOid, const char *typeName, Oid typeNamespace, Oid relationOid, char relationKind, Oid ownerId, int16 internalSize, char typeType, char typeCategory, bool typePreferred, char typDelim, Oid inputProcedure, Oid outputProcedure, Oid receiveProcedure, Oid sendProcedure, Oid typmodinProcedure, Oid typmodoutProcedure, Oid analyzeProcedure, Oid elementType, bool isImplicitArray, Oid arrayType, Oid baseType, const char *defaultTypeValue, char *defaultTypeBin, bool passedByValue, char alignment, char storage, int32 typeMod, int32 typNDims, bool typeNotNull, Oid typeCollation)
#define ForeignTableRelationId
void DeleteSystemAttributeTuples(Oid relid)
Oid heap_create_with_catalog(const char *relname, Oid relnamespace, Oid reltablespace, Oid relid, Oid reltypeid, Oid reloftypeid, Oid ownerid, TupleDesc tupdesc, List *cooked_constraints, char relkind, char relpersistence, bool shared_relation, bool mapped_relation, bool oidislocal, int oidinhcount, OnCommitAction oncommit, Datum reloptions, bool use_user_acl, bool allow_system_table_mods, bool is_internal, ObjectAddress *typaddress)
void log_smgrcreate(RelFileNode *rnode, ForkNumber forkNum)
void ScanKeyInit(ScanKey entry, AttrNumber attributeNumber, StrategyNumber strategy, RegProcedure procedure, Datum argument)
#define CStringGetTextDatum(s)
char * nodeToString(const void *obj)
#define Anum_pg_class_relam
Relation relation_open(Oid relationId, LOCKMODE lockmode)
void CatalogCloseIndexes(CatalogIndexState indstate)
#define Anum_pg_class_relfrozenxid
#define Natts_pg_attribute
#define ConstraintRelationId
#define Anum_pg_attribute_attcollation
void RemoveAttrDefault(Oid relid, AttrNumber attnum, DropBehavior behavior, bool complain, bool internal)
#define SelfItemPointerAttributeNumber
#define HeapTupleGetOid(tuple)
#define Anum_pg_attribute_attstorage
#define Anum_pg_class_relhastriggers
Oid StoreAttrDefault(Relation rel, AttrNumber attnum, Node *expr, bool is_internal)
#define RELPERSISTENCE_TEMP
#define SearchSysCacheCopy2(cacheId, key1, key2)
#define AttrDefaultRelationId
Oid getBaseType(Oid typid)
void heap_drop_with_catalog(Oid relid)
#define MinTransactionIdAttributeNumber
bool type_is_collatable(Oid typid)
#define ERRCODE_DUPLICATE_OBJECT
char * get_rel_name(Oid relid)
#define Anum_pg_class_relchecks
void smgrimmedsync(SMgrRelation reln, ForkNumber forknum)
void RelationCreateStorage(RelFileNode rnode, char relpersistence)
static FormData_pg_attribute a5
#define RelationGetRelid(relation)
#define Anum_pg_class_relrowsecurity
Oid CreateConstraintEntry(const char *constraintName, Oid constraintNamespace, char constraintType, bool isDeferrable, bool isDeferred, bool isValidated, Oid relId, const int16 *constraintKey, int constraintNKeys, Oid domainId, Oid indexRelId, Oid foreignRelId, const int16 *foreignKey, const Oid *pfEqOp, const Oid *ppEqOp, const Oid *ffEqOp, int foreignNKeys, char foreignUpdateType, char foreignDeleteType, char foreignMatchType, const Oid *exclOp, Node *conExpr, const char *conBin, const char *conSrc, bool conIsLocal, int conInhCount, bool conNoInherit, bool is_internal)
Relation index_open(Oid relationId, LOCKMODE lockmode)
List * AddRelationNewConstraints(Relation rel, List *newColDefaults, List *newConstraints, bool allow_merge, bool is_local, bool is_internal)
#define BTEqualStrategyNumber
#define Anum_pg_attribute_attname
List * heap_truncate_find_FKs(List *relationIds)
List * list_delete_first(List *list)
#define PERFORM_DELETION_INTERNAL
static void RelationTruncateIndexes(Relation heapRelation)
#define Anum_pg_class_relowner
static FormData_pg_attribute a2
void RelationTruncate(Relation rel, BlockNumber nblocks)
#define RelationGetNamespace(relation)
Node * coerce_to_boolean(ParseState *pstate, Node *node, const char *constructName)