00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014 #ifndef HEAP_H
00015 #define HEAP_H
00016
00017 #include "parser/parse_node.h"
00018 #include "catalog/indexing.h"
00019
00020
00021 typedef struct RawColumnDefault
00022 {
00023 AttrNumber attnum;
00024 Node *raw_default;
00025 } RawColumnDefault;
00026
00027 typedef struct CookedConstraint
00028 {
00029 ConstrType contype;
00030 char *name;
00031 AttrNumber attnum;
00032 Node *expr;
00033 bool skip_validation;
00034 bool is_local;
00035 int inhcount;
00036 bool is_no_inherit;
00037
00038 } CookedConstraint;
00039
00040 extern Relation heap_create(const char *relname,
00041 Oid relnamespace,
00042 Oid reltablespace,
00043 Oid relid,
00044 Oid relfilenode,
00045 TupleDesc tupDesc,
00046 char relkind,
00047 char relpersistence,
00048 bool shared_relation,
00049 bool mapped_relation);
00050
00051 extern Oid heap_create_with_catalog(const char *relname,
00052 Oid relnamespace,
00053 Oid reltablespace,
00054 Oid relid,
00055 Oid reltypeid,
00056 Oid reloftypeid,
00057 Oid ownerid,
00058 TupleDesc tupdesc,
00059 List *cooked_constraints,
00060 char relkind,
00061 char relpersistence,
00062 bool shared_relation,
00063 bool mapped_relation,
00064 bool oidislocal,
00065 int oidinhcount,
00066 OnCommitAction oncommit,
00067 Datum reloptions,
00068 bool use_user_acl,
00069 bool allow_system_table_mods,
00070 bool is_internal);
00071
00072 extern void heap_create_init_fork(Relation rel);
00073 extern bool heap_is_matview_init_state(Relation rel);
00074
00075 extern void heap_drop_with_catalog(Oid relid);
00076
00077 extern void heap_truncate(List *relids);
00078
00079 extern void heap_truncate_one_rel(Relation rel);
00080
00081 extern void heap_truncate_check_FKs(List *relations, bool tempTables);
00082
00083 extern List *heap_truncate_find_FKs(List *relationIds);
00084
00085 extern void InsertPgAttributeTuple(Relation pg_attribute_rel,
00086 Form_pg_attribute new_attribute,
00087 CatalogIndexState indstate);
00088
00089 extern void InsertPgClassTuple(Relation pg_class_desc,
00090 Relation new_rel_desc,
00091 Oid new_rel_oid,
00092 Datum relacl,
00093 Datum reloptions);
00094
00095 extern List *AddRelationNewConstraints(Relation rel,
00096 List *newColDefaults,
00097 List *newConstraints,
00098 bool allow_merge,
00099 bool is_local,
00100 bool is_internal);
00101
00102 extern void StoreAttrDefault(Relation rel, AttrNumber attnum,
00103 Node *expr, bool is_internal);
00104
00105 extern Node *cookDefault(ParseState *pstate,
00106 Node *raw_default,
00107 Oid atttypid,
00108 int32 atttypmod,
00109 char *attname);
00110
00111 extern void DeleteRelationTuple(Oid relid);
00112 extern void DeleteAttributeTuples(Oid relid);
00113 extern void DeleteSystemAttributeTuples(Oid relid);
00114 extern void RemoveAttributeById(Oid relid, AttrNumber attnum);
00115 extern void RemoveAttrDefault(Oid relid, AttrNumber attnum,
00116 DropBehavior behavior, bool complain, bool internal);
00117 extern void RemoveAttrDefaultById(Oid attrdefId);
00118 extern void RemoveStatistics(Oid relid, AttrNumber attnum);
00119
00120 extern Form_pg_attribute SystemAttributeDefinition(AttrNumber attno,
00121 bool relhasoids);
00122
00123 extern Form_pg_attribute SystemAttributeByName(const char *attname,
00124 bool relhasoids);
00125
00126 extern void CheckAttributeNamesTypes(TupleDesc tupdesc, char relkind,
00127 bool allow_system_table_mods);
00128
00129 extern void CheckAttributeType(const char *attname,
00130 Oid atttypid, Oid attcollation,
00131 List *containing_rowtypes,
00132 bool allow_system_table_mods);
00133
00134 #endif