OSDN Git Service

rebuid:
[eos/hostdependX86MAC64.git] / util / X86MAC64 / include / postgresql / server / catalog / heap.h
1 /*-------------------------------------------------------------------------
2  *
3  * heap.h
4  *        prototypes for functions in backend/catalog/heap.c
5  *
6  *
7  * Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group
8  * Portions Copyright (c) 1994, Regents of the University of California
9  *
10  * src/include/catalog/heap.h
11  *
12  *-------------------------------------------------------------------------
13  */
14 #ifndef HEAP_H
15 #define HEAP_H
16
17 #include "parser/parse_node.h"
18 #include "catalog/indexing.h"
19
20
21 typedef struct RawColumnDefault
22 {
23         AttrNumber      attnum;                 /* attribute to attach default to */
24         Node       *raw_default;        /* default value (untransformed parse tree) */
25 } RawColumnDefault;
26
27 typedef struct CookedConstraint
28 {
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            skip_validation;        /* skip validation? (only for CHECK) */
34         bool            is_local;               /* constraint has local (non-inherited) def */
35         int                     inhcount;               /* number of times constraint is inherited */
36         bool            is_no_inherit;  /* constraint has local def and cannot be
37                                                                  * inherited */
38 } CookedConstraint;
39
40 extern Relation heap_create(const char *relname,
41                         Oid relnamespace,
42                         Oid reltablespace,
43                         Oid relid,
44                         Oid relfilenode,
45                         TupleDesc tupDesc,
46                         char relkind,
47                         char relpersistence,
48                         bool shared_relation,
49                         bool mapped_relation,
50                         bool allow_system_table_mods);
51
52 extern Oid heap_create_with_catalog(const char *relname,
53                                                  Oid relnamespace,
54                                                  Oid reltablespace,
55                                                  Oid relid,
56                                                  Oid reltypeid,
57                                                  Oid reloftypeid,
58                                                  Oid ownerid,
59                                                  TupleDesc tupdesc,
60                                                  List *cooked_constraints,
61                                                  char relkind,
62                                                  char relpersistence,
63                                                  bool shared_relation,
64                                                  bool mapped_relation,
65                                                  bool oidislocal,
66                                                  int oidinhcount,
67                                                  OnCommitAction oncommit,
68                                                  Datum reloptions,
69                                                  bool use_user_acl,
70                                                  bool allow_system_table_mods,
71                                                  bool is_internal);
72
73 extern void heap_create_init_fork(Relation rel);
74
75 extern void heap_drop_with_catalog(Oid relid);
76
77 extern void heap_truncate(List *relids);
78
79 extern void heap_truncate_one_rel(Relation rel);
80
81 extern void heap_truncate_check_FKs(List *relations, bool tempTables);
82
83 extern List *heap_truncate_find_FKs(List *relationIds);
84
85 extern void InsertPgAttributeTuple(Relation pg_attribute_rel,
86                                            Form_pg_attribute new_attribute,
87                                            CatalogIndexState indstate);
88
89 extern void InsertPgClassTuple(Relation pg_class_desc,
90                                    Relation new_rel_desc,
91                                    Oid new_rel_oid,
92                                    Datum relacl,
93                                    Datum reloptions);
94
95 extern List *AddRelationNewConstraints(Relation rel,
96                                                   List *newColDefaults,
97                                                   List *newConstraints,
98                                                   bool allow_merge,
99                                                   bool is_local,
100                                                   bool is_internal);
101
102 extern void StoreAttrDefault(Relation rel, AttrNumber attnum,
103                                  Node *expr, bool is_internal);
104
105 extern Node *cookDefault(ParseState *pstate,
106                         Node *raw_default,
107                         Oid atttypid,
108                         int32 atttypmod,
109                         char *attname);
110
111 extern void DeleteRelationTuple(Oid relid);
112 extern void DeleteAttributeTuples(Oid relid);
113 extern void DeleteSystemAttributeTuples(Oid relid);
114 extern void RemoveAttributeById(Oid relid, AttrNumber attnum);
115 extern void RemoveAttrDefault(Oid relid, AttrNumber attnum,
116                                   DropBehavior behavior, bool complain, bool internal);
117 extern void RemoveAttrDefaultById(Oid attrdefId);
118 extern void RemoveStatistics(Oid relid, AttrNumber attnum);
119
120 extern Form_pg_attribute SystemAttributeDefinition(AttrNumber attno,
121                                                   bool relhasoids);
122
123 extern Form_pg_attribute SystemAttributeByName(const char *attname,
124                                           bool relhasoids);
125
126 extern void CheckAttributeNamesTypes(TupleDesc tupdesc, char relkind,
127                                                  bool allow_system_table_mods);
128
129 extern void CheckAttributeType(const char *attname,
130                                    Oid atttypid, Oid attcollation,
131                                    List *containing_rowtypes,
132                                    bool allow_system_table_mods);
133
134 #endif   /* HEAP_H */