1996-08-28 03:59:28 +02:00
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
*
|
1999-02-14 00:22:53 +01:00
|
|
|
* heap.h
|
2001-10-23 00:47:57 +02:00
|
|
|
* prototypes for functions in backend/catalog/heap.c
|
1996-08-28 03:59:28 +02:00
|
|
|
*
|
|
|
|
*
|
2010-01-02 17:58:17 +01:00
|
|
|
* Portions Copyright (c) 1996-2010, PostgreSQL Global Development Group
|
2000-01-26 06:58:53 +01:00
|
|
|
* Portions Copyright (c) 1994, Regents of the University of California
|
1996-08-28 03:59:28 +02:00
|
|
|
*
|
2010-01-02 17:58:17 +01:00
|
|
|
* $PostgreSQL: pgsql/src/include/catalog/heap.h,v 1.95 2010/01/02 16:58:01 momjian Exp $
|
1996-08-28 03:59:28 +02:00
|
|
|
*
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
#ifndef HEAP_H
|
|
|
|
#define HEAP_H
|
|
|
|
|
2002-03-19 03:18:25 +01:00
|
|
|
#include "parser/parse_node.h"
|
2008-11-14 02:57:42 +01:00
|
|
|
#include "catalog/indexing.h"
|
1996-11-05 12:23:43 +01:00
|
|
|
|
2002-03-26 20:17:02 +01:00
|
|
|
|
1999-10-04 01:55:40 +02:00
|
|
|
typedef struct RawColumnDefault
|
|
|
|
{
|
|
|
|
AttrNumber attnum; /* attribute to attach default to */
|
2005-10-15 04:49:52 +02:00
|
|
|
Node *raw_default; /* default value (untransformed parse tree) */
|
1999-10-04 01:55:40 +02:00
|
|
|
} RawColumnDefault;
|
|
|
|
|
2004-05-05 06:48:48 +02:00
|
|
|
typedef struct CookedConstraint
|
|
|
|
{
|
|
|
|
ConstrType contype; /* CONSTR_DEFAULT or CONSTR_CHECK */
|
|
|
|
char *name; /* name, or NULL if none */
|
|
|
|
AttrNumber attnum; /* which attr (only for DEFAULT) */
|
|
|
|
Node *expr; /* transformed default or check expr */
|
2008-05-10 01:32:05 +02:00
|
|
|
bool is_local; /* constraint has local (non-inherited) def */
|
|
|
|
int inhcount; /* number of times constraint is inherited */
|
2004-05-05 06:48:48 +02:00
|
|
|
} CookedConstraint;
|
|
|
|
|
2002-03-31 08:26:32 +02:00
|
|
|
extern Relation heap_create(const char *relname,
|
|
|
|
Oid relnamespace,
|
2004-06-18 08:14:31 +02:00
|
|
|
Oid reltablespace,
|
2005-04-14 03:38:22 +02:00
|
|
|
Oid relid,
|
2002-03-26 20:17:02 +01:00
|
|
|
TupleDesc tupDesc,
|
2004-08-31 19:10:36 +02:00
|
|
|
char relkind,
|
2002-04-27 23:24:34 +02:00
|
|
|
bool shared_relation,
|
2001-03-22 05:01:46 +01:00
|
|
|
bool allow_system_table_mods);
|
2000-07-04 08:11:54 +02:00
|
|
|
|
2002-03-31 08:26:32 +02:00
|
|
|
extern Oid heap_create_with_catalog(const char *relname,
|
|
|
|
Oid relnamespace,
|
2004-06-18 08:14:31 +02:00
|
|
|
Oid reltablespace,
|
2005-04-14 03:38:22 +02:00
|
|
|
Oid relid,
|
2009-09-27 00:42:03 +02:00
|
|
|
Oid reltypeid,
|
2005-08-26 05:08:15 +02:00
|
|
|
Oid ownerid,
|
2002-03-26 20:17:02 +01:00
|
|
|
TupleDesc tupdesc,
|
2008-05-10 01:32:05 +02:00
|
|
|
List *cooked_constraints,
|
2002-03-31 08:26:32 +02:00
|
|
|
char relkind,
|
2002-04-27 23:24:34 +02:00
|
|
|
bool shared_relation,
|
2004-03-23 20:35:17 +01:00
|
|
|
bool oidislocal,
|
|
|
|
int oidinhcount,
|
2002-11-11 23:19:25 +01:00
|
|
|
OnCommitAction oncommit,
|
2006-07-04 00:45:41 +02:00
|
|
|
Datum reloptions,
|
2009-10-05 21:24:49 +02:00
|
|
|
bool use_user_acl,
|
2006-07-04 00:45:41 +02:00
|
|
|
bool allow_system_table_mods);
|
2000-07-04 08:11:54 +02:00
|
|
|
|
2004-08-28 23:05:26 +02:00
|
|
|
extern void heap_drop_with_catalog(Oid relid);
|
1996-08-28 03:59:28 +02:00
|
|
|
|
2005-01-27 04:19:37 +01:00
|
|
|
extern void heap_truncate(List *relids);
|
1996-08-28 03:59:28 +02:00
|
|
|
|
2009-08-23 21:23:41 +02:00
|
|
|
extern void heap_truncate_one_rel(Relation rel);
|
|
|
|
|
2005-01-27 04:19:37 +01:00
|
|
|
extern void heap_truncate_check_FKs(List *relations, bool tempTables);
|
2003-09-19 23:04:20 +02:00
|
|
|
|
2006-03-03 04:30:54 +01:00
|
|
|
extern List *heap_truncate_find_FKs(List *relationIds);
|
|
|
|
|
2008-11-14 02:57:42 +01:00
|
|
|
extern void InsertPgAttributeTuple(Relation pg_attribute_rel,
|
2009-06-11 16:49:15 +02:00
|
|
|
Form_pg_attribute new_attribute,
|
|
|
|
CatalogIndexState indstate);
|
2008-11-14 02:57:42 +01:00
|
|
|
|
2006-07-04 00:45:41 +02:00
|
|
|
extern void InsertPgClassTuple(Relation pg_class_desc,
|
|
|
|
Relation new_rel_desc,
|
|
|
|
Oid new_rel_oid,
|
2009-10-05 21:24:49 +02:00
|
|
|
Datum relacl,
|
2006-07-04 00:45:41 +02:00
|
|
|
Datum reloptions);
|
|
|
|
|
2008-05-10 01:32:05 +02:00
|
|
|
extern List *AddRelationNewConstraints(Relation rel,
|
|
|
|
List *newColDefaults,
|
|
|
|
List *newConstraints,
|
|
|
|
bool allow_merge,
|
|
|
|
bool is_local);
|
1999-10-04 01:55:40 +02:00
|
|
|
|
2008-05-10 01:32:05 +02:00
|
|
|
extern void StoreAttrDefault(Relation rel, AttrNumber attnum, Node *expr);
|
2004-05-05 06:48:48 +02:00
|
|
|
|
2002-03-20 20:45:13 +01:00
|
|
|
extern Node *cookDefault(ParseState *pstate,
|
2002-09-04 22:31:48 +02:00
|
|
|
Node *raw_default,
|
|
|
|
Oid atttypid,
|
|
|
|
int32 atttypmod,
|
|
|
|
char *attname);
|
2002-03-19 03:18:25 +01:00
|
|
|
|
2002-07-14 23:08:08 +02:00
|
|
|
extern void DeleteRelationTuple(Oid relid);
|
|
|
|
extern void DeleteAttributeTuples(Oid relid);
|
2002-08-02 20:15:10 +02:00
|
|
|
extern void RemoveAttributeById(Oid relid, AttrNumber attnum);
|
2002-07-15 18:33:32 +02:00
|
|
|
extern void RemoveAttrDefault(Oid relid, AttrNumber attnum,
|
2002-09-04 22:31:48 +02:00
|
|
|
DropBehavior behavior, bool complain);
|
2002-07-15 18:33:32 +02:00
|
|
|
extern void RemoveAttrDefaultById(Oid attrdefId);
|
2004-08-28 23:05:26 +02:00
|
|
|
extern void RemoveStatistics(Oid relid, AttrNumber attnum);
|
2002-07-14 23:08:08 +02:00
|
|
|
|
2001-08-10 20:57:42 +02:00
|
|
|
extern Form_pg_attribute SystemAttributeDefinition(AttrNumber attno,
|
2001-10-25 07:50:21 +02:00
|
|
|
bool relhasoids);
|
2001-05-07 02:43:27 +02:00
|
|
|
|
2001-10-23 00:47:57 +02:00
|
|
|
extern Form_pg_attribute SystemAttributeByName(const char *attname,
|
2001-10-25 07:50:21 +02:00
|
|
|
bool relhasoids);
|
2001-10-28 07:26:15 +01:00
|
|
|
|
2002-12-16 19:39:22 +01:00
|
|
|
extern void CheckAttributeNamesTypes(TupleDesc tupdesc, char relkind);
|
|
|
|
|
|
|
|
extern void CheckAttributeType(const char *attname, Oid atttypid);
|
|
|
|
|
2001-11-05 18:46:40 +01:00
|
|
|
#endif /* HEAP_H */
|