1 /*-------------------------------------------------------------------------
4 * prototypes for functions in backend/catalog/heap.c
7 * Portions Copyright (c) 1996-2011, PostgreSQL Global Development Group
8 * Portions Copyright (c) 1994, Regents of the University of California
10 * src/include/catalog/heap.h
12 *-------------------------------------------------------------------------
17 #include "parser/parse_node.h"
18 #include "catalog/indexing.h"
21 typedef struct RawColumnDefault
23 AttrNumber attnum; /* attribute to attach default to */
24 Node *raw_default; /* default value (untransformed parse tree) */
27 typedef struct CookedConstraint
29 ConstrType contype; /* CONSTR_DEFAULT or CONSTR_CHECK */
30 char *name; /* name, or NULL if none */
31 AttrNumber attnum; /* which attr (only for DEFAULT) */
32 Node *expr; /* transformed default or check expr */
33 bool is_local; /* constraint has local (non-inherited) def */
34 int inhcount; /* number of times constraint is inherited */
37 extern Relation heap_create(const char *relname,
46 bool allow_system_table_mods);
48 extern Oid heap_create_with_catalog(const char *relname,
56 List *cooked_constraints,
63 OnCommitAction oncommit,
66 bool allow_system_table_mods);
68 extern void heap_drop_with_catalog(Oid relid);
70 extern void heap_truncate(List *relids);
72 extern void heap_truncate_one_rel(Relation rel);
74 extern void heap_truncate_check_FKs(List *relations, bool tempTables);
76 extern List *heap_truncate_find_FKs(List *relationIds);
78 extern void InsertPgAttributeTuple(Relation pg_attribute_rel,
79 Form_pg_attribute new_attribute,
80 CatalogIndexState indstate);
82 extern void InsertPgClassTuple(Relation pg_class_desc,
83 Relation new_rel_desc,
88 extern List *AddRelationNewConstraints(Relation rel,
94 extern void StoreAttrDefault(Relation rel, AttrNumber attnum, Node *expr);
96 extern Node *cookDefault(ParseState *pstate,
102 extern void DeleteRelationTuple(Oid relid);
103 extern void DeleteAttributeTuples(Oid relid);
104 extern void RemoveAttributeById(Oid relid, AttrNumber attnum);
105 extern void RemoveAttrDefault(Oid relid, AttrNumber attnum,
106 DropBehavior behavior, bool complain);
107 extern void RemoveAttrDefaultById(Oid attrdefId);
108 extern void RemoveStatistics(Oid relid, AttrNumber attnum);
110 extern Form_pg_attribute SystemAttributeDefinition(AttrNumber attno,
113 extern Form_pg_attribute SystemAttributeByName(const char *attname,
116 extern void CheckAttributeNamesTypes(TupleDesc tupdesc, char relkind,
117 bool allow_system_table_mods);
119 extern void CheckAttributeType(const char *attname,
120 Oid atttypid, Oid attcollation,
121 List *containing_rowtypes,
122 bool allow_system_table_mods);