OSDN Git Service

b1f5dc8600c5645187ad3117ad2fa3428ffedd96
[pg-rex/syncrep.git] / src / include / catalog / heap.h
1 /*-------------------------------------------------------------------------
2  *
3  * heap.h
4  *        prototypes for functions in backend/catalog/heap.c
5  *
6  *
7  * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
8  * Portions Copyright (c) 1994, Regents of the University of California
9  *
10  * $Id: heap.h,v 1.56 2002/09/02 01:05:06 tgl Exp $
11  *
12  *-------------------------------------------------------------------------
13  */
14 #ifndef HEAP_H
15 #define HEAP_H
16
17 #include "catalog/pg_attribute.h"
18 #include "nodes/parsenodes.h"
19 #include "parser/parse_node.h"
20 #include "utils/rel.h"
21
22
23 typedef struct RawColumnDefault
24 {
25         AttrNumber      attnum;                 /* attribute to attach default to */
26         Node       *raw_default;        /* default value (untransformed parse
27                                                                  * tree) */
28 } RawColumnDefault;
29
30 extern Relation heap_create(const char *relname,
31                         Oid relnamespace,
32                         TupleDesc tupDesc,
33                         bool shared_relation,
34                         bool storage_create,
35                         bool allow_system_table_mods);
36
37 extern void heap_storage_create(Relation rel);
38
39 extern Oid heap_create_with_catalog(const char *relname,
40                                                  Oid relnamespace,
41                                                  TupleDesc tupdesc,
42                                                  char relkind,
43                                                  bool shared_relation,
44                                                  bool allow_system_table_mods);
45
46 extern void heap_drop_with_catalog(Oid rid);
47
48 extern void heap_truncate(Oid rid);
49
50 extern void AddRelationRawConstraints(Relation rel,
51                                                   List *rawColDefaults,
52                                                   List *rawConstraints);
53
54 extern Node *cookDefault(ParseState *pstate,
55                                                  Node *raw_default,
56                                                  Oid atttypid,
57                                                  int32 atttypmod,
58                                                  char *attname);
59
60 extern int      RemoveRelConstraints(Relation rel, const char *constrName,
61                                                                  DropBehavior behavior);
62
63 extern void DeleteRelationTuple(Oid relid);
64 extern void DeleteAttributeTuples(Oid relid);
65 extern void RemoveAttributeById(Oid relid, AttrNumber attnum);
66 extern void RemoveAttrDefault(Oid relid, AttrNumber attnum,
67                                                           DropBehavior behavior, bool complain);
68 extern void RemoveAttrDefaultById(Oid attrdefId);
69
70 extern Form_pg_attribute SystemAttributeDefinition(AttrNumber attno,
71                                                   bool relhasoids);
72
73 extern Form_pg_attribute SystemAttributeByName(const char *attname,
74                                           bool relhasoids);
75
76 #endif   /* HEAP_H */