Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes14kdownloads
heap.h160 linesDownload Raw Back to catalog
1/*-------------------------------------------------------------------------2 *3 * heap.h4 *	  prototypes for functions in backend/catalog/heap.c5 *6 *7 * Portions Copyright (c) 1996-2023, PostgreSQL Global Development Group8 * Portions Copyright (c) 1994, Regents of the University of California9 *10 * src/include/catalog/heap.h11 *12 *-------------------------------------------------------------------------13 */14#ifndef HEAP_H15#define HEAP_H16 17#include "catalog/indexing.h"18#include "catalog/objectaddress.h"19#include "parser/parse_node.h"20 21 22/* flag bits for CheckAttributeType/CheckAttributeNamesTypes */23#define CHKATYPE_ANYARRAY		0x01	/* allow ANYARRAY */24#define CHKATYPE_ANYRECORD		0x02	/* allow RECORD and RECORD[] */25#define CHKATYPE_IS_PARTKEY		0x04	/* attname is part key # not column */26 27typedef struct RawColumnDefault28{29	AttrNumber	attnum;			/* attribute to attach default to */30	Node	   *raw_default;	/* default value (untransformed parse tree) */31	bool		missingMode;	/* true if part of add column processing */32	char		generated;		/* attgenerated setting */33} RawColumnDefault;34 35typedef struct CookedConstraint36{37	ConstrType	contype;		/* CONSTR_DEFAULT or CONSTR_CHECK */38	Oid			conoid;			/* constr OID if created, otherwise Invalid */39	char	   *name;			/* name, or NULL if none */40	AttrNumber	attnum;			/* which attr (only for DEFAULT) */41	Node	   *expr;			/* transformed default or check expr */42	bool		skip_validation;	/* skip validation? (only for CHECK) */43	bool		is_local;		/* constraint has local (non-inherited) def */44	int			inhcount;		/* number of times constraint is inherited */45	bool		is_no_inherit;	/* constraint has local def and cannot be46								 * inherited */47} CookedConstraint;48 49extern Relation heap_create(const char *relname,50							Oid relnamespace,51							Oid reltablespace,52							Oid relid,53							RelFileNumber relfilenumber,54							Oid accessmtd,55							TupleDesc tupDesc,56							char relkind,57							char relpersistence,58							bool shared_relation,59							bool mapped_relation,60							bool allow_system_table_mods,61							TransactionId *relfrozenxid,62							MultiXactId *relminmxid,63							bool create_storage);64 65extern Oid	heap_create_with_catalog(const char *relname,66									 Oid relnamespace,67									 Oid reltablespace,68									 Oid relid,69									 Oid reltypeid,70									 Oid reloftypeid,71									 Oid ownerid,72									 Oid accessmtd,73									 TupleDesc tupdesc,74									 List *cooked_constraints,75									 char relkind,76									 char relpersistence,77									 bool shared_relation,78									 bool mapped_relation,79									 OnCommitAction oncommit,80									 Datum reloptions,81									 bool use_user_acl,82									 bool allow_system_table_mods,83									 bool is_internal,84									 Oid relrewrite,85									 ObjectAddress *typaddress);86 87extern void heap_drop_with_catalog(Oid relid);88 89extern void heap_truncate(List *relids);90 91extern void heap_truncate_one_rel(Relation rel);92 93extern void heap_truncate_check_FKs(List *relations, bool tempTables);94 95extern List *heap_truncate_find_FKs(List *relationIds);96 97extern void InsertPgAttributeTuples(Relation pg_attribute_rel,98									TupleDesc tupdesc,99									Oid new_rel_oid,100									Datum *attoptions,101									CatalogIndexState indstate);102 103extern void InsertPgClassTuple(Relation pg_class_desc,104							   Relation new_rel_desc,105							   Oid new_rel_oid,106							   Datum relacl,107							   Datum reloptions);108 109extern List *AddRelationNewConstraints(Relation rel,110									   List *newColDefaults,111									   List *newConstraints,112									   bool allow_merge,113									   bool is_local,114									   bool is_internal,115									   const char *queryString);116 117extern void RelationClearMissing(Relation rel);118extern void SetAttrMissing(Oid relid, char *attname, char *value);119 120extern Node *cookDefault(ParseState *pstate,121						 Node *raw_default,122						 Oid atttypid,123						 int32 atttypmod,124						 const char *attname,125						 char attgenerated);126 127extern void DeleteRelationTuple(Oid relid);128extern void DeleteAttributeTuples(Oid relid);129extern void DeleteSystemAttributeTuples(Oid relid);130extern void RemoveAttributeById(Oid relid, AttrNumber attnum);131 132extern void CopyStatistics(Oid fromrelid, Oid torelid);133extern void RemoveStatistics(Oid relid, AttrNumber attnum);134 135extern const FormData_pg_attribute *SystemAttributeDefinition(AttrNumber attno);136 137extern const FormData_pg_attribute *SystemAttributeByName(const char *attname);138 139extern void CheckAttributeNamesTypes(TupleDesc tupdesc, char relkind,140									 int flags);141 142extern void CheckAttributeType(const char *attname,143							   Oid atttypid, Oid attcollation,144							   List *containing_rowtypes,145							   int flags);146 147/* pg_partitioned_table catalog manipulation functions */148extern void StorePartitionKey(Relation rel,149							  char strategy,150							  int16 partnatts,151							  AttrNumber *partattrs,152							  List *partexprs,153							  Oid *partopclass,154							  Oid *partcollation);155extern void RemovePartitionKeyByRelId(Oid relid);156extern void StorePartitionBound(Relation rel, Relation parent,157								PartitionBoundSpec *bound);158 159#endif							/* HEAP_H */160 
codekingpro/portable-devtools · Team Ai