diff --git a/src/include/access/funcindex.h b/src/include/access/funcindex.h index fe22fabbdd..a1e1aeacf3 100644 --- a/src/include/access/funcindex.h +++ b/src/include/access/funcindex.h @@ -6,15 +6,13 @@ * * Copyright (c) 1994, Regents of the University of California * - * $Id: funcindex.h,v 1.1 1996/08/27 21:50:08 scrappy Exp $ + * $Id: funcindex.h,v 1.2 1996/08/28 01:56:16 scrappy Exp $ * *------------------------------------------------------------------------- */ #ifndef _FUNC_INDEX_INCLUDED_ #define _FUNC_INDEX_INCLUDED_ -#include "postgres.h" - typedef struct { int nargs; Oid arglist[8]; diff --git a/src/include/catalog/catalog.h b/src/include/catalog/catalog.h new file mode 100644 index 0000000000..44ee99df5e --- /dev/null +++ b/src/include/catalog/catalog.h @@ -0,0 +1,24 @@ +/*------------------------------------------------------------------------- + * + * catalog.h-- + * prototypes for functions in lib/catalog/catalog.c + * + * + * Copyright (c) 1994, Regents of the University of California + * + * $Id: catalog.h,v 1.1 1996/08/28 01:56:21 scrappy Exp $ + * + *------------------------------------------------------------------------- + */ +#ifndef CATALOG_H +#define CATALOG_H + +#include "access/tupdesc.h" + +extern char *relpath(char relname[]); +extern bool IsSystemRelationName(char *relname); +extern bool IsSharedSystemRelationName(char *relname); +extern Oid newoid(void); +extern void fillatt(TupleDesc att); + +#endif /* CATALOG_H */ diff --git a/src/include/catalog/catname.h b/src/include/catalog/catname.h new file mode 100644 index 0000000000..2c4fd6d31e --- /dev/null +++ b/src/include/catalog/catname.h @@ -0,0 +1,52 @@ +/*------------------------------------------------------------------------- + * + * catname.h-- + * POSTGRES system catalog relation name definitions. + * + * + * Copyright (c) 1994, Regents of the University of California + * + * $Id: catname.h,v 1.1 1996/08/28 01:56:23 scrappy Exp $ + * + *------------------------------------------------------------------------- + */ +#ifndef CATNAME_H +#define CATNAME_H + +#include "postgres.h" + + +#define AggregateRelationName "pg_aggregate" +#define AccessMethodRelationName "pg_am" +#define AccessMethodOperatorRelationName "pg_amop" +#define AccessMethodProcedureRelationName "pg_amproc" +#define AttributeRelationName "pg_attribute" +#define DatabaseRelationName "pg_database" +#define DefaultsRelationName "pg_defaults" +#define DemonRelationName "pg_demon" +#define GroupRelationName "pg_group" +#define HostsRelationName "pg_hosts" +#define IndexRelationName "pg_index" +#define InheritProcedureRelationName "pg_inheritproc" +#define InheritsRelationName "pg_inherits" +#define InheritancePrecidenceListRelationName "pg_ipl" +#define LanguageRelationName "pg_language" +#define ListenerRelationName "pg_listener" +#define LogRelationName "pg_log" +#define MagicRelationName "pg_magic" +#define OperatorClassRelationName "pg_opclass" +#define OperatorRelationName "pg_operator" +#define ProcedureRelationName "pg_proc" +#define RelationRelationName "pg_class" +#define RewriteRelationName "pg_rewrite" +#define ServerRelationName "pg_server" +#define StatisticRelationName "pg_statistic" +#define TimeRelationName "pg_time" +#define TypeRelationName "pg_type" +#define UserRelationName "pg_user" +#define VariableRelationName "pg_variable" +#define VersionRelationName "pg_version" + +extern char *SharedSystemRelationNames[]; + +#endif /* CATNAME_H */ diff --git a/src/include/catalog/heap.h b/src/include/catalog/heap.h new file mode 100644 index 0000000000..c81aeab4ff --- /dev/null +++ b/src/include/catalog/heap.h @@ -0,0 +1,42 @@ +/*------------------------------------------------------------------------- + * + * heap.h-- + * prototypes for functions in lib/catalog/heap.c + * + * + * Copyright (c) 1994, Regents of the University of California + * + * $Id: heap.h,v 1.1 1996/08/28 01:56:26 scrappy Exp $ + * + *------------------------------------------------------------------------- + */ +#ifndef HEAP_H +#define HEAP_H + +extern Relation heap_creatr(char *relname, unsigned smgr, TupleDesc att); + +extern int RelationAlreadyExists(Relation pg_class_desc, char relname[]); +extern void addNewRelationType(char *typeName, Oid new_rel_oid); + +extern void AddPgRelationTuple(Relation pg_class_desc, + Relation new_rel_desc, Oid new_rel_oid, int arch, unsigned natts); + +extern Oid heap_create(char relname[], + char *typename, + int arch, + unsigned smgr, TupleDesc tupdesc); + +extern void RelationRemoveInheritance(Relation relation); +extern void RelationRemoveIndexes(Relation relation); +extern void DeletePgRelationTuple(Relation rdesc); +extern void DeletePgAttributeTuples(Relation rdesc); +extern void DeletePgTypeTuple(Relation rdesc); +extern void heap_destroy(char relname[]); +extern void heap_destroyr(Relation r); + +extern void InitTempRelList(); +extern void AddToTempRelList(Relation r); +extern void RemoveFromTempRelList(Relation r); +extern void DestroyTempRels(); + +#endif /* HEAP_H */ diff --git a/src/include/catalog/index.h b/src/include/catalog/index.h new file mode 100644 index 0000000000..f59af4f0ec --- /dev/null +++ b/src/include/catalog/index.h @@ -0,0 +1,62 @@ +/*------------------------------------------------------------------------- + * + * index.h-- + * prototypes for index.c. + * + * + * Copyright (c) 1994, Regents of the University of California + * + * $Id: index.h,v 1.1 1996/08/28 01:56:27 scrappy Exp $ + * + *------------------------------------------------------------------------- + */ +#ifndef INDEX_H +#define INDEX_H + +#include "access/funcindex.h" +#include "access/itup.h" +#include "nodes/execnodes.h" +#include "nodes/parsenodes.h" + + +extern Form_pg_am +AccessMethodObjectIdGetAccessMethodTupleForm(Oid accessMethodObjectId); + +extern void +UpdateIndexPredicate(Oid indexoid, Node *oldPred, Node *predicate); + +extern void InitIndexStrategy(int numatts, + Relation indexRelation, + Oid accessMethodObjectId); + +extern void index_create(char *heapRelationName, + char* indexRelationName, + FuncIndexInfo *funcInfo, + TypeName *IndexKeyType, + Oid accessMethodObjectId, + int numatts, + AttrNumber attNums[], + Oid classObjectId[], + uint16 parameterCount, + Datum *parameter, + Node *predicate, + bool islossy); + +extern void index_destroy(Oid indexId); + +extern void FormIndexDatum(int numberOfAttributes, + AttrNumber attributeNumber[], HeapTuple heapTuple, + TupleDesc heapDescriptor, Buffer buffer, Datum *datum, + char *nullv, FuncIndexInfoPtr fInfo); + +extern void UpdateStats(Oid relid, long reltuples, bool hasindex); + +extern void FillDummyExprContext(ExprContext *econtext, TupleTableSlot *slot, + TupleDesc tupdesc, Buffer buffer); + +extern void index_build(Relation heapRelation, Relation indexRelation, + int numberOfAttributes, AttrNumber attributeNumber[], + uint16 parameterCount, Datum *parameter, FuncIndexInfo *funcInfo, + PredInfo *predInfo); + +#endif /* INDEX_H */ diff --git a/src/include/catalog/indexing.h b/src/include/catalog/indexing.h new file mode 100644 index 0000000000..e1325b529b --- /dev/null +++ b/src/include/catalog/indexing.h @@ -0,0 +1,103 @@ +/*------------------------------------------------------------------------- + * + * indexing.h-- + * This include provides some definitions to support indexing + * on system catalogs + * + * + * Copyright (c) 1994, Regents of the University of California + * + * $Id: indexing.h,v 1.1 1996/08/28 01:56:29 scrappy Exp $ + * + *------------------------------------------------------------------------- + */ +#ifndef INDEXING_H +#define INDEXING_H + +#include "utils/rel.h" + +/* + * Some definitions for indices on pg_attribute + */ +#define Num_pg_attr_indices 3 +#define Num_pg_proc_indices 3 +#define Num_pg_type_indices 2 +#define Num_pg_class_indices 2 + + +/* + * Names of indices on system catalogs + */ +#define AttributeNameIndex "pg_attnameind" +#define AttributeNumIndex "pg_attnumind" +#define AttributeRelidIndex "pg_attrelidind" +#define ProcedureNameIndex "pg_procnameind" +#define ProcedureOidIndex "pg_procidind" +#define ProcedureSrcIndex "pg_procsrcind" +#define TypeNameIndex "pg_typenameind" +#define TypeOidIndex "pg_typeidind" +#define ClassNameIndex "pg_classnameind" +#define ClassOidIndex "pg_classoidind" + +extern char *Name_pg_attr_indices[]; +extern char *Name_pg_proc_indices[]; +extern char *Name_pg_type_indices[]; +extern char *Name_pg_class_indices[]; + +extern char *IndexedCatalogNames[]; + +/* + * indexing.c prototypes + * + * Functions for each index to perform the necessary scan on a cache miss. + */ +extern void CatalogOpenIndices(int nIndices, char *names[], Relation idescs[]); +extern void CatalogCloseIndices(int nIndices, Relation *idescs); +extern void CatalogIndexInsert(Relation *idescs, + int nIndices, + Relation heapRelation, + HeapTuple heapTuple); +extern bool CatalogHasIndex(char *catName, Oid catId); + +extern HeapTuple AttributeNameIndexScan(Relation heapRelation, + Oid relid, + char *attname); + +extern HeapTuple AttributeNumIndexScan(Relation heapRelation, + Oid relid, + AttrNumber attnum); +extern HeapTuple ProcedureOidIndexScan(Relation heapRelation, Oid procId); +extern HeapTuple ProcedureNameIndexScan(Relation heapRelation, + char *procName, int nargs, Oid *argTypes); +extern HeapTuple ProcedureSrcIndexScan(Relation heapRelation, text *procSrc); +extern HeapTuple TypeOidIndexScan(Relation heapRelation, Oid typeId); +extern HeapTuple TypeNameIndexScan(Relation heapRelation, char *typeName); +extern HeapTuple ClassNameIndexScan(Relation heapRelation, char *relName); +extern HeapTuple ClassOidIndexScan(Relation heapRelation, Oid relId); + + +/* + * What follows are lines processed by genbki.sh to create the statements + * the bootstrap parser will turn into DefineIndex commands. + * + * The keyword is DECLARE_INDEX every thing after that is just like in a + * normal specification of the 'define index' POSTQUEL command. + */ +DECLARE_INDEX(pg_attnameind on pg_attribute using btree (mkoidname(attrelid, attname) oidname_ops)); +DECLARE_INDEX(pg_attnumind on pg_attribute using btree (mkoidint2(attrelid, attnum) oidint2_ops)); +DECLARE_INDEX(pg_attrelidind on pg_attribute using btree (attrelid oid_ops)); + +DECLARE_INDEX(pg_procidind on pg_proc using btree (Oid oid_ops)); +DECLARE_INDEX(pg_procnameind on pg_proc using btree (proname name_ops)); +DECLARE_INDEX(pg_procsrcind on pg_proc using btree (prosrc text_ops)); + +DECLARE_INDEX(pg_typeidind on pg_type using btree (Oid oid_ops)); +DECLARE_INDEX(pg_typenameind on pg_type using btree (typname name_ops)); + +DECLARE_INDEX(pg_classnameind on pg_class using btree (relname name_ops)); +DECLARE_INDEX(pg_classoidind on pg_class using btree (Oid oid_ops)); + +/* now build indices in the initialization scripts */ +BUILD_INDICES + +#endif /* INDEXING_H */ diff --git a/src/include/catalog/pg_aggregate.h b/src/include/catalog/pg_aggregate.h new file mode 100644 index 0000000000..8b52114c4a --- /dev/null +++ b/src/include/catalog/pg_aggregate.h @@ -0,0 +1,132 @@ +/*------------------------------------------------------------------------- + * + * pg_aggregate.h-- + * definition of the system "aggregate" relation (pg_aggregate) + * along with the relation's initial contents. + * + * + * Copyright (c) 1994, Regents of the University of California + * + * $Id: pg_aggregate.h,v 1.1 1996/08/28 01:56:30 scrappy Exp $ + * + * NOTES + * the genbki.sh script reads this file and generates .bki + * information from the DATA() statements. + * + *------------------------------------------------------------------------- + */ +#ifndef PG_AGGREGATE_H +#define PG_AGGREGATE_H + +/* ---------------- + * postgres.h contains the system type definintions and the + * CATALOG(), BOOTSTRAP and DATA() sugar words so this file + * can be read by both genbki.sh and the C compiler. + * ---------------- + */ +#include "postgres.h" + +/* ---------------------------------------------------------------- + * pg_aggregate definition. + * + * cpp turns this into typedef struct FormData_pg_aggregate + * + * aggname name of the aggregate + * aggtransfn1 transition function 1 + * aggtransfn2 transition function 2 + * aggfinalfn final function + * aggbasetype type of data on which aggregate operates + * aggtranstype1 output types for xition func 1 + * aggtranstype2 output types for xition func 2 + * aggfinaltype output type for final func + * agginitval1 initial aggregate value + * agginitval2 initial value for transition state 2 + * ---------------------------------------------------------------- + */ +CATALOG(pg_aggregate) { + NameData aggname; + Oid aggowner; + regproc aggtransfn1; + regproc aggtransfn2; + regproc aggfinalfn; + Oid aggbasetype; + Oid aggtranstype1; + Oid aggtranstype2; + Oid aggfinaltype; + text agginitval1; /* VARIABLE LENGTH FIELD */ + text agginitval2; /* VARIABLE LENGTH FIELD */ +} FormData_pg_aggregate; + +/* ---------------- + * Form_pg_aggregate corresponds to a pointer to a tuple with + * the format of pg_aggregate relation. + * ---------------- + */ +typedef FormData_pg_aggregate *Form_pg_aggregate; + +/* ---------------- + * compiler constants for pg_aggregate + * ---------------- + */ + +#define Natts_pg_aggregate 11 +#define Anum_pg_aggregate_aggname 1 +#define Anum_pg_aggregate_aggowner 2 +#define Anum_pg_aggregate_aggtransfn1 3 +#define Anum_pg_aggregate_aggtransfn2 4 +#define Anum_pg_aggregate_aggfinalfn 5 +#define Anum_pg_aggregate_aggbasetype 6 +#define Anum_pg_aggregate_aggtranstype1 7 +#define Anum_pg_aggregate_aggtranstype2 8 +#define Anum_pg_aggregate_aggfinaltype 9 +#define Anum_pg_aggregate_agginitval1 10 +#define Anum_pg_aggregate_agginitval2 11 + + +/* ---------------- + * initial contents of pg_aggregate + * --------------- + */ + +DATA(insert OID = 0 ( avg PGUID int4pl int4inc int4div 23 23 23 23 0 0 )); +DATA(insert OID = 0 ( avg PGUID int2pl int2inc int2div 21 21 21 21 0 0 )); +DATA(insert OID = 0 ( avg PGUID float4pl float4inc float4div 700 700 700 700 0.0 0.0 )); +DATA(insert OID = 0 ( avg PGUID float8pl float8inc float8div 701 701 701 701 0.0 0.0 )); + +DATA(insert OID = 0 ( sum PGUID int4pl - - 23 23 0 23 0 _null_ )); +DATA(insert OID = 0 ( sum PGUID int2pl - - 21 21 0 21 0 _null_ )); +DATA(insert OID = 0 ( sum PGUID float4pl - - 700 700 0 700 0.0 _null_ )); +DATA(insert OID = 0 ( sum PGUID float8pl - - 701 701 0 701 0.0 _null_ )); + +DATA(insert OID = 0 ( max PGUID int4larger - - 23 23 0 23 _null_ _null_ )); +DATA(insert OID = 0 ( max PGUID int2larger - - 21 21 0 21 _null_ _null_ )); +DATA(insert OID = 0 ( max PGUID float4larger - - 700 700 0 700 _null_ _null_ )); +DATA(insert OID = 0 ( max PGUID float8larger - - 701 701 0 701 _null_ _null_ )); + +DATA(insert OID = 0 ( min PGUID int4smaller - - 23 23 0 23 _null_ _null_ )); +DATA(insert OID = 0 ( min PGUID int2smaller - - 21 21 0 21 _null_ _null_ )); +DATA(insert OID = 0 ( min PGUID float4smaller - - 700 700 0 700 _null_ _null_ )); +DATA(insert OID = 0 ( min PGUID float8smaller - - 701 701 0 701 _null_ _null_ )); + +DATA(insert OID = 0 ( count PGUID - int4inc - 0 0 23 23 _null_ 0 )); + +/* + * prototypes for fucnctions in pg_aggregate.c + */ +extern void AggregateCreate(char *aggName, + char *aggtransfn1Name, + char *aggtransfn2Name, + char *aggfinalfnName, + char *aggbasetypeName, + char *aggtransfn1typeName, + char *aggtransfn2typeName, + char *agginitval1, + char *agginitval2); +extern char *AggNameGetInitVal(char *aggName, Oid basetype, + int xfuncno, bool *isNull); + +#endif /* PG_AGGREGATE_H */ + + + + diff --git a/src/include/catalog/pg_am.h b/src/include/catalog/pg_am.h new file mode 100644 index 0000000000..bfa9a012ce --- /dev/null +++ b/src/include/catalog/pg_am.h @@ -0,0 +1,116 @@ +/*------------------------------------------------------------------------- + * + * pg_am.h-- + * definition of the system "am" relation (pg_am) + * along with the relation's initial contents. + * + * + * Copyright (c) 1994, Regents of the University of California + * + * $Id: pg_am.h,v 1.1 1996/08/28 01:56:32 scrappy Exp $ + * + * NOTES + * the genbki.sh script reads this file and generates .bki + * information from the DATA() statements. + * + * XXX do NOT break up DATA() statements into multiple lines! + * the scripts are not as smart as you might think... + * + *------------------------------------------------------------------------- + */ +#ifndef PG_AM_H +#define PG_AM_H + +/* ---------------- + * postgres.h contains the system type definintions and the + * CATALOG(), BOOTSTRAP and DATA() sugar words so this file + * can be read by both genbki.sh and the C compiler. + * ---------------- + */ +#include "postgres.h" + +/* ---------------- + * pg_am definition. cpp turns this into + * typedef struct FormData_pg_am + * ---------------- + */ +CATALOG(pg_am) { + NameData amname; + Oid amowner; + char amkind; + int2 amstrategies; + int2 amsupport; + regproc amgettuple; + regproc aminsert; + regproc amdelete; + regproc amgetattr; + regproc amsetlock; + regproc amsettid; + regproc amfreetuple; + regproc ambeginscan; + regproc amrescan; + regproc amendscan; + regproc ammarkpos; + regproc amrestrpos; + regproc amopen; + regproc amclose; + regproc ambuild; + regproc amcreate; + regproc amdestroy; +} FormData_pg_am; + +/* ---------------- + * Form_pg_am corresponds to a pointer to a tuple with + * the format of pg_am relation. + * ---------------- + */ +typedef FormData_pg_am *Form_pg_am; + +/* ---------------- + * compiler constants for pg_am + * ---------------- + */ +#define Natts_pg_am 22 +#define Anum_pg_am_amname 1 +#define Anum_pg_am_amowner 2 +#define Anum_pg_am_amkind 3 +#define Anum_pg_am_amstrategies 4 +#define Anum_pg_am_amsupport 5 +#define Anum_pg_am_amgettuple 6 +#define Anum_pg_am_aminsert 7 +#define Anum_pg_am_amdelete 8 +#define Anum_pg_am_amgetattr 9 +#define Anum_pg_am_amsetlock 10 +#define Anum_pg_am_amsettid 11 +#define Anum_pg_am_amfreetuple 12 +#define Anum_pg_am_ambeginscan 13 +#define Anum_pg_am_amrescan 14 +#define Anum_pg_am_amendscan 15 +#define Anum_pg_am_ammarkpos 16 +#define Anum_pg_am_amrestrpos 17 +#define Anum_pg_am_amopen 18 +#define Anum_pg_am_amclose 19 +#define Anum_pg_am_ambuild 20 +#define Anum_pg_am_amcreate 21 +#define Anum_pg_am_amdestroy 22 + +/* ---------------- + * initial contents of pg_am + * ---------------- + */ + +DATA(insert OID = 405 ( hash PGUID "o" 1 1 hashgettuple hashinsert hashdelete - - - - hashbeginscan hashrescan hashendscan hashmarkpos hashrestrpos - - hashbuild - - )); +DATA(insert OID = 402 ( rtree PGUID "o" 8 3 rtgettuple rtinsert rtdelete - - - - rtbeginscan rtrescan rtendscan rtmarkpos rtrestrpos - - rtbuild - - )); +DATA(insert OID = 403 ( btree PGUID "o" 5 1 btgettuple btinsert btdelete - - - - btbeginscan btrescan btendscan btmarkpos btrestrpos - - btbuild - - )); +#define BTREE_AM_OID 403 +DATA(insert OID = 783 ( gist PGUID "o" 100 7 gistgettuple gistinsert gistdelete - - - - gistbeginscan gistrescan gistendscan gistmarkpos gistrestrpos - - gistbuild - - )); + +BKI_BEGIN +#ifdef NOBTREE +BKI_END +DATA(insert OID = 404 ( nobtree PGUID "o" 5 1 nobtgettuple nobtinsert nobtdelete - - - - nobtbeginscan nobtrescan nobtendscan nobtmarkpos nobtrestrpos - - nobtbuild - - )); +BKI_BEGIN +#endif /* NOBTREE */ +BKI_END + +#endif /* PG_AM_H */ diff --git a/src/include/catalog/pg_amop.h b/src/include/catalog/pg_amop.h new file mode 100644 index 0000000000..fd3d052daf --- /dev/null +++ b/src/include/catalog/pg_amop.h @@ -0,0 +1,556 @@ +/*------------------------------------------------------------------------- + * + * pg_amop.h-- + * definition of the system "amop" relation (pg_amop) + * along with the relation's initial contents. + * + * + * Copyright (c) 1994, Regents of the University of California + * + * $Id: pg_amop.h,v 1.1 1996/08/28 01:56:34 scrappy Exp $ + * + * NOTES + * the genbki.sh script reads this file and generates .bki + * information from the DATA() statements. + * + *------------------------------------------------------------------------- + */ +#ifndef PG_AMOP_H +#define PG_AMOP_H + +/* ---------------- + * postgres.h contains the system type definintions and the + * CATALOG(), BOOTSTRAP and DATA() sugar words so this file + * can be read by both genbki.sh and the C compiler. + * ---------------- + */ +#include "postgres.h" +#include "access/istrat.h" + +/* ---------------- + * pg_amop definition. cpp turns this into + * typedef struct FormData_pg_amop + * ---------------- + */ +CATALOG(pg_amop) { + Oid amopid; + Oid amopclaid; + Oid amopopr; + int2 amopstrategy; + regproc amopselect; + regproc amopnpages; +} FormData_pg_amop; + +/* ---------------- + * Form_pg_amop corresponds to a pointer to a tuple with + * the format of pg_amop relation. + * ---------------- + */ +typedef FormData_pg_amop *Form_pg_amop; + +/* ---------------- + * compiler constants for pg_amop + * ---------------- + */ +/* #define Name_pg_amop "pg_amop" */ +#define Natts_pg_amop 6 +#define Anum_pg_amop_amopid 1 +#define Anum_pg_amop_amopclaid 2 +#define Anum_pg_amop_amopopr 3 +#define Anum_pg_amop_amopstrategy 4 +#define Anum_pg_amop_amopselect 5 +#define Anum_pg_amop_amopnpages 6 + +/* ---------------- + * initial contents of pg_amop + * ---------------- + */ + +/* + * rtree box_ops + */ + +DATA(insert OID = 0 ( 402 422 493 1 rtsel rtnpage )); +DATA(insert OID = 0 ( 402 422 494 2 rtsel rtnpage )); +DATA(insert OID = 0 ( 402 422 500 3 rtsel rtnpage )); +DATA(insert OID = 0 ( 402 422 495 4 rtsel rtnpage )); +DATA(insert OID = 0 ( 402 422 496 5 rtsel rtnpage )); +DATA(insert OID = 0 ( 402 422 499 6 rtsel rtnpage )); +DATA(insert OID = 0 ( 402 422 498 7 rtsel rtnpage )); +DATA(insert OID = 0 ( 402 422 497 8 rtsel rtnpage )); + +/* + * rtree bigbox_ops + */ + +DATA(insert OID = 0 ( 402 433 493 1 rtsel rtnpage )); +DATA(insert OID = 0 ( 402 433 494 2 rtsel rtnpage )); +DATA(insert OID = 0 ( 402 433 500 3 rtsel rtnpage )); +DATA(insert OID = 0 ( 402 433 495 4 rtsel rtnpage )); +DATA(insert OID = 0 ( 402 433 496 5 rtsel rtnpage )); +DATA(insert OID = 0 ( 402 433 499 6 rtsel rtnpage )); +DATA(insert OID = 0 ( 402 433 498 7 rtsel rtnpage )); +DATA(insert OID = 0 ( 402 433 497 8 rtsel rtnpage )); + +/* + * rtree poly_ops (supports polygons) + */ + +DATA(insert OID = 0 ( 402 434 485 1 rtsel rtnpage )); +DATA(insert OID = 0 ( 402 434 486 2 rtsel rtnpage )); +DATA(insert OID = 0 ( 402 434 487 3 rtsel rtnpage )); +DATA(insert OID = 0 ( 402 434 488 4 rtsel rtnpage )); +DATA(insert OID = 0 ( 402 434 489 5 rtsel rtnpage )); +DATA(insert OID = 0 ( 402 434 490 6 rtsel rtnpage )); +DATA(insert OID = 0 ( 402 434 491 7 rtsel rtnpage )); +DATA(insert OID = 0 ( 402 434 492 8 rtsel rtnpage )); + +/* + * nbtree int2_ops + */ + +DATA(insert OID = 0 ( 403 421 95 1 btreesel btreenpage )); +DATA(insert OID = 0 ( 403 421 522 2 btreesel btreenpage )); +DATA(insert OID = 0 ( 403 421 94 3 btreesel btreenpage )); +DATA(insert OID = 0 ( 403 421 524 4 btreesel btreenpage )); +DATA(insert OID = 0 ( 403 421 520 5 btreesel btreenpage )); + +/* + * nbtree float8_ops + */ + +DATA(insert OID = 0 ( 403 423 672 1 btreesel btreenpage )); +DATA(insert OID = 0 ( 403 423 673 2 btreesel btreenpage )); +DATA(insert OID = 0 ( 403 423 670 3 btreesel btreenpage )); +DATA(insert OID = 0 ( 403 423 675 4 btreesel btreenpage )); +DATA(insert OID = 0 ( 403 423 674 5 btreesel btreenpage )); + +/* + * nbtree int24_ops + */ + +DATA(insert OID = 0 ( 403 424 534 1 btreesel btreenpage )); +DATA(insert OID = 0 ( 403 424 540 2 btreesel btreenpage )); +DATA(insert OID = 0 ( 403 424 532 3 btreesel btreenpage )); +DATA(insert OID = 0 ( 403 424 542 4 btreesel btreenpage )); +DATA(insert OID = 0 ( 403 424 536 5 btreesel btreenpage )); + +/* + * nbtree int42_ops + */ + +DATA(insert OID = 0 ( 403 425 535 1 btreesel btreenpage )); +DATA(insert OID = 0 ( 403 425 541 2 btreesel btreenpage )); +DATA(insert OID = 0 ( 403 425 533 3 btreesel btreenpage )); +DATA(insert OID = 0 ( 403 425 543 4 btreesel btreenpage )); +DATA(insert OID = 0 ( 403 425 537 5 btreesel btreenpage )); + +/* + * nbtree int4_ops + */ + +DATA(insert OID = 0 ( 403 426 97 1 btreesel btreenpage )); +DATA(insert OID = 0 ( 403 426 523 2 btreesel btreenpage )); +DATA(insert OID = 0 ( 403 426 96 3 btreesel btreenpage )); +DATA(insert OID = 0 ( 403 426 525 4 btreesel btreenpage )); +DATA(insert OID = 0 ( 403 426 521 5 btreesel btreenpage )); + +/* + * nbtree oid_ops + */ + +DATA(insert OID = 0 ( 403 427 609 1 btreesel btreenpage )); +DATA(insert OID = 0 ( 403 427 611 2 btreesel btreenpage )); +DATA(insert OID = 0 ( 403 427 607 3 btreesel btreenpage )); +DATA(insert OID = 0 ( 403 427 612 4 btreesel btreenpage )); +DATA(insert OID = 0 ( 403 427 610 5 btreesel btreenpage )); + +/* + * nbtree float4_ops + */ + +DATA(insert OID = 0 ( 403 428 622 1 btreesel btreenpage )); +DATA(insert OID = 0 ( 403 428 624 2 btreesel btreenpage )); +DATA(insert OID = 0 ( 403 428 620 3 btreesel btreenpage )); +DATA(insert OID = 0 ( 403 428 625 4 btreesel btreenpage )); +DATA(insert OID = 0 ( 403 428 623 5 btreesel btreenpage )); + +/* + * nbtree char_ops + */ + +DATA(insert OID = 0 ( 403 429 631 1 btreesel btreenpage )); +DATA(insert OID = 0 ( 403 429 632 2 btreesel btreenpage )); +DATA(insert OID = 0 ( 403 429 92 3 btreesel btreenpage )); +DATA(insert OID = 0 ( 403 429 634 4 btreesel btreenpage )); +DATA(insert OID = 0 ( 403 429 633 5 btreesel btreenpage )); + +/* + * nbtree char2_ops + */ + +DATA(insert OID = 0 ( 403 406 418 1 btreesel btreenpage )); +DATA(insert OID = 0 ( 403 406 457 2 btreesel btreenpage )); +DATA(insert OID = 0 ( 403 406 412 3 btreesel btreenpage )); +DATA(insert OID = 0 ( 403 406 463 4 btreesel btreenpage )); +DATA(insert OID = 0 ( 403 406 460 5 btreesel btreenpage )); + +/* + * nbtree char4_ops + */ + +DATA(insert OID = 0 ( 403 407 419 1 btreesel btreenpage )); +DATA(insert OID = 0 ( 403 407 458 2 btreesel btreenpage )); +DATA(insert OID = 0 ( 403 407 413 3 btreesel btreenpage )); +DATA(insert OID = 0 ( 403 407 464 4 btreesel btreenpage )); +DATA(insert OID = 0 ( 403 407 461 5 btreesel btreenpage )); + +/* + * nbtree char8_ops + */ + +DATA(insert OID = 0 ( 403 408 420 1 btreesel btreenpage )); +DATA(insert OID = 0 ( 403 408 459 2 btreesel btreenpage )); +DATA(insert OID = 0 ( 403 408 414 3 btreesel btreenpage )); +DATA(insert OID = 0 ( 403 408 465 4 btreesel btreenpage )); +DATA(insert OID = 0 ( 403 408 462 5 btreesel btreenpage )); + +/* + * nbtree name_ops + */ + +DATA(insert OID = 0 ( 403 1181 660 1 btreesel btreenpage )); +DATA(insert OID = 0 ( 403 1181 661 2 btreesel btreenpage )); +DATA(insert OID = 0 ( 403 1181 93 3 btreesel btreenpage )); +DATA(insert OID = 0 ( 403 1181 663 4 btreesel btreenpage )); +DATA(insert OID = 0 ( 403 1181 662 5 btreesel btreenpage )); + +/* + * nbtree char16_ops + */ + +DATA(insert OID = 0 ( 403 430 645 1 btreesel btreenpage )); +DATA(insert OID = 0 ( 403 430 646 2 btreesel btreenpage )); +DATA(insert OID = 0 ( 403 430 99 3 btreesel btreenpage )); +DATA(insert OID = 0 ( 403 430 648 4 btreesel btreenpage )); +DATA(insert OID = 0 ( 403 430 647 5 btreesel btreenpage )); + +/* + * nbtree text_ops + */ + +DATA(insert OID = 0 ( 403 431 664 1 btreesel btreenpage )); +DATA(insert OID = 0 ( 403 431 665 2 btreesel btreenpage )); +DATA(insert OID = 0 ( 403 431 98 3 btreesel btreenpage )); +DATA(insert OID = 0 ( 403 431 667 4 btreesel btreenpage )); +DATA(insert OID = 0 ( 403 431 666 5 btreesel btreenpage )); + +/* + * nbtree abstime_ops + */ + +DATA(insert OID = 0 ( 403 432 562 1 btreesel btreenpage )); +DATA(insert OID = 0 ( 403 432 564 2 btreesel btreenpage )); +DATA(insert OID = 0 ( 403 432 560 3 btreesel btreenpage )); +DATA(insert OID = 0 ( 403 432 565 4 btreesel btreenpage )); +DATA(insert OID = 0 ( 403 432 563 5 btreesel btreenpage )); + +/* + * nbtree oidint4_ops + */ + +DATA(insert OID = 0 ( 403 435 930 1 btreesel btreenpage )); +DATA(insert OID = 0 ( 403 435 931 2 btreesel btreenpage )); +DATA(insert OID = 0 ( 403 435 932 3 btreesel btreenpage )); +DATA(insert OID = 0 ( 403 435 933 4 btreesel btreenpage )); +DATA(insert OID = 0 ( 403 435 934 5 btreesel btreenpage )); + +/* + * nbtree oidint2_ops + */ + +DATA(insert OID = 0 ( 403 437 830 1 btreesel btreenpage )); +DATA(insert OID = 0 ( 403 437 831 2 btreesel btreenpage )); +DATA(insert OID = 0 ( 403 437 832 3 btreesel btreenpage )); +DATA(insert OID = 0 ( 403 437 833 4 btreesel btreenpage )); +DATA(insert OID = 0 ( 403 437 834 5 btreesel btreenpage )); + +/* + * nbtree oidname_ops + */ + +DATA(insert OID = 0 ( 403 436 676 1 btreesel btreenpage )); +DATA(insert OID = 0 ( 403 436 677 2 btreesel btreenpage )); +DATA(insert OID = 0 ( 403 436 678 3 btreesel btreenpage )); +DATA(insert OID = 0 ( 403 436 679 4 btreesel btreenpage )); +DATA(insert OID = 0 ( 403 436 680 5 btreesel btreenpage )); + +/* + * nbtree bpchar_ops + */ + +DATA(insert OID = 0 ( 403 1076 1058 1 btreesel btreenpage )); +DATA(insert OID = 0 ( 403 1076 1059 2 btreesel btreenpage )); +DATA(insert OID = 0 ( 403 1076 1054 3 btreesel btreenpage )); +DATA(insert OID = 0 ( 403 1076 1061 4 btreesel btreenpage )); +DATA(insert OID = 0 ( 403 1076 1060 5 btreesel btreenpage )); + +/* + * nbtree varchar_ops + */ + +DATA(insert OID = 0 ( 403 1077 1066 1 btreesel btreenpage )); +DATA(insert OID = 0 ( 403 1077 1067 2 btreesel btreenpage )); +DATA(insert OID = 0 ( 403 1077 1062 3 btreesel btreenpage )); +DATA(insert OID = 0 ( 403 1077 1069 4 btreesel btreenpage )); +DATA(insert OID = 0 ( 403 1077 1068 5 btreesel btreenpage )); + +/* + * nbtree date_ops + */ + +DATA(insert OID = 0 ( 403 1114 1095 1 btreesel btreenpage )); +DATA(insert OID = 0 ( 403 1114 1096 2 btreesel btreenpage )); +DATA(insert OID = 0 ( 403 1114 1093 3 btreesel btreenpage )); +DATA(insert OID = 0 ( 403 1114 1098 4 btreesel btreenpage )); +DATA(insert OID = 0 ( 403 1114 1097 5 btreesel btreenpage )); + + +/* + * nbtree time_ops + */ + +DATA(insert OID = 0 ( 403 1115 1110 1 btreesel btreenpage )); +DATA(insert OID = 0 ( 403 1115 1111 2 btreesel btreenpage )); +DATA(insert OID = 0 ( 403 1115 1108 3 btreesel btreenpage )); +DATA(insert OID = 0 ( 403 1115 1113 4 btreesel btreenpage )); +DATA(insert OID = 0 ( 403 1115 1112 5 btreesel btreenpage )); + +BKI_BEGIN +#ifdef NOBTREE +BKI_END +/* + * nobtree int2_ops + */ + +DATA(insert OID = 0 ( 404 421 95 1 btreesel btreenpage )); +DATA(insert OID = 0 ( 404 421 522 2 btreesel btreenpage )); +DATA(insert OID = 0 ( 404 421 94 3 btreesel btreenpage )); +DATA(insert OID = 0 ( 404 421 524 4 btreesel btreenpage )); +DATA(insert OID = 0 ( 404 421 520 5 btreesel btreenpage )); + +/* + * nobtree float8_ops + */ + +DATA(insert OID = 0 ( 404 423 672 1 btreesel btreenpage )); +DATA(insert OID = 0 ( 404 423 673 2 btreesel btreenpage )); +DATA(insert OID = 0 ( 404 423 670 3 btreesel btreenpage )); +DATA(insert OID = 0 ( 404 423 675 4 btreesel btreenpage )); +DATA(insert OID = 0 ( 404 423 674 5 btreesel btreenpage )); + +/* + * nobtree int24_ops + */ + +DATA(insert OID = 0 ( 404 424 534 1 btreesel btreenpage )); +DATA(insert OID = 0 ( 404 424 540 2 btreesel btreenpage )); +DATA(insert OID = 0 ( 404 424 532 3 btreesel btreenpage )); +DATA(insert OID = 0 ( 404 424 542 4 btreesel btreenpage )); +DATA(insert OID = 0 ( 404 424 536 5 btreesel btreenpage )); + +/* + * nobtree int42_ops + */ + +DATA(insert OID = 0 ( 404 425 535 1 btreesel btreenpage )); +DATA(insert OID = 0 ( 404 425 541 2 btreesel btreenpage )); +DATA(insert OID = 0 ( 404 425 533 3 btreesel btreenpage )); +DATA(insert OID = 0 ( 404 425 543 4 btreesel btreenpage )); +DATA(insert OID = 0 ( 404 425 537 5 btreesel btreenpage )); + +/* + * nobtree int4_ops + */ + +DATA(insert OID = 0 ( 404 426 97 1 btreesel btreenpage )); +DATA(insert OID = 0 ( 404 426 523 2 btreesel btreenpage )); +DATA(insert OID = 0 ( 404 426 96 3 btreesel btreenpage )); +DATA(insert OID = 0 ( 404 426 525 4 btreesel btreenpage )); +DATA(insert OID = 0 ( 404 426 521 5 btreesel btreenpage )); + +/* + * nobtree oid_ops + */ + +DATA(insert OID = 0 ( 404 427 609 1 btreesel btreenpage )); +DATA(insert OID = 0 ( 404 427 611 2 btreesel btreenpage )); +DATA(insert OID = 0 ( 404 427 607 3 btreesel btreenpage )); +DATA(insert OID = 0 ( 404 427 612 4 btreesel btreenpage )); +DATA(insert OID = 0 ( 404 427 610 5 btreesel btreenpage )); + +/* + * nobtree float4_ops + */ + +DATA(insert OID = 0 ( 404 428 622 1 btreesel btreenpage )); +DATA(insert OID = 0 ( 404 428 624 2 btreesel btreenpage )); +DATA(insert OID = 0 ( 404 428 620 3 btreesel btreenpage )); +DATA(insert OID = 0 ( 404 428 625 4 btreesel btreenpage )); +DATA(insert OID = 0 ( 404 428 623 5 btreesel btreenpage )); + +/* + * nobtree char_ops + */ + +DATA(insert OID = 0 ( 404 429 631 1 btreesel btreenpage )); +DATA(insert OID = 0 ( 404 429 632 2 btreesel btreenpage )); +DATA(insert OID = 0 ( 404 429 92 3 btreesel btreenpage )); +DATA(insert OID = 0 ( 404 429 634 4 btreesel btreenpage )); +DATA(insert OID = 0 ( 404 429 633 5 btreesel btreenpage )); + +/* + * nobtree char2_ops + */ + +DATA(insert OID = 0 ( 404 406 418 1 btreesel btreenpage )); +DATA(insert OID = 0 ( 404 406 457 2 btreesel btreenpage )); +DATA(insert OID = 0 ( 404 406 412 3 btreesel btreenpage )); +DATA(insert OID = 0 ( 404 406 463 4 btreesel btreenpage )); +DATA(insert OID = 0 ( 404 406 460 5 btreesel btreenpage )); + +/* + * nobtree char4_ops + */ + +DATA(insert OID = 0 ( 404 407 419 1 btreesel btreenpage )); +DATA(insert OID = 0 ( 404 407 458 2 btreesel btreenpage )); +DATA(insert OID = 0 ( 404 407 413 3 btreesel btreenpage )); +DATA(insert OID = 0 ( 404 407 464 4 btreesel btreenpage )); +DATA(insert OID = 0 ( 404 407 461 5 btreesel btreenpage )); + +/* + * nobtree char8_ops + */ + +DATA(insert OID = 0 ( 404 408 420 1 btreesel btreenpage )); +DATA(insert OID = 0 ( 404 408 459 2 btreesel btreenpage )); +DATA(insert OID = 0 ( 404 408 414 3 btreesel btreenpage )); +DATA(insert OID = 0 ( 404 408 465 4 btreesel btreenpage )); +DATA(insert OID = 0 ( 404 408 462 5 btreesel btreenpage )); + +/* + * nobtree char16_ops + */ + +DATA(insert OID = 0 ( 404 430 645 1 btreesel btreenpage )); +DATA(insert OID = 0 ( 404 430 646 2 btreesel btreenpage )); +DATA(insert OID = 0 ( 404 430 99 3 btreesel btreenpage )); +DATA(insert OID = 0 ( 404 430 648 4 btreesel btreenpage )); +DATA(insert OID = 0 ( 404 430 647 5 btreesel btreenpage )); + +/* + * nobtree name_ops + */ + +DATA(insert OID = 0 ( 404 1181 660 1 btreesel btreenpage )); +DATA(insert OID = 0 ( 404 1181 661 2 btreesel btreenpage )); +DATA(insert OID = 0 ( 404 1181 93 3 btreesel btreenpage )); +DATA(insert OID = 0 ( 404 1181 663 4 btreesel btreenpage )); +DATA(insert OID = 0 ( 404 1181 662 5 btreesel btreenpage )); + +/* + * nobtree text_ops + */ + +DATA(insert OID = 0 ( 404 431 664 1 btreesel btreenpage )); +DATA(insert OID = 0 ( 404 431 665 2 btreesel btreenpage )); +DATA(insert OID = 0 ( 404 431 98 3 btreesel btreenpage )); +DATA(insert OID = 0 ( 404 431 667 4 btreesel btreenpage )); +DATA(insert OID = 0 ( 404 431 666 5 btreesel btreenpage )); + +/* + * nobtree abstime_ops + */ + +DATA(insert OID = 0 ( 404 432 562 1 btreesel btreenpage )); +DATA(insert OID = 0 ( 404 432 564 2 btreesel btreenpage )); +DATA(insert OID = 0 ( 404 432 560 3 btreesel btreenpage )); +DATA(insert OID = 0 ( 404 432 565 4 btreesel btreenpage )); +DATA(insert OID = 0 ( 404 432 563 5 btreesel btreenpage )); + +BKI_BEGIN +#endif /* NOBTREE */ +BKI_END + +/* + * hash table int2_ops + */ +DATA(insert OID = 0 ( 405 421 94 1 btreesel btreenpage )); +/* + * hash table float8_ops + */ +DATA(insert OID = 0 ( 405 423 670 1 btreesel btreenpage )); +/* + * hash table int4_ops + */ +DATA(insert OID = 0 ( 405 426 96 1 hashsel hashnpage )); +/* + * hash table oid_ops + */ +DATA(insert OID = 0 ( 405 427 607 1 hashsel hashnpage )); +/* + * hash table float4_ops + */ +DATA(insert OID = 0 ( 405 428 620 1 hashsel hashnpage )); +/* + * hash table char_ops + */ +DATA(insert OID = 0 ( 405 429 92 1 hashsel hashnpage )); +/* + * hash table char2_ops + */ +DATA(insert OID = 0 ( 405 406 412 1 hashsel hashnpage )); +/* + * hash table char4_ops + */ +DATA(insert OID = 0 ( 405 407 413 1 hashsel hashnpage )); +/* + * hash table char8_ops + */ +DATA(insert OID = 0 ( 405 408 414 1 hashsel hashnpage )); +/* + * hash table char16_ops + */ +DATA(insert OID = 0 ( 405 430 99 1 hashsel hashnpage )); +/* + * hash table name_ops + */ +DATA(insert OID = 0 ( 405 1181 93 1 hashsel hashnpage )); +/* + * hash table text_ops + */ +DATA(insert OID = 0 ( 405 431 98 1 hashsel hashnpage )); + +/* + * hash table bpchar_ops + */ +DATA(insert OID = 0 ( 405 1076 1054 1 hashsel hashnpage )); + +/* + * hash table varchar_ops + */ +DATA(insert OID = 0 ( 405 1077 1062 1 hashsel hashnpage )); + +/* + * hash table date_ops + */ +DATA(insert OID = 0 ( 405 1114 1093 1 hashsel hashnpage )); + +/* + * hash table time_ops + */ +DATA(insert OID = 0 ( 405 1115 1108 1 hashsel hashnpage )); + + +#endif /* PG_AMOP_H */ diff --git a/src/include/catalog/pg_amproc.h b/src/include/catalog/pg_amproc.h new file mode 100644 index 0000000000..e00d35c8a9 --- /dev/null +++ b/src/include/catalog/pg_amproc.h @@ -0,0 +1,136 @@ +/*------------------------------------------------------------------------- + * + * pg_amproc.h-- + * definition of the system "amproc" relation (pg_amproce) + * along with the relation's initial contents. The amproc + * catalog is used to store procedures used by indexed access + * methods that aren't associated with operators. + * + * + * Copyright (c) 1994, Regents of the University of California + * + * $Id: pg_amproc.h,v 1.1 1996/08/28 01:56:36 scrappy Exp $ + * + * NOTES + * the genbki.sh script reads this file and generates .bki + * information from the DATA() statements. + * + *------------------------------------------------------------------------- + */ +#ifndef PG_AMPROC_H +#define PG_AMPROC_H + +/* ---------------- + * postgres.h contains the system type definintions and the + * CATALOG(), BOOTSTRAP and DATA() sugar words so this file + * can be read by both genbki.sh and the C compiler. + * ---------------- + */ +#include "postgres.h" + +/* ---------------- + * pg_amproc definition. cpp turns this into + * typedef struct FormData_pg_amproc + * ---------------- + */ +CATALOG(pg_amproc) { + Oid amid; + Oid amopclaid; + Oid amproc; + int2 amprocnum; +} FormData_pg_amproc; + +/* ---------------- + * Form_pg_amproc corresponds to a pointer to a tuple with + * the format of pg_amproc relation. + * ---------------- + */ +typedef FormData_pg_amproc *Form_pg_amproc; + +/* ---------------- + * compiler constants for pg_amproc + * ---------------- + */ +#define Natts_pg_amproc 4 +#define Anum_pg_amproc_amid 1 +#define Anum_pg_amproc_amopclaid 2 +#define Anum_pg_amproc_amproc 3 +#define Anum_pg_amproc_amprocnum 4 + +/* ---------------- + * initial contents of pg_amproc + * ---------------- + */ + +DATA(insert OID = 0 (402 422 193 1)); +DATA(insert OID = 0 (402 422 194 2)); +DATA(insert OID = 0 (402 422 195 3)); +DATA(insert OID = 0 (402 433 193 1)); +DATA(insert OID = 0 (402 433 194 2)); +DATA(insert OID = 0 (402 433 196 3)); +DATA(insert OID = 0 (402 434 197 1)); +DATA(insert OID = 0 (402 434 198 2)); +DATA(insert OID = 0 (402 434 199 3)); +DATA(insert OID = 0 (403 421 350 1)); +DATA(insert OID = 0 (403 423 355 1)); +DATA(insert OID = 0 (403 424 353 1)); +DATA(insert OID = 0 (403 425 352 1)); +DATA(insert OID = 0 (403 426 351 1)); +DATA(insert OID = 0 (403 427 356 1)); +DATA(insert OID = 0 (403 428 354 1)); +DATA(insert OID = 0 (403 429 358 1)); +DATA(insert OID = 0 (403 406 689 1)); +DATA(insert OID = 0 (403 407 690 1)); +DATA(insert OID = 0 (403 408 691 1)); +DATA(insert OID = 0 (403 1181 359 1)); +DATA(insert OID = 0 (403 430 374 1)); +DATA(insert OID = 0 (403 431 360 1)); +DATA(insert OID = 0 (403 432 357 1)); +DATA(insert OID = 0 (403 435 928 1)); +DATA(insert OID = 0 (403 436 948 1)); +DATA(insert OID = 0 (403 437 828 1)); +DATA(insert OID = 0 (403 1076 1078 1)); +DATA(insert OID = 0 (403 1077 1079 1)); +DATA(insert OID = 0 (403 1114 1092 1)); +DATA(insert OID = 0 (403 1115 1107 1)); + +BKI_BEGIN +#ifdef NOBTREE +BKI_END +DATA(insert OID = 0 (404 421 350 1)); +DATA(insert OID = 0 (404 423 355 1)); +DATA(insert OID = 0 (404 424 353 1)); +DATA(insert OID = 0 (404 425 352 1)); +DATA(insert OID = 0 (404 426 351 1)); +DATA(insert OID = 0 (404 427 356 1)); +DATA(insert OID = 0 (404 428 354 1)); +DATA(insert OID = 0 (404 429 358 1)); +DATA(insert OID = 0 (404 406 689 1)); +DATA(insert OID = 0 (404 407 690 1)); +DATA(insert OID = 0 (404 408 691 1)); +DATA(insert OID = 0 (404 1181 359 1)); +DATA(insert OID = 0 (404 430 374 1)); +DATA(insert OID = 0 (404 431 360 1)); +DATA(insert OID = 0 (404 432 357 1)); +BKI_BEGIN +#endif /* NOBTREE */ +BKI_END + +DATA(insert OID = 0 (405 421 449 1)); +DATA(insert OID = 0 (405 423 452 1)); +DATA(insert OID = 0 (405 426 450 1)); +DATA(insert OID = 0 (405 427 453 1)); +DATA(insert OID = 0 (405 428 451 1)); +DATA(insert OID = 0 (405 429 454 1)); +DATA(insert OID = 0 (405 406 692 1)); +DATA(insert OID = 0 (405 407 693 1)); +DATA(insert OID = 0 (405 408 694 1)); +DATA(insert OID = 0 (405 1181 455 1)); +DATA(insert OID = 0 (405 430 499 1)); +DATA(insert OID = 0 (405 431 456 1)); +DATA(insert OID = 0 (405 1076 1080 1)); +DATA(insert OID = 0 (405 1077 1081 1)); +DATA(insert OID = 0 (405 1114 450 1)); +DATA(insert OID = 0 (405 1115 694 1)); + +#endif /* PG_AMPROC_H */ diff --git a/src/include/catalog/pg_attribute.h b/src/include/catalog/pg_attribute.h new file mode 100644 index 0000000000..a6796dd2fa --- /dev/null +++ b/src/include/catalog/pg_attribute.h @@ -0,0 +1,544 @@ +/*------------------------------------------------------------------------- + * + * pg_attribute.h-- + * definition of the system "attribute" relation (pg_attribute) + * along with the relation's initial contents. + * + * + * Copyright (c) 1994, Regents of the University of California + * + * $Id: pg_attribute.h,v 1.1 1996/08/28 01:56:37 scrappy Exp $ + * + * NOTES + * the genbki.sh script reads this file and generates .bki + * information from the DATA() statements. + * + * utils/cache/relcache.c requires some hard-coded tuple descriptors + * for some of the system catalogs so if the schema for any of + * these changes, be sure and change the appropriate Schema_xxx + * macros! -cim 2/5/91 + * + *------------------------------------------------------------------------- + */ +#ifndef PG_ATTRIBUTE_H +#define PG_ATTRIBUTE_H + +/* ---------------- + * postgres.h contains the system type definintions and the + * CATALOG(), BOOTSTRAP and DATA() sugar words so this file + * can be read by both genbki.sh and the C compiler. + * ---------------- + */ +#include "postgres.h" +#include "access/attnum.h" + +/* ---------------- + * pg_attribute definition. cpp turns this into + * typedef struct FormData_pg_attribute + * + * If you change the following, make sure you change the structs for + * system attributes in heap.c and index.c also. + * ---------------- + */ +CATALOG(pg_attribute) BOOTSTRAP { + Oid attrelid; + NameData attname; + Oid atttypid; + /* atttypid is the OID of the instance in Catalog Class pg_type that + defines the data type of this attribute (e.g. int4). Information in + that instance is redundant with the attlen, attbyval, and attalign + attributes of this instance, so they had better match or Postgres + will fail. + */ + Oid attdefrel; + int4 attnvals; + Oid atttyparg; /* type arg for arrays/spquel/procs */ + int2 attlen; + /* attlen is a copy of the typlen field from pg_type for this + attribute. See atttypid above. See struct TypeTupleFormData for + definition. + */ + int2 attnum; + /* attnum is the "attribute number" for the attribute: A + value that uniquely identifies this attribute within its class. + For user attributes, Attribute numbers are greater than 0 and + not greater than the number of attributes in the class. + I.e. if the Class pg_class says that Class XYZ has 10 + attributes, then the user attribute numbers in Class + pg_attribute must be 1-10. + + System attributes have attribute numbers less than 0 that are + unique within the class, but not constrained to any particular range. + + Note that (attnum - 1) is often used as the index to an array. + */ + int2 attbound; + bool attbyval; + /* attbyval is a copy of the typbyval field from pg_type for this + attribute. See atttypid above. See struct TypeTupleFormData for + definition. + */ + bool attcanindex; + Oid attproc; /* spquel? */ + int4 attnelems; + int4 attcacheoff; + /* fastgetattr() uses attcacheoff to cache byte offsets of + attributes in heap tuples. The data actually stored in + pg_attribute (-1) indicates no cached value. But when we + copy these tuples into a tuple descriptor, we may then update + attcacheoff in the copies. This speeds up the attribute + walking process. + */ + bool attisset; + char attalign; + /* attalign is a copy of the typalign field from pg_type for this + attribute. See atttypid above. See struct TypeTupleFormData for + definition. + */ +} FormData_pg_attribute; + +/* + * someone should figure out how to do this properly. (The problem is + * the size of the C struct is not the same as the size of the tuple.) + */ +#define ATTRIBUTE_TUPLE_SIZE \ + (offsetof(FormData_pg_attribute,attalign) + sizeof(char)) + +/* ---------------- + * Form_pg_attribute corresponds to a pointer to a tuple with + * the format of pg_attribute relation. + * ---------------- + */ +typedef FormData_pg_attribute *AttributeTupleForm; + +/* ---------------- + * compiler constants for pg_attribute + * ---------------- + */ + +#define Natts_pg_attribute 16 +#define Anum_pg_attribute_attrelid 1 +#define Anum_pg_attribute_attname 2 +#define Anum_pg_attribute_atttypid 3 +#define Anum_pg_attribute_attdefrel 4 +#define Anum_pg_attribute_attnvals 5 +#define Anum_pg_attribute_atttyparg 6 +#define Anum_pg_attribute_attlen 7 +#define Anum_pg_attribute_attnum 8 +#define Anum_pg_attribute_attbound 9 +#define Anum_pg_attribute_attbyval 10 +#define Anum_pg_attribute_attcanindex 11 +#define Anum_pg_attribute_attproc 12 +#define Anum_pg_attribute_attnelems 13 +#define Anum_pg_attribute_attcacheoff 14 +#define Anum_pg_attribute_attisset 15 +#define Anum_pg_attribute_attalign 16 + + +/* ---------------- + * SCHEMA_ macros for declaring hardcoded tuple descriptors. + * these are used in utils/cache/relcache.c + * ---------------- +#define SCHEMA_NAME(x) CppConcat(Name_,x) +#define SCHEMA_DESC(x) CppConcat(Desc_,x) +#define SCHEMA_NATTS(x) CppConcat(Natts_,x) +#define SCHEMA_DEF(x) \ + FormData_pg_attribute \ + SCHEMA_DESC(x) [ SCHEMA_NATTS(x) ] = \ + { \ + CppConcat(Schema_,x) \ + } + */ + +/* ---------------- + * initial contents of pg_attribute + * ---------------- + */ + +/* ---------------- + * pg_type schema + * ---------------- + */ +#define Schema_pg_type \ +{ 71l, {"typname"}, 19l, 71l, 0l, 0l, NAMEDATALEN, 1, 0, '\0', '\001', 0l, 0l, -1l, '\0', 'i' }, \ +{ 71l, {"typowner"}, 26l, 71l, 0l, 0l, 4, 2, 0, '\001', '\001', 0l, 0l, -1l, '\0', 'i' }, \ +{ 71l, {"typlen"}, 21l, 71l, 0l, 0l, 2, 3, 0, '\001', '\001', 0l, 0l, -1l, '\0', 's' }, \ +{ 71l, {"typprtlen"}, 21l, 71l, 0l, 0l, 2, 4, 0, '\001', '\001', 0l, 0l, -1l, '\0', 's' }, \ +{ 71l, {"typbyval"}, 16l, 71l, 0l, 0l, 1, 5, 0, '\001', '\001', 0l, 0l, -1l, '\0', 'c' }, \ +{ 71l, {"typtype"}, 18l, 71l, 0l, 0l, 1, 6, 0, '\001', '\001', 0l, 0l, -1l, '\0', 'c' }, \ +{ 71l, {"typisdefined"}, 16l, 71l, 0l, 0l, 1, 7, 0, '\001', '\001', 0l, 0l, -1l, '\0', 'c' }, \ +{ 71l, {"typdelim"}, 18l, 71l, 0l, 0l, 1, 8, 0, '\001', '\001', 0l, 0l, -1l, '\0', 'c' }, \ +{ 71l, {"typrelid"}, 26l, 71l, 0l, 0l, 4, 9, 0, '\001', '\001', 0l, 0l, -1l, '\0', 'i' }, \ +{ 71l, {"typelem"}, 26l, 71l, 0l, 0l, 4, 10, 0, '\001', '\001', 0l, 0l, -1l, '\0', 'i' }, \ +{ 71l, {"typinput"}, 24l, 71l, 0l, 0l, 4, 11, 0, '\001', '\001', 0l, 0l, -1l, '\0', 'i' }, \ +{ 71l, {"typoutput"}, 24l, 71l, 0l, 0l, 4, 12, 0, '\001', '\001', 0l, 0l, -1l, '\0', 'i' }, \ +{ 71l, {"typreceive"}, 24l, 71l, 0l, 0l, 4, 13, 0, '\001', '\001', 0l, 0l, -1l, '\0', 'i' }, \ +{ 71l, {"typsend"}, 24l, 71l, 0l, 0l, 4, 14, 0, '\001', '\001', 0l, 0l, -1l, '\0', 'i' }, \ +{ 71l, {"typalign"}, 18l, 71l, 0l, 0l, 1, 15, 0, '\001', '\001', 0l, 0l, -1l, '\0', 'c' }, \ +{ 71l, {"typdefault"}, 25l, 71l, 0l, 0l, -1, 16, 0, '\0', '\001', 0l, 0l, -1l, '\0', 'i' } + +DATA(insert OID = 0 ( 71 typname 19 0 0 0 NAMEDATALEN 1 0 f t 0 0 -1 f i)); +DATA(insert OID = 0 ( 71 typowner 26 0 0 0 4 2 0 t t 0 0 -1 f i)); +DATA(insert OID = 0 ( 71 typlen 21 0 0 0 2 3 0 t t 0 0 -1 f s)); +DATA(insert OID = 0 ( 71 typprtlen 21 0 0 0 2 4 0 t t 0 0 -1 f s)); +DATA(insert OID = 0 ( 71 typbyval 16 0 0 0 1 5 0 t t 0 0 -1 f c)); +DATA(insert OID = 0 ( 71 typtype 18 0 0 0 1 6 0 t t 0 0 -1 f c)); +DATA(insert OID = 0 ( 71 typisdefined 16 0 0 0 1 7 0 t t 0 0 -1 f c)); +DATA(insert OID = 0 ( 71 typdelim 18 0 0 0 1 8 0 t t 0 0 -1 f c)); +DATA(insert OID = 0 ( 71 typrelid 26 0 0 0 4 9 0 t t 0 0 -1 f i)); +DATA(insert OID = 0 ( 71 typelem 26 0 0 0 4 10 0 t t 0 0 -1 f i)); +DATA(insert OID = 0 ( 71 typinput 26 0 0 0 4 11 0 t t 0 0 -1 f i)); +DATA(insert OID = 0 ( 71 typoutput 26 0 0 0 4 12 0 t t 0 0 -1 f i)); +DATA(insert OID = 0 ( 71 typreceive 26 0 0 0 4 13 0 t t 0 0 -1 f i)); +DATA(insert OID = 0 ( 71 typsend 26 0 0 0 4 14 0 t t 0 0 -1 f i)); +DATA(insert OID = 0 ( 71 typalign 18 0 0 0 1 15 0 t t 0 0 -1 f c)); +DATA(insert OID = 0 ( 71 typdefault 25 0 0 0 -1 16 0 f t 0 0 -1 f i)); +DATA(insert OID = 0 ( 71 ctid 27 0 0 0 6 -1 0 f t 0 0 -1 f i)); +DATA(insert OID = 0 ( 71 oid 26 0 0 0 4 -2 0 t t 0 0 -1 f i)); +DATA(insert OID = 0 ( 71 xmin 28 0 0 0 4 -3 0 f t 0 0 -1 f i)); +DATA(insert OID = 0 ( 71 cmin 29 0 0 0 2 -4 0 t t 0 0 -1 f s)); +DATA(insert OID = 0 ( 71 xmax 28 0 0 0 4 -5 0 f t 0 0 -1 f i)); +DATA(insert OID = 0 ( 71 cmax 29 0 0 0 2 -6 0 t t 0 0 -1 f s)); +DATA(insert OID = 0 ( 71 chain 27 0 0 0 6 -7 0 f t 0 0 -1 f i)); +DATA(insert OID = 0 ( 71 anchor 27 0 0 0 6 -8 0 f t 0 0 -1 f i)); +DATA(insert OID = 0 ( 71 tmax 702 0 0 0 4 -9 0 t t 0 0 -1 f i)); +DATA(insert OID = 0 ( 71 tmin 702 0 0 0 4 -10 0 t t 0 0 -1 f i)); +DATA(insert OID = 0 ( 71 vtype 18 0 0 0 1 -11 0 t t 0 0 -1 f c)); + +/* ---------------- + * pg_database + * ---------------- + */ +DATA(insert OID = 0 ( 88 datname 19 0 0 0 NAMEDATALEN 1 0 f t 0 0 -1 f i)); +DATA(insert OID = 0 ( 88 datdba 26 0 0 0 4 2 0 t t 0 0 -1 f i)); +DATA(insert OID = 0 ( 88 datpath 25 0 0 0 -1 3 0 f t 0 0 -1 f i)); +DATA(insert OID = 0 ( 88 ctid 27 0 0 0 6 -1 0 f t 0 0 -1 f i)); +DATA(insert OID = 0 ( 88 oid 26 0 0 0 4 -2 0 t t 0 0 -1 f i)); +DATA(insert OID = 0 ( 88 xmin 28 0 0 0 4 -3 0 f t 0 0 -1 f i)); +DATA(insert OID = 0 ( 88 cmin 29 0 0 0 2 -4 0 t t 0 0 -1 f s)); +DATA(insert OID = 0 ( 88 xmax 28 0 0 0 4 -5 0 f t 0 0 -1 f i)); +DATA(insert OID = 0 ( 88 cmax 29 0 0 0 2 -6 0 t t 0 0 -1 f s)); +DATA(insert OID = 0 ( 88 chain 27 0 0 0 6 -7 0 f t 0 0 -1 f i)); +DATA(insert OID = 0 ( 88 anchor 27 0 0 0 6 -8 0 f t 0 0 -1 f i)); +DATA(insert OID = 0 ( 88 tmax 702 0 0 0 4 -9 0 t t 0 0 -1 f i)); +DATA(insert OID = 0 ( 88 tmin 702 0 0 0 4 -10 0 t t 0 0 -1 f i)); +DATA(insert OID = 0 ( 88 vtype 18 0 0 0 1 -11 0 t t 0 0 -1 f c)); + +/* ---------------- + * pg_demon + * ---------------- + */ +DATA(insert OID = 0 ( 76 demserid 26 0 0 0 4 1 0 t t 0 0 -1 f i)); +DATA(insert OID = 0 ( 76 demname 19 0 0 0 NAMEDATALEN 2 0 f t 0 0 -1 f i)); +DATA(insert OID = 0 ( 76 demowner 26 0 0 0 4 3 0 t t 0 0 -1 f i)); +DATA(insert OID = 0 ( 76 demcode 24 0 0 0 4 4 0 t t 0 0 -1 f i)); +DATA(insert OID = 0 ( 76 ctid 27 0 0 0 6 -1 0 f t 0 0 -1 f i)); + +DATA(insert OID = 0 ( 76 oid 26 0 0 0 4 -2 0 t t 0 0 -1 f i)); +DATA(insert OID = 0 ( 76 xmin 28 0 0 0 4 -3 0 f t 0 0 -1 f i)); +DATA(insert OID = 0 ( 76 cmin 29 0 0 0 2 -4 0 t t 0 0 -1 f s)); +DATA(insert OID = 0 ( 76 xmax 28 0 0 0 4 -5 0 f t 0 0 -1 f i)); +DATA(insert OID = 0 ( 76 cmax 29 0 0 0 2 -6 0 t t 0 0 -1 f s)); +DATA(insert OID = 0 ( 76 chain 27 0 0 0 6 -7 0 f t 0 0 -1 f i)); +DATA(insert OID = 0 ( 76 anchor 27 0 0 0 6 -8 0 f t 0 0 -1 f i)); +DATA(insert OID = 0 ( 76 tmax 702 0 0 0 4 -9 0 t t 0 0 -1 f i)); +DATA(insert OID = 0 ( 76 tmin 702 0 0 0 4 -10 0 t t 0 0 -1 f i)); +DATA(insert OID = 0 ( 76 vtype 18 0 0 0 1 -11 0 t t 0 0 -1 f c)); + +/* ---------------- + * pg_proc + * ---------------- + */ +#define Schema_pg_proc \ +{ 81l, {"proname"}, 19l, 81l, 0l, 0l, NAMEDATALEN, 1, 0, '\0', '\001', 0l, 0l, -1l, '\0', 'i' }, \ +{ 81l, {"proowner"}, 26l, 81l, 0l, 0l, 4, 2, 0, '\001', '\001', 0l, 0l, -1l, '\0', 'i' }, \ +{ 81l, {"prolang"}, 26l, 81l, 0l, 0l, 4, 3, 0, '\001', '\001', 0l, 0l, -1l, '\0', 'i' }, \ +{ 81l, {"proisinh"}, 16l, 81l, 0l, 0l, 1, 4, 0, '\001', '\001', 0l, 0l, -1l, '\0', 'c' }, \ +{ 81l, {"proistrusted"}, 16l, 81l, 0l, 0l, 1, 5, 0, '\001', '\001', 0l, 0l, -1l, '\0', 'c' }, \ +{ 81l, {"proiscachable"}, 16l, 81l, 0l, 0l, 1, 6, 0, '\001', '\001', 0l, 0l, -1l, '\0', 'c' }, \ +{ 81l, {"pronargs"}, 21l, 81l, 0l, 0l, 2, 7, 0, '\001', '\001', 0l, 0l, -1l, '\0', 's' }, \ +{ 81l, {"proretset"}, 16l, 81l, 0l, 0l, 1, 8, 0, '\001', '\001', 0l, 0l, -1l, '\0', 'c' }, \ +{ 81l, {"prorettype"}, 26l, 81l, 0l, 0l, 4, 9, 0, '\001', '\001', 0l, 0l, -1l, '\0', 'i' }, \ +{ 81l, {"proargtypes"}, 30l, 81l, 0l, 0l, 32, 10, 0, '\0', '\001', 0l, 0l, \ + -1l, '\0', 'i' }, \ +{ 81l, {"probyte_pct"}, 23l, 81l, 0l, 0l, 4, 11, 0, '\001', '\001', 0l, 0l, \ + -1l, '\0', 'i' }, \ +{ 81l, {"properbyte_cpu"}, 23l, 81l, 0l, 0l, 4, 12, 0, '\001', '\001', 0l, 0l, -1l, '\0', 'i' }, \ +{ 81l, {"propercall_cpu"}, 23l, 81l, 0l, 0l, 4, 13, 0, '\001', '\001', 0l, 0l, -1l, '\0', 'i' }, \ +{ 81l, {"prooutin_ratio"}, 23l, 81l, 0l, 0l, 4, 14, 0, '\001', '\001', 0l, 0l, -1l, '\0', 'i' }, \ +{ 81l, {"prosrc"}, 25l, 81l, 0l, 0l, -1, 15, 0, '\0', '\001', 0l, 0l, -1l, '\0', 'i' }, \ +{ 81l, {"probin"}, 17l, 81l, 0l, 0l, -1, 16, 0, '\0', '\001', 0l, 0l, -1l, '\0', 'i' } + +DATA(insert OID = 0 ( 81 proname 19 0 0 0 NAMEDATALEN 1 0 f t 0 0 -1 f i)); +DATA(insert OID = 0 ( 81 proowner 26 0 0 0 4 2 0 t t 0 0 -1 f i)); +DATA(insert OID = 0 ( 81 prolang 26 0 0 0 4 3 0 t t 0 0 -1 f i)); +DATA(insert OID = 0 ( 81 proisinh 16 0 0 0 1 4 0 t t 0 0 -1 f c)); +DATA(insert OID = 0 ( 81 proistrusted 16 0 0 0 1 5 0 t t 0 0 -1 f c)); +DATA(insert OID = 0 ( 81 proiscachable 16 0 0 0 1 6 0 t t 0 0 -1 f c)); +DATA(insert OID = 0 ( 81 pronargs 21 0 0 0 2 7 0 t t 0 0 -1 f s)); +DATA(insert OID = 0 ( 81 proretset 16 0 0 0 1 8 0 t t 0 0 -1 f c)); +DATA(insert OID = 0 ( 81 prorettype 26 0 0 0 4 9 0 t t 0 0 -1 f i)); +DATA(insert OID = 0 ( 81 proargtypes 30 0 0 0 32 10 0 f t 0 0 -1 f i)); +DATA(insert OID = 0 ( 81 probyte_pct 23 0 0 0 4 11 0 t t 0 0 -1 f i)); +DATA(insert OID = 0 ( 81 properbyte_cpu 23 0 0 0 4 12 0 t t 0 0 -1 f i)); +DATA(insert OID = 0 ( 81 propercall_cpu 23 0 0 0 4 13 0 t t 0 0 -1 f i)); +DATA(insert OID = 0 ( 81 prooutin_ratio 23 0 0 0 4 14 0 t t 0 0 -1 f i)); +DATA(insert OID = 0 ( 81 prosrc 25 0 0 0 -1 15 0 f t 0 0 -1 f i)); +DATA(insert OID = 0 ( 81 probin 17 0 0 0 -1 16 0 f t 0 0 -1 f i)); +DATA(insert OID = 0 ( 81 ctid 27 0 0 0 6 -1 0 f t 0 0 -1 f i)); +DATA(insert OID = 0 ( 81 oid 26 0 0 0 4 -2 0 t t 0 0 -1 f i)); +DATA(insert OID = 0 ( 81 xmin 28 0 0 0 4 -3 0 f t 0 0 -1 f i)); +DATA(insert OID = 0 ( 81 cmin 29 0 0 0 2 -4 0 t t 0 0 -1 f s)); +DATA(insert OID = 0 ( 81 xmax 28 0 0 0 4 -5 0 f t 0 0 -1 f i)); +DATA(insert OID = 0 ( 81 cmax 29 0 0 0 2 -6 0 t t 0 0 -1 f s)); +DATA(insert OID = 0 ( 81 chain 27 0 0 0 6 -7 0 f t 0 0 -1 f i)); +DATA(insert OID = 0 ( 81 anchor 27 0 0 0 6 -8 0 f t 0 0 -1 f i)); +DATA(insert OID = 0 ( 81 tmax 702 0 0 0 4 -9 0 t t 0 0 -1 f i)); +DATA(insert OID = 0 ( 81 tmin 702 0 0 0 4 -10 0 t t 0 0 -1 f i)); +DATA(insert OID = 0 ( 81 vtype 18 0 0 0 1 -11 0 t t 0 0 -1 f c)); + +/* ---------------- + * pg_server + * ---------------- + */ +DATA(insert OID = 0 ( 82 sername 19 0 0 0 NAMEDATALEN 1 0 f t 0 0 -1 f i)); +DATA(insert OID = 0 ( 82 serpid 21 0 0 0 2 2 0 t t 0 0 -1 f s)); +DATA(insert OID = 0 ( 82 serport 21 0 0 0 2 3 0 t t 0 0 -1 f s)); +DATA(insert OID = 0 ( 82 ctid 27 0 0 0 6 -1 0 f t 0 0 -1 f i)); +DATA(insert OID = 0 ( 82 oid 26 0 0 0 4 -2 0 t t 0 0 -1 f i)); +DATA(insert OID = 0 ( 82 xmin 28 0 0 0 4 -3 0 f t 0 0 -1 f i)); +DATA(insert OID = 0 ( 82 cmin 29 0 0 0 2 -4 0 t t 0 0 -1 f s)); +DATA(insert OID = 0 ( 82 xmax 28 0 0 0 4 -5 0 f t 0 0 -1 f i)); +DATA(insert OID = 0 ( 82 cmax 29 0 0 0 2 -6 0 t t 0 0 -1 f s)); +DATA(insert OID = 0 ( 82 chain 27 0 0 0 6 -7 0 f t 0 0 -1 f i)); +DATA(insert OID = 0 ( 82 anchor 27 0 0 0 6 -8 0 f t 0 0 -1 f i)); +DATA(insert OID = 0 ( 82 tmax 702 0 0 0 4 -9 0 t t 0 0 -1 f i)); +DATA(insert OID = 0 ( 82 tmin 702 0 0 0 4 -10 0 t t 0 0 -1 f i)); +DATA(insert OID = 0 ( 82 vtype 18 0 0 0 1 -11 0 t t 0 0 -1 f c)); + +/* ---------------- + * pg_user + * ---------------- + */ +DATA(insert OID = 0 ( 86 usename 19 0 0 0 NAMEDATALEN 1 0 f t 0 0 -1 f i)); +DATA(insert OID = 0 ( 86 usesysid 23 0 0 0 4 2 0 t t 0 0 -1 f s)); +DATA(insert OID = 0 ( 86 usecreatedb 16 0 0 0 1 3 0 t t 0 0 -1 f c)); +DATA(insert OID = 0 ( 86 usetrace 16 0 0 0 1 4 0 t t 0 0 -1 f c)); +DATA(insert OID = 0 ( 86 usesuper 16 0 0 0 1 5 0 t t 0 0 -1 f c)); +DATA(insert OID = 0 ( 86 usecatupd 16 0 0 0 1 6 0 t t 0 0 -1 f c)); +DATA(insert OID = 0 ( 86 ctid 27 0 0 0 6 -1 0 f t 0 0 -1 f i)); +DATA(insert OID = 0 ( 86 oid 26 0 0 0 4 -2 0 t t 0 0 -1 f i)); +DATA(insert OID = 0 ( 86 xmin 28 0 0 0 4 -3 0 f t 0 0 -1 f i)); +DATA(insert OID = 0 ( 86 cmin 29 0 0 0 2 -4 0 t t 0 0 -1 f s)); +DATA(insert OID = 0 ( 86 xmax 28 0 0 0 4 -5 0 f t 0 0 -1 f i)); +DATA(insert OID = 0 ( 86 cmax 29 0 0 0 2 -6 0 t t 0 0 -1 f s)); +DATA(insert OID = 0 ( 86 chain 27 0 0 0 6 -7 0 f t 0 0 -1 f i)); +DATA(insert OID = 0 ( 86 anchor 27 0 0 0 6 -8 0 f t 0 0 -1 f i)); +DATA(insert OID = 0 ( 86 tmax 702 0 0 0 4 -9 0 t t 0 0 -1 f i)); +DATA(insert OID = 0 ( 86 tmin 702 0 0 0 4 -10 0 t t 0 0 -1 f i)); +DATA(insert OID = 0 ( 86 vtype 18 0 0 0 1 -11 0 t t 0 0 -1 f c)); + +/* ---------------- + * pg_group + * ---------------- + */ +DATA(insert OID = 0 ( 87 groname 19 0 0 0 NAMEDATALEN 1 0 f t 0 0 -1 f i)); +DATA(insert OID = 0 ( 87 grosysid 23 0 0 0 4 2 0 t t 0 0 -1 f s)); +DATA(insert OID = 0 ( 87 grolist 1007 0 0 0 -1 3 0 f t 0 0 -1 f i)); +DATA(insert OID = 0 ( 87 ctid 27 0 0 0 6 -1 0 f t 0 0 -1 f i)); +DATA(insert OID = 0 ( 87 oid 26 0 0 0 4 -2 0 t t 0 0 -1 f i)); +DATA(insert OID = 0 ( 87 xmin 28 0 0 0 4 -3 0 f t 0 0 -1 f i)); +DATA(insert OID = 0 ( 87 cmin 29 0 0 0 2 -4 0 t t 0 0 -1 f s)); +DATA(insert OID = 0 ( 87 xmax 28 0 0 0 4 -5 0 f t 0 0 -1 f i)); +DATA(insert OID = 0 ( 87 cmax 29 0 0 0 2 -6 0 t t 0 0 -1 f s)); +DATA(insert OID = 0 ( 87 chain 27 0 0 0 6 -7 0 f t 0 0 -1 f i)); +DATA(insert OID = 0 ( 87 anchor 27 0 0 0 6 -8 0 f t 0 0 -1 f i)); +DATA(insert OID = 0 ( 87 tmax 702 0 0 0 4 -9 0 t t 0 0 -1 f i)); +DATA(insert OID = 0 ( 87 tmin 702 0 0 0 4 -10 0 t t 0 0 -1 f i)); +DATA(insert OID = 0 ( 87 vtype 18 0 0 0 1 -11 0 t t 0 0 -1 f c)); + +/* ---------------- + * pg_attribute + * ---------------- + */ +#define Schema_pg_attribute \ +{ 75l, {"attrelid"}, 26l, 75l, 0l, 0l, 4, 1, 0, '\001', '\001', 0l, 0l, -1l, '\0', 'i' }, \ +{ 75l, {"attname"}, 19l, 75l, 0l, 0l, NAMEDATALEN, 2, 0, '\0', '\001', 0l, 0l, -1l, '\0', 'i' }, \ +{ 75l, {"atttypid"}, 26l, 75l, 0l, 0l, 4, 3, 0, '\001', '\001', 0l, 0l, -1l, '\0', 'i' }, \ +{ 75l, {"attdefrel"}, 26l, 75l, 0l, 0l, 4, 4, 0, '\001', '\001', 0l, 0l, -1l, '\0', 'i' }, \ +{ 75l, {"attnvals"}, 23l, 75l, 0l, 0l, 4, 5, 0, '\001', '\001', 0l, 0l, -1l, '\0', 'i' }, \ +{ 75l, {"atttyparg"}, 26l, 75l, 0l, 0l, 4, 6, 0, '\001', '\001', 0l, 0l, -1l, '\0', 'i' }, \ +{ 75l, {"attlen"}, 21l, 75l, 0l, 0l, 2, 7, 0, '\001', '\001', 0l, 0l, -1l, '\0', 's' }, \ +{ 75l, {"attnum"}, 21l, 75l, 0l, 0l, 2, 8, 0, '\001', '\001', 0l, 0l, -1l, '\0', 's' }, \ +{ 75l, {"attbound"}, 21l, 75l, 0l, 0l, 2, 9, 0, '\001', '\001', 0l, 0l, -1l, '\0', 's' }, \ +{ 75l, {"attbyval"}, 16l, 75l, 0l, 0l, 1, 10, 0, '\001', '\001', 0l, 0l, -1l, '\0', 'c' }, \ +{ 75l, {"attcanindex"}, 16l, 75l, 0l, 0l, 1, 11, 0, '\001', '\001', 0l, 0l, -1l, '\0', 'c' }, \ +{ 75l, {"attproc"}, 26l, 75l, 0l, 0l, 4, 12, 0, '\001', '\001', 0l, 0l, -1l, '\0', 'i' }, \ +{ 75l, {"attnelems"}, 23l, 75l, 0l, 0l, 4, 13, 0, '\001', '\001', 0l, 0l, -1l, '\0', 'i' }, \ +{ 75l, {"attcacheoff"}, 23l, 75l, 0l, 0l, 4, 14, 0, '\001', '\001', 0l, 0l, -1l, '\0', 'i' }, \ +{ 75l, {"attisset"}, 16l, 75l, 0l, 0l, 1, 15, 0, '\001', '\001', 0l, 0l, -1l, '\0', 'c' }, \ +{ 75l, {"attalign"}, 18l, 75l, 0l, 0l, 1, 16, 0, '\001', '\001', 0l, 0l, -1l, '\0', 'c' } + +DATA(insert OID = 0 ( 75 attrelid 26 0 0 0 4 1 0 t t 0 0 -1 f i)); +DATA(insert OID = 0 ( 75 attname 19 0 0 0 NAMEDATALEN 2 0 f t 0 0 -1 f i)); +DATA(insert OID = 0 ( 75 atttypid 26 0 0 0 4 3 0 t t 0 0 -1 f i)); +DATA(insert OID = 0 ( 75 attdefrel 26 0 0 0 4 4 0 t t 0 0 -1 f i)); +DATA(insert OID = 0 ( 75 attnvals 23 0 0 0 4 5 0 t t 0 0 -1 f i)); +DATA(insert OID = 0 ( 75 atttyparg 26 0 0 0 4 6 0 t t 0 0 -1 f i)); +DATA(insert OID = 0 ( 75 attlen 21 0 0 0 2 7 0 t t 0 0 -1 f s)); +DATA(insert OID = 0 ( 75 attnum 21 0 0 0 2 8 0 t t 0 0 -1 f s)); +DATA(insert OID = 0 ( 75 attbound 21 0 0 0 2 9 0 t t 0 0 -1 f s)); +DATA(insert OID = 0 ( 75 attbyval 16 0 0 0 1 10 0 t t 0 0 -1 f c)); +DATA(insert OID = 0 ( 75 attcanindex 16 0 0 0 1 11 0 t t 0 0 -1 f c)); +DATA(insert OID = 0 ( 75 attproc 26 0 0 0 4 12 0 t t 0 0 -1 f i)); +DATA(insert OID = 0 ( 75 attnelems 23 0 0 0 4 13 0 t t 0 0 -1 f i)); +DATA(insert OID = 0 ( 75 attcacheoff 23 0 0 0 4 14 0 t t 0 0 -1 f i)); +DATA(insert OID = 0 ( 75 attisset 16 0 0 0 1 15 0 t t 0 0 -1 f c)); +DATA(insert OID = 0 ( 75 attalign 18 0 0 0 1 16 0 t t 0 0 -1 f c)); +DATA(insert OID = 0 ( 75 ctid 27 0 0 0 6 -1 0 f t 0 0 -1 f i)); +DATA(insert OID = 0 ( 75 oid 26 0 0 0 4 -2 0 t t 0 0 -1 f i)); +DATA(insert OID = 0 ( 75 xmin 28 0 0 0 4 -3 0 f t 0 0 -1 f i)); +DATA(insert OID = 0 ( 75 cmin 29 0 0 0 2 -4 0 t t 0 0 -1 f s)); +DATA(insert OID = 0 ( 75 xmax 28 0 0 0 4 -5 0 f t 0 0 -1 f i)); +DATA(insert OID = 0 ( 75 cmax 29 0 0 0 2 -6 0 t t 0 0 -1 f s)); +DATA(insert OID = 0 ( 75 chain 27 0 0 0 6 -7 0 f t 0 0 -1 f i)); +DATA(insert OID = 0 ( 75 anchor 27 0 0 0 6 -8 0 f t 0 0 -1 f i)); +DATA(insert OID = 0 ( 75 tmax 702 0 0 0 4 -9 0 t t 0 0 -1 f i)); +DATA(insert OID = 0 ( 75 tmin 702 0 0 0 4 -10 0 t t 0 0 -1 f i)); +DATA(insert OID = 0 ( 75 vtype 18 0 0 0 1 -11 0 t t 0 0 -1 f c)); + +/* ---------------- + * pg_class + * ---------------- + */ +#define Schema_pg_class \ +{ 83l, {"relname"}, 19l, 83l, 0l, 0l, NAMEDATALEN, 1, 0, '\000', '\001', 0l, 0l, -1l, '\0', 'i' }, \ +{ 83l, {"reltype"}, 26l, 83l, 0l, 0l, 4, 2, 0, '\001', '\001', 0l, 0l, -1l, '\0', 'i' }, \ +{ 83l, {"relowner"}, 26l, 83l, 0l, 0l, 4, 3, 0, '\001', '\001', 0l, 0l, -1l, '\0', 'i' }, \ +{ 83l, {"relam"}, 26l, 83l, 0l, 0l, 4, 4, 0, '\001', '\001', 0l, 0l, -1l, '\0', 'i' }, \ +{ 83l, {"relpages"}, 23, 83l, 0l, 0l, 4, 5, 0, '\001', '\001', 0l, 0l, -1l, '\0', 'i' }, \ +{ 83l, {"reltuples"}, 23, 83l, 0l, 0l, 4, 6, 0, '\001', '\001', 0l, 0l, -1l, '\0', 'i' }, \ +{ 83l, {"relexpires"}, 702, 83l, 0l, 0l, 4, 7, 0, '\001', '\001', 0l, 0l, -1l, '\0', 'i' }, \ +{ 83l, {"relpreserved"}, 703, 83l, 0l, 0l, 4, 8, 0, '\001', '\001', 0l, 0l, -1l, '\0', 'i' }, \ +{ 83l, {"relhasindex"}, 16, 83l, 0l, 0l, 1, 9, 0, '\001', '\001', 0l, 0l, -1l, '\0', 'c' }, \ +{ 83l, {"relisshared"}, 16, 83l, 0l, 0l, 1, 10, 0, '\001', '\001', 0l, 0l, -1l, '\0', 'c' }, \ +{ 83l, {"relkind"}, 18, 83l, 0l, 0l, 1, 11, 0, '\001', '\001', 0l, 0l, -1l, '\0', 'c' }, \ +{ 83l, {"relarch"}, 18, 83l, 0l, 0l, 1, 12, 0, '\001', '\001', 0l, 0l, -1l, '\0', 'c' }, \ +{ 83l, {"relnatts"}, 21, 83l, 0l, 0l, 2, 13, 0, '\001', '\001', 0l, 0l, -1l, '\0', 's' }, \ +{ 83l, {"relsmgr"}, 210l, 83l, 0l, 0l, 2, 14, 0, '\001', '\001', 0l, 0l, -1l, '\0', 's' }, \ +{ 83l, {"relkey"}, 22, 83l, 0l, 0l, 16, 15, 0, '\000', '\001', 0l, 0l, -1l, '\0', 'i' }, \ +{ 83l, {"relkeyop"}, 30, 83l, 0l, 0l, 32, 16, 0, '\000', '\001', 0l, 0l, -1l, '\0', 'i' }, \ +{ 83l, {"relhasrules"}, 16, 83l, 0l, 0l, 1, 17, 0, '\001', '\001', 0l, 0l, -1l, '\0', 'c' }, \ +{ 83l, {"relacl"}, 1034l, 83l, 0l, 0l, -1, 18, 0, '\000', '\001', 0l, 0l, -1l, '\0', 'i' } + +DATA(insert OID = 0 ( 83 relname 19 0 0 0 NAMEDATALEN 1 0 f t 0 0 -1 f i)); +DATA(insert OID = 0 ( 83 reltype 26 0 0 0 4 2 0 t t 0 0 -1 f i)); +DATA(insert OID = 0 ( 83 relowner 26 0 0 0 4 3 0 t t 0 0 -1 f i)); +DATA(insert OID = 0 ( 83 relam 26 0 0 0 4 4 0 t t 0 0 -1 f i)); +DATA(insert OID = 0 ( 83 relpages 23 0 0 0 4 5 0 t t 0 0 -1 f i)); +DATA(insert OID = 0 ( 83 reltuples 23 0 0 0 4 6 0 t t 0 0 -1 f i)); +DATA(insert OID = 0 ( 83 relexpires 702 0 0 0 4 7 0 t t 0 0 -1 f i)); +DATA(insert OID = 0 ( 83 relpreserved 703 0 0 0 4 8 0 t t 0 0 -1 f i)); +DATA(insert OID = 0 ( 83 relhasindex 16 0 0 0 1 9 0 t t 0 0 -1 f c)); +DATA(insert OID = 0 ( 83 relisshared 16 0 0 0 1 10 0 t t 0 0 -1 f c)); +DATA(insert OID = 0 ( 83 relkind 18 0 0 0 1 11 0 t t 0 0 -1 f c)); +DATA(insert OID = 0 ( 83 relarch 18 0 0 0 1 12 0 t t 0 0 -1 f c)); +DATA(insert OID = 0 ( 83 relnatts 21 0 0 0 2 13 0 t t 0 0 -1 f s)); +DATA(insert OID = 0 ( 83 relsmgr 210 0 0 0 2 14 0 t t 0 0 -1 f s)); +DATA(insert OID = 0 ( 83 relkey 22 0 0 0 16 15 0 f t 0 0 -1 f i)); +DATA(insert OID = 0 ( 83 relkeyop 30 0 0 0 32 16 0 f t 0 0 -1 f i)); +DATA(insert OID = 0 ( 83 relhasrules 16 0 0 0 1 17 0 t t 0 0 -1 f c)); +DATA(insert OID = 0 ( 83 relacl 1034 0 0 0 -1 18 0 f t 0 0 -1 f i)); +DATA(insert OID = 0 ( 83 ctid 27 0 0 0 6 -1 0 f t 0 0 -1 f i)); +DATA(insert OID = 0 ( 83 oid 26 0 0 0 4 -2 0 t t 0 0 -1 f i)); +DATA(insert OID = 0 ( 83 xmin 28 0 0 0 4 -3 0 f t 0 0 -1 f i)); +DATA(insert OID = 0 ( 83 cmin 29 0 0 0 2 -4 0 t t 0 0 -1 f s)); +DATA(insert OID = 0 ( 83 xmax 28 0 0 0 4 -5 0 f t 0 0 -1 f i)); +DATA(insert OID = 0 ( 83 cmax 29 0 0 0 2 -6 0 t t 0 0 -1 f s)); +DATA(insert OID = 0 ( 83 chain 27 0 0 0 6 -7 0 f t 0 0 -1 f i)); +DATA(insert OID = 0 ( 83 anchor 27 0 0 0 6 -8 0 f t 0 0 -1 f i)); +DATA(insert OID = 0 ( 83 tmax 702 0 0 0 4 -9 0 t t 0 0 -1 f i)); +DATA(insert OID = 0 ( 83 tmin 702 0 0 0 4 -10 0 t t 0 0 -1 f i)); +DATA(insert OID = 0 ( 83 vtype 18 0 0 0 1 -11 0 t t 0 0 -1 f c)); + +/* ---------------- + * pg_magic + * ---------------- + */ +DATA(insert OID = 0 ( 80 magname 19 0 0 0 NAMEDATALEN 1 0 f t 0 0 -1 f i)); +DATA(insert OID = 0 ( 80 magvalue 19 0 0 0 NAMEDATALEN 2 0 f t 0 0 -1 f i)); +DATA(insert OID = 0 ( 80 ctid 27 0 0 0 6 -1 0 f t 0 0 -1 f i)); +DATA(insert OID = 0 ( 80 oid 26 0 0 0 4 -2 0 t t 0 0 -1 f i)); +DATA(insert OID = 0 ( 80 xmin 28 0 0 0 4 -3 0 f t 0 0 -1 f i)); +DATA(insert OID = 0 ( 80 cmin 29 0 0 0 2 -4 0 t t 0 0 -1 f s)); +DATA(insert OID = 0 ( 80 xmax 28 0 0 0 4 -5 0 f t 0 0 -1 f i)); +DATA(insert OID = 0 ( 80 cmax 29 0 0 0 2 -6 0 t t 0 0 -1 f s)); +DATA(insert OID = 0 ( 80 chain 27 0 0 0 6 -7 0 f t 0 0 -1 f i)); +DATA(insert OID = 0 ( 80 anchor 27 0 0 0 6 -8 0 f t 0 0 -1 f i)); +DATA(insert OID = 0 ( 80 tmax 702 0 0 0 4 -9 0 t t 0 0 -1 f i)); +DATA(insert OID = 0 ( 80 tmin 702 0 0 0 4 -10 0 t t 0 0 -1 f i)); +DATA(insert OID = 0 ( 80 vtype 18 0 0 0 1 -11 0 t t 0 0 -1 f c)); + +/* ---------------- + * pg_defaults + * ---------------- + */ +DATA(insert OID = 0 ( 89 defname 19 0 0 0 NAMEDATALEN 1 0 f t 0 0 -1 f i)); +DATA(insert OID = 0 ( 89 defvalue 19 0 0 0 NAMEDATALEN 2 0 f t 0 0 -1 f i)); +DATA(insert OID = 0 ( 89 ctid 27 0 0 0 6 -1 0 f t 0 0 -1 f i)); +DATA(insert OID = 0 ( 89 oid 26 0 0 0 4 -2 0 t t 0 0 -1 f i)); +DATA(insert OID = 0 ( 89 xmin 28 0 0 0 4 -3 0 f t 0 0 -1 f i)); +DATA(insert OID = 0 ( 89 cmin 29 0 0 0 2 -4 0 t t 0 0 -1 f s)); +DATA(insert OID = 0 ( 89 xmax 28 0 0 0 4 -5 0 f t 0 0 -1 f i)); +DATA(insert OID = 0 ( 89 cmax 29 0 0 0 2 -6 0 t t 0 0 -1 f s)); +DATA(insert OID = 0 ( 89 chain 27 0 0 0 6 -7 0 f t 0 0 -1 f i)); +DATA(insert OID = 0 ( 89 anchor 27 0 0 0 6 -8 0 f t 0 0 -1 f i)); +DATA(insert OID = 0 ( 89 tmax 702 0 0 0 4 -9 0 t t 0 0 -1 f i)); +DATA(insert OID = 0 ( 89 tmin 702 0 0 0 4 -10 0 t t 0 0 -1 f i)); +DATA(insert OID = 0 ( 89 vtype 18 0 0 0 1 -11 0 t t 0 0 -1 f c)); + + +/* ---------------- + * pg_hosts - this relation is used to store host based authentication + * info + * + * ---------------- + */ +DATA(insert OID = 0 ( 101 dbName 19 0 0 0 NAMEDATALEN 1 0 f t 0 0 -1 f i)); +DATA(insert OID = 0 ( 101 address 25 0 0 0 -1 2 0 f t 0 0 -1 f i)); +DATA(insert OID = 0 ( 101 mask 25 0 0 0 -1 3 0 f t 0 0 -1 f i)); + +/* ---------------- + * pg_variable - this relation is modified by special purpose access + * method code. The following is garbage but is needed + * so that the reldesc code works properly. + * ---------------- + */ +#define Schema_pg_variable \ +{ 90l, {"varfoo"}, 26l, 90l, 0l, 0l, 4, 1, 0, '\001', '\001', 0l, 0l, -1l, '\0', 'i' } + +DATA(insert OID = 0 ( 90 varfoo 26 0 0 0 4 1 0 t t 0 0 -1 f i)); + +/* ---------------- + * pg_log - this relation is modified by special purpose access + * method code. The following is garbage but is needed + * so that the reldesc code works properly. + * ---------------- + */ +#define Schema_pg_log \ +{ 99l, {"logfoo"}, 26l, 99l, 0l, 0l, 4, 1, 0, '\001', '\001', 0l, 0l, -1l, '\0', 'i' } + +DATA(insert OID = 0 ( 99 logfoo 26 0 0 0 4 1 0 t t 0 0 -1 f i)); + +/* ---------------- + * pg_time - this relation is modified by special purpose access + * method code. The following is garbage but is needed + * so that the reldesc code works properly. + * ---------------- + */ +#define Schema_pg_time \ +{ 100l, {"timefoo"}, 26l, 100l, 0l, 0l, 4, 1, 0, '\001', '\001', 0l, 0l, -1l, '\0', 'i' } + +DATA(insert OID = 0 ( 100 timefoo 26 0 0 0 4 1 0 t t 0 0 -1 f i)); + +#endif /* PG_ATTRIBUTE_H */ diff --git a/src/include/catalog/pg_class.h b/src/include/catalog/pg_class.h new file mode 100644 index 0000000000..eb4ba992d6 --- /dev/null +++ b/src/include/catalog/pg_class.h @@ -0,0 +1,166 @@ +/*------------------------------------------------------------------------- + * + * pg_class.h-- + * definition of the system "relation" relation (pg_class) + * along with the relation's initial contents. + * + * + * Copyright (c) 1994, Regents of the University of California + * + * $Id: pg_class.h,v 1.1 1996/08/28 01:56:39 scrappy Exp $ + * + * NOTES + * ``pg_relation'' is being replaced by ``pg_class''. currently + * we are only changing the name in the catalogs but someday the + * code will be changed too. -cim 2/26/90 + * [it finally happens. -ay 11/5/94] + * + * the genbki.sh script reads this file and generates .bki + * information from the DATA() statements. + * + *------------------------------------------------------------------------- + */ +#ifndef PG_RELATION_H +#define PG_RELATION_H + +/* ---------------- + * postgres.h contains the system type definintions and the + * CATALOG(), BOOTSTRAP and DATA() sugar words so this file + * can be read by both genbki.sh and the C compiler. + * ---------------- + */ +#include "postgres.h" +#include "utils/nabstime.h" + +/* ---------------- + * pg_class definition. cpp turns this into + * typedef struct FormData_pg_class + * + * Note: the #if 0, #endif around the BKI_BEGIN.. END block + * below keeps cpp from seeing what is meant for the + * genbki script: pg_relation is now called pg_class, but + * only in the catalogs -cim 2/26/90 + * ---------------- + */ + +/* ---------------- + * This structure is actually variable-length (the last attribute is + * a POSTGRES array). Hence, sizeof(FormData_pg_class) does not + * describe the fixed-length or actual size of the structure. + * FormData_pg_class.relacl may not be correctly aligned, either, + * if aclitem and struct varlena don't align together. Hence, + * you MUST use heap_getattr() to get the relacl field. + * ---------------- + */ +CATALOG(pg_class) BOOTSTRAP { + NameData relname; + Oid reltype; + Oid relowner; + Oid relam; + int4 relpages; + int4 reltuples; + int4 relexpires; /* really used as a abstime, but fudge it for now*/ + int4 relpreserved;/*really used as a reltime, but fudge it for now*/ + bool relhasindex; + bool relisshared; + char relkind; + char relarch; /* 'h' = heavy, 'l' = light, 'n' = no archival*/ + int2 relnatts; + /* relnatts is the number of user attributes this class has. There + must be exactly this many instances in Class pg_attribute for this + class which have attnum > 0 (= user attribute). + */ + int2 relsmgr; + int28 relkey; /* not used */ + oid8 relkeyop; /* not used */ + bool relhasrules; + aclitem relacl[1]; /* this is here for the catalog */ +} FormData_pg_class; + +#define CLASS_TUPLE_SIZE \ + (offsetof(FormData_pg_class,relhasrules) + sizeof(bool)) + +/* ---------------- + * Form_pg_class corresponds to a pointer to a tuple with + * the format of pg_class relation. + * ---------------- + */ +typedef FormData_pg_class *Form_pg_class; + +/* ---------------- + * compiler constants for pg_class + * ---------------- + */ + +/* ---------------- + * Natts_pg_class_fixed is used to tell routines that insert new + * pg_class tuples (as opposed to replacing old ones) that there's no + * relacl field. + * ---------------- + */ +#define Natts_pg_class_fixed 17 +#define Natts_pg_class 18 +#define Anum_pg_class_relname 1 +#define Anum_pg_class_reltype 2 +#define Anum_pg_class_relowner 3 +#define Anum_pg_class_relam 4 +#define Anum_pg_class_relpages 5 +#define Anum_pg_class_reltuples 6 +#define Anum_pg_class_relexpires 7 +#define Anum_pg_class_relpreserved 8 +#define Anum_pg_class_relhasindex 9 +#define Anum_pg_class_relisshared 10 +#define Anum_pg_class_relkind 11 +#define Anum_pg_class_relarch 12 +#define Anum_pg_class_relnatts 13 +#define Anum_pg_class_relsmgr 14 +#define Anum_pg_class_relkey 15 +#define Anum_pg_class_relkeyop 16 +#define Anum_pg_class_relhasrules 17 +#define Anum_pg_class_relacl 18 + +/* ---------------- + * initial contents of pg_class + * ---------------- + */ + +DATA(insert OID = 71 ( pg_type 71 PGUID 0 0 0 0 0 f f r n 16 0 - - f _null_ )); +DATA(insert OID = 75 ( pg_attribute 75 PGUID 0 0 0 0 0 f f r n 16 0 - - f _null_ )); +DATA(insert OID = 76 ( pg_demon 76 PGUID 0 0 0 0 0 f t r n 4 0 - - f _null_ )); +DATA(insert OID = 80 ( pg_magic 80 PGUID 0 0 0 0 0 f t r n 2 0 - - f _null_ )); +DATA(insert OID = 81 ( pg_proc 81 PGUID 0 0 0 0 0 f f r n 16 0 - - f _null_ )); +DATA(insert OID = 82 ( pg_server 82 PGUID 0 0 0 0 0 f t r n 3 0 - - f _null_ )); +DATA(insert OID = 83 ( pg_class 83 PGUID 0 0 0 0 0 f f r n 18 0 - - f _null_ )); +DATA(insert OID = 86 ( pg_user 86 PGUID 0 0 0 0 0 f t r n 6 0 - - f _null_ )); +DATA(insert OID = 87 ( pg_group 87 PGUID 0 0 0 0 0 f t s n 3 0 - - f _null_ )); +DATA(insert OID = 88 ( pg_database 88 PGUID 0 0 0 0 0 f t r n 3 0 - - f _null_ )); +DATA(insert OID = 89 ( pg_defaults 89 PGUID 0 0 0 0 0 f t r n 2 0 - - f _null_ )); +DATA(insert OID = 90 ( pg_variable 90 PGUID 0 0 0 0 0 f t s n 2 0 - - f _null_ )); +DATA(insert OID = 99 ( pg_log 99 PGUID 0 0 0 0 0 f t s n 1 0 - - f _null_ )); +DATA(insert OID = 100 ( pg_time 100 PGUID 0 0 0 0 0 f t s n 1 0 - - f _null_ )); +DATA(insert OID = 101 ( pg_hosts 101 PGUID 0 0 0 0 0 f t s n 3 0 - - f _null_ )); + +#define RelOid_pg_type 71 +#define RelOid_pg_demon 76 +#define RelOid_pg_attribute 75 +#define RelOid_pg_magic 80 +#define RelOid_pg_proc 81 +#define RelOid_pg_server 82 +#define RelOid_pg_class 83 +#define RelOid_pg_user 86 +#define RelOid_pg_group 87 +#define RelOid_pg_database 88 +#define RelOid_pg_defaults 89 +#define RelOid_pg_variable 90 +#define RelOid_pg_log 99 +#define RelOid_pg_time 100 +#define RelOid_pg_hosts 101 + +#define MAX_SYSTEM_RELOID 101 + +#define RELKIND_INDEX 'i' /* secondary index */ +#define RELKIND_RELATION 'r' /* cataloged heap */ +#define RELKIND_SPECIAL 's' /* special (non-heap) */ +#define RELKIND_UNCATALOGED 'u' /* temporary heap */ + +#endif /* PG_RELATION_H */ diff --git a/src/include/catalog/pg_database.h b/src/include/catalog/pg_database.h new file mode 100644 index 0000000000..92f84b8edc --- /dev/null +++ b/src/include/catalog/pg_database.h @@ -0,0 +1,57 @@ +/*------------------------------------------------------------------------- + * + * pg_database.h-- + * definition of the system "database" relation (pg_database) + * along with the relation's initial contents. + * + * + * Copyright (c) 1994, Regents of the University of California + * + * $Id: pg_database.h,v 1.1 1996/08/28 01:56:41 scrappy Exp $ + * + * NOTES + * the genbki.sh script reads this file and generates .bki + * information from the DATA() statements. + * + *------------------------------------------------------------------------- + */ +#ifndef PG_DATABASE_H +#define PG_DATABASE_H + +/* ---------------- + * postgres.h contains the system type definintions and the + * CATALOG(), BOOTSTRAP and DATA() sugar words so this file + * can be read by both genbki.sh and the C compiler. + * ---------------- + */ +#include "postgres.h" + +/* ---------------- + * pg_database definition. cpp turns this into + * typedef struct FormData_pg_database + * ---------------- + */ +CATALOG(pg_database) BOOTSTRAP { + NameData datname; + Oid datdba; + text datpath; /* VARIABLE LENGTH FIELD */ +} FormData_pg_database; + +/* ---------------- + * Form_pg_database corresponds to a pointer to a tuple with + * the format of pg_database relation. + * ---------------- + */ +typedef FormData_pg_database *Form_pg_database; + +/* ---------------- + * compiler constants for pg_database + * ---------------- + */ +#define Natts_pg_database 3 +#define Anum_pg_database_datname 1 +#define Anum_pg_database_datdba 2 +#define Anum_pg_database_datpath 3 + + +#endif /* PG_DATABASE_H */ diff --git a/src/include/catalog/pg_defaults.h b/src/include/catalog/pg_defaults.h new file mode 100644 index 0000000000..1a85c730e8 --- /dev/null +++ b/src/include/catalog/pg_defaults.h @@ -0,0 +1,55 @@ +/*------------------------------------------------------------------------- + * + * pg_defaults.h-- + * definition of the system "defaults" relation (pg_defaults) + * along with the relation's initial contents. + * + * + * Copyright (c) 1994, Regents of the University of California + * + * $Id: pg_defaults.h,v 1.1 1996/08/28 01:56:42 scrappy Exp $ + * + * NOTES + * the genbki.sh script reads this file and generates .bki + * information from the DATA() statements. + * + *------------------------------------------------------------------------- + */ +#ifndef PG_DEFAULTS_H +#define PG_DEFAULTS_H + +/* ---------------- + * postgres.h contains the system type definintions and the + * CATALOG(), BOOTSTRAP and DATA() sugar words so this file + * can be read by both genbki.sh and the C compiler. + * ---------------- + */ +#include "postgres.h" + +/* ---------------- + * pg_defaults definition. cpp turns this into + * typedef struct FormData_pg_defaults + * ---------------- + */ +CATALOG(pg_defaults) BOOTSTRAP { + NameData defname; + NameData defvalue; +} FormData_pg_defaults; + +/* ---------------- + * Form_pg_defaults corresponds to a pointer to a tuple with + * the format of pg_defaults relation. + * ---------------- + */ +typedef FormData_pg_defaults *Form_pg_defaults; + +/* ---------------- + * compiler constants for pg_defaults + * ---------------- + */ +#define Natts_pg_defaults 2 +#define Anum_pg_defaults_defname 1 +#define Anum_pg_defaults_defvalue 2 + + +#endif /* PG_DEFAULTS_H */ diff --git a/src/include/catalog/pg_demon.h b/src/include/catalog/pg_demon.h new file mode 100644 index 0000000000..62dace1ca7 --- /dev/null +++ b/src/include/catalog/pg_demon.h @@ -0,0 +1,58 @@ +/*------------------------------------------------------------------------- + * + * pg_demon.h-- + * definition of the system "demon" relation (pg_demon) + * along with the relation's initial contents. + * + * + * Copyright (c) 1994, Regents of the University of California + * + * $Id: pg_demon.h,v 1.1 1996/08/28 01:56:44 scrappy Exp $ + * + * NOTES + * the genbki.sh script reads this file and generates .bki + * information from the DATA() statements. + * + *------------------------------------------------------------------------- + */ +#ifndef PG_DEMON_H +#define PG_DEMON_H + +/* ---------------- + * postgres.h contains the system type definintions and the + * CATALOG(), BOOTSTRAP and DATA() sugar words so this file + * can be read by both genbki.sh and the C compiler. + * ---------------- + */ +#include "postgres.h" + +/* ---------------- + * pg_demon definition. cpp turns this into + * typedef struct FormData_pg_demon + * ---------------- + */ +CATALOG(pg_demon) BOOTSTRAP { + Oid demserid; + NameData demname; + Oid demowner; + regproc demcode; +} FormData_pg_demon; + +/* ---------------- + * Form_pg_demon corresponds to a pointer to a tuple with + * the format of pg_demon relation. + * ---------------- + */ +typedef FormData_pg_demon *Form_pg_demon; + +/* ---------------- + * compiler constants for pg_demon + * ---------------- + */ +#define Natts_pg_demon 4 +#define Anum_pg_demon_demserid 1 +#define Anum_pg_demon_demname 2 +#define Anum_pg_demon_demowner 3 +#define Anum_pg_demon_demcode 4 + +#endif /* PG_DEMON_H */ diff --git a/src/include/catalog/pg_group.h b/src/include/catalog/pg_group.h new file mode 100644 index 0000000000..b392cd25c1 --- /dev/null +++ b/src/include/catalog/pg_group.h @@ -0,0 +1,42 @@ +/*------------------------------------------------------------------------- + * + * pg_group.h-- + * + * + * + * Copyright (c) 1994, Regents of the University of California + * + * $Id: pg_group.h,v 1.1 1996/08/28 01:56:45 scrappy Exp $ + * + * NOTES + * the genbki.sh script reads this file and generates .bki + * information from the DATA() statements. + * + *------------------------------------------------------------------------- + */ +#ifndef PG_GROUP_H +#define PG_GROUP_H + +/* ---------------- + * postgres.h contains the system type definintions and the + * CATALOG(), BOOTSTRAP and DATA() sugar words so this file + * can be read by both genbki.sh and the C compiler. + * ---------------- + */ +#include "postgres.h" + +CATALOG(pg_group) BOOTSTRAP { + NameData groname; + int4 grosysid; + int4 grolist[1]; +} FormData_pg_group; +/* VARIABLE LENGTH STRUCTURE */ + +typedef FormData_pg_group *Form_pg_group; + +#define Natts_pg_group 1 +#define Anum_pg_group_groname 1 +#define Anum_pg_group_grosysid 2 +#define Anum_pg_group_grolist 3 + +#endif /* PG_GROUP_H */ diff --git a/src/include/catalog/pg_hosts.h b/src/include/catalog/pg_hosts.h new file mode 100644 index 0000000000..ddd8f42175 --- /dev/null +++ b/src/include/catalog/pg_hosts.h @@ -0,0 +1,44 @@ +/*------------------------------------------------------------------------- + * + * pg_hosts.h-- + * + * the pg_hosts system catalog provides host-based access to the + * backend. Only those hosts that are in the pg_hosts + * + * currently, this table is not used, instead file-based host authentication + * is used + * + * Copyright (c) 1994, Regents of the University of California + * + * $Id: pg_hosts.h,v 1.1 1996/08/28 01:56:47 scrappy Exp $ + * + * NOTES + * the genbki.sh script reads this file and generates .bki + * information from the DATA() statements. + *------------------------------------------------------------------------- + */ + +#ifndef PG_HOSTS_H +#define PG_HOSTS_H + +/* ---------------- + * postgres.h contains the system type definintions and the + * CATALOG(), BOOTSTRAP and DATA() sugar words so this file + * can be read by both genbki.sh and the C compiler. + * ---------------- + */ +#include "postgres.h" + +CATALOG(pg_hosts) BOOTSTRAP { + NameData dbName; + text address; + text mask; +} FormData_pg_hosts; + +typedef FormData_pg_hosts *Form_pg_hosts; +#define Natts_pg_hosts 3 +#define Anum_pg_hosts_dbName 1 +#define Anum_pg_hosts_address 2 +#define Anum_pg_hosts_mask 3 + +#endif /* PG_HOSTS_H */ diff --git a/src/include/catalog/pg_index.h b/src/include/catalog/pg_index.h new file mode 100644 index 0000000000..7141dabd75 --- /dev/null +++ b/src/include/catalog/pg_index.h @@ -0,0 +1,75 @@ +/*------------------------------------------------------------------------- + * + * pg_index.h-- + * definition of the system "index" relation (pg_index) + * along with the relation's initial contents. + * + * + * Copyright (c) 1994, Regents of the University of California + * + * $Id: pg_index.h,v 1.1 1996/08/28 01:56:49 scrappy Exp $ + * + * NOTES + * the genbki.sh script reads this file and generates .bki + * information from the DATA() statements. + * + *------------------------------------------------------------------------- + */ +#ifndef PG_INDEX_H +#define PG_INDEX_H + +/* ---------------- + * postgres.h contains the system type definintions and the + * CATALOG(), BOOTSTRAP and DATA() sugar words so this file + * can be read by both genbki.sh and the C compiler. + * ---------------- + */ +#include "postgres.h" + +/* ---------------- + * pg_index definition. cpp turns this into + * typedef struct FormData_pg_index. The oid of the index relation + * is stored in indexrelid; the oid of the indexed relation is stored + * in indrelid. + * ---------------- + */ +CATALOG(pg_index) { + Oid indexrelid; + Oid indrelid; + Oid indproc; /* registered procedure for functional index */ + int28 indkey; + oid8 indclass; + bool indisclustered; + bool indisarchived; + text indpred; /* query plan for partial index predicate */ + bool indislossy; /* do we fetch false tuples (lossy compression)? */ + bool indhaskeytype; /* does key type != attribute type? */ +} FormData_pg_index; + +#define INDEX_MAX_KEYS 8 /* maximum number of keys in an index definition */ + +/* ---------------- + * Form_pg_index corresponds to a pointer to a tuple with + * the format of pg_index relation. + * ---------------- + */ +typedef FormData_pg_index *IndexTupleForm; + +/* ---------------- + * compiler constants for pg_index + * ---------------- + */ +#define Natts_pg_index 10 +#define Anum_pg_index_indexrelid 1 +#define Anum_pg_index_indrelid 2 +#define Anum_pg_index_indproc 3 +#define Anum_pg_index_indkey 4 +#define Anum_pg_index_indclass 5 +#define Anum_pg_index_indisclustered 6 +#define Anum_pg_index_indisarchived 7 +#define Anum_pg_index_indpred 8 +#define Anum_pg_index_indislossy 9 +#define Anum_pg_index_indhaskeytype 10 + + +#endif /* PG_INDEX_H */ diff --git a/src/include/catalog/pg_inheritproc.h b/src/include/catalog/pg_inheritproc.h new file mode 100644 index 0000000000..39b89d113e --- /dev/null +++ b/src/include/catalog/pg_inheritproc.h @@ -0,0 +1,59 @@ +/*------------------------------------------------------------------------- + * + * pg_inheritproc.h-- + * definition of the system "inheritproc" relation (pg_inheritproc) + * along with the relation's initial contents. + * + * + * Copyright (c) 1994, Regents of the University of California + * + * $Id: pg_inheritproc.h,v 1.1 1996/08/28 01:56:51 scrappy Exp $ + * + * NOTES + * the genbki.sh script reads this file and generates .bki + * information from the DATA() statements. + * + *------------------------------------------------------------------------- + */ +#ifndef PG_INHERITPROC_H +#define PG_INHERITPROC_H + +/* ---------------- + * postgres.h contains the system type definintions and the + * CATALOG(), BOOTSTRAP and DATA() sugar words so this file + * can be read by both genbki.sh and the C compiler. + * ---------------- + */ +#include "postgres.h" + +/* ---------------- + * pg_inheritproc definition. cpp turns this into + * typedef struct FormData_pg_inheritproc + * ---------------- + */ +CATALOG(pg_inheritproc) { + NameData inhproname; + Oid inhargrel; + Oid inhdefrel; + Oid inhproc; +} FormData_pg_inheritproc; + +/* ---------------- + * Form_pg_inheritproc corresponds to a pointer to a tuple with + * the format of pg_inheritproc relation. + * ---------------- + */ +typedef FormData_pg_inheritproc *Form_pg_inheritproc; + +/* ---------------- + * compiler constants for pg_inheritproc + * ---------------- + */ +#define Natts_pg_inheritproc 4 +#define Anum_pg_inheritproc_inhproname 1 +#define Anum_pg_inheritproc_inhargrel 2 +#define Anum_pg_inheritproc_inhdefrel 3 +#define Anum_pg_inheritproc_inhproc 4 + + +#endif /* PG_INHERITPROC_H */ diff --git a/src/include/catalog/pg_inherits.h b/src/include/catalog/pg_inherits.h new file mode 100644 index 0000000000..b303801920 --- /dev/null +++ b/src/include/catalog/pg_inherits.h @@ -0,0 +1,57 @@ +/*------------------------------------------------------------------------- + * + * pg_inherits.h-- + * definition of the system "inherits" relation (pg_inherits) + * along with the relation's initial contents. + * + * + * Copyright (c) 1994, Regents of the University of California + * + * $Id: pg_inherits.h,v 1.1 1996/08/28 01:56:52 scrappy Exp $ + * + * NOTES + * the genbki.sh script reads this file and generates .bki + * information from the DATA() statements. + * + *------------------------------------------------------------------------- + */ +#ifndef PG_INHERITS_H +#define PG_INHERITS_H + +/* ---------------- + * postgres.h contains the system type definintions and the + * CATALOG(), BOOTSTRAP and DATA() sugar words so this file + * can be read by both genbki.sh and the C compiler. + * ---------------- + */ +#include "postgres.h" + +/* ---------------- + * pg_inherits definition. cpp turns this into + * typedef struct FormData_pg_inherits + * ---------------- + */ +CATALOG(pg_inherits) { + Oid inhrel; + Oid inhparent; + int4 inhseqno; +} FormData_pg_inherits; + +/* ---------------- + * Form_pg_inherits corresponds to a pointer to a tuple with + * the format of pg_inherits relation. + * ---------------- + */ +typedef FormData_pg_inherits *InheritsTupleForm; + +/* ---------------- + * compiler constants for pg_inherits + * ---------------- + */ +#define Natts_pg_inherits 3 +#define Anum_pg_inherits_inhrel 1 +#define Anum_pg_inherits_inhparent 2 +#define Anum_pg_inherits_inhseqno 3 + + +#endif /* PG_INHERITS_H */ diff --git a/src/include/catalog/pg_ipl.h b/src/include/catalog/pg_ipl.h new file mode 100644 index 0000000000..a9c9878723 --- /dev/null +++ b/src/include/catalog/pg_ipl.h @@ -0,0 +1,57 @@ +/*------------------------------------------------------------------------- + * + * pg_ipl.h-- + * definition of the system "ipl" relation (pg_ipl) + * along with the relation's initial contents. + * + * + * Copyright (c) 1994, Regents of the University of California + * + * $Id: pg_ipl.h,v 1.1 1996/08/28 01:56:54 scrappy Exp $ + * + * NOTES + * the genbki.sh script reads this file and generates .bki + * information from the DATA() statements. + * + *------------------------------------------------------------------------- + */ +#ifndef PG_IPL_H +#define PG_IPL_H + +/* ---------------- + * postgres.h contains the system type definintions and the + * CATALOG(), BOOTSTRAP and DATA() sugar words so this file + * can be read by both genbki.sh and the C compiler. + * ---------------- + */ +#include "postgres.h" + +/* ---------------- + * pg_ipl definition. cpp turns this into + * typedef struct FormData_pg_ipl + * ---------------- + */ +CATALOG(pg_ipl) { + Oid iplrel; + Oid iplipl; + int4 iplseqno; +} FormData_pg_ipl; + +/* ---------------- + * Form_pg_ipl corresponds to a pointer to a tuple with + * the format of pg_ipl relation. + * ---------------- + */ +typedef FormData_pg_ipl *Form_pg_ipl; + +/* ---------------- + * compiler constants for pg_ipl + * ---------------- + */ +#define Natts_pg_ipl 3 +#define Anum_pg_ipl_iplrel 1 +#define Anum_pg_ipl_iplipl 2 +#define Anum_pg_ipl_iplseqno 3 + + +#endif /* PG_IPL_H */ diff --git a/src/include/catalog/pg_language.h b/src/include/catalog/pg_language.h new file mode 100644 index 0000000000..7e5b15d3b2 --- /dev/null +++ b/src/include/catalog/pg_language.h @@ -0,0 +1,75 @@ +/*------------------------------------------------------------------------- + * + * pg_language.h-- + * definition of the system "language" relation (pg_language) + * along with the relation's initial contents. + * + * + * Copyright (c) 1994, Regents of the University of California + * + * $Id: pg_language.h,v 1.1 1996/08/28 01:56:57 scrappy Exp $ + * + * NOTES + * the genbki.sh script reads this file and generates .bki + * information from the DATA() statements. + * + *------------------------------------------------------------------------- + */ +#ifndef PG_LANGUAGE_H +#define PG_LANGUAGE_H + +/* ---------------- + * postgres.h contains the system type definintions and the + * CATALOG(), BOOTSTRAP and DATA() sugar words so this file + * can be read by both genbki.sh and the C compiler. + * ---------------- + */ +#include "postgres.h" + +/* ---------------- + * pg_language definition. cpp turns this into + * typedef struct FormData_pg_language + * ---------------- + */ +CATALOG(pg_language) { + NameData lanname; + text lancompiler; /* VARIABLE LENGTH FIELD */ +} FormData_pg_language; + +/* ---------------- + * Form_pg_language corresponds to a pointer to a tuple with + * the format of pg_language relation. + * ---------------- + */ +typedef FormData_pg_language *Form_pg_language; + +/* ---------------- + * compiler constants for pg_language + * ---------------- + */ +#define Natts_pg_language 2 +#define Anum_pg_language_lanname 1 +#define Anum_pg_language_lancompiler 2 + +/* ---------------- + * initial contents of pg_language + * ---------------- + */ + +DATA(insert OID = 11 ( internal "n/a" )); +#define INTERNALlanguageId 11 +DATA(insert OID = 12 ( lisp "/usr/ucb/liszt" )); +DATA(insert OID = 13 ( "C" "/bin/cc" )); +#define ClanguageId 13 +DATA(insert OID = 14 ( "sql" "postgres")); +#define SQLlanguageId 14 + + +#endif /* PG_LANGUAGE_H */ + + + + + + + diff --git a/src/include/catalog/pg_listener.h b/src/include/catalog/pg_listener.h new file mode 100644 index 0000000000..77e5885bd0 --- /dev/null +++ b/src/include/catalog/pg_listener.h @@ -0,0 +1,56 @@ +/*------------------------------------------------------------------------- + * + * pg_listener.h-- + * Asynchronous notification + * + * + * Copyright (c) 1994, Regents of the University of California + * + * $Id: pg_listener.h,v 1.1 1996/08/28 01:56:58 scrappy Exp $ + * + * NOTES + * the genbki.sh script reads this file and generates .bki + * information from the DATA() statements. + * + *------------------------------------------------------------------------- + */ +#ifndef PG_LISTENER_H +#define PG_LISTENER_H + +/* ---------------- + * postgres.h contains the system type definintions and the + * CATALOG(), BOOTSTRAP and DATA() sugar words so this file + * can be read by both genbki.sh and the C compiler. + * ---------------- + */ +#include "postgres.h" + +/* ---------------------------------------------------------------- + * pg_listener definition. + * + * cpp turns this into typedef struct FormData_pg_listener + * ---------------------------------------------------------------- + */ + +CATALOG(pg_listener) { + NameData relname; + int4 listenerpid; + int4 notification; +} FormData_pg_listener; + +/* ---------------- + * compiler constants for pg_listener + * ---------------- + */ +#define Natts_pg_listener 3 +#define Anum_pg_listener_relname 1 +#define Anum_pg_listener_pid 2 +#define Anum_pg_listener_notify 3 + +/* ---------------- + * initial contents of pg_listener are NOTHING. + * ---------------- + */ + + +#endif /* PG_LISTENER_H */ diff --git a/src/include/catalog/pg_log.h b/src/include/catalog/pg_log.h new file mode 100644 index 0000000000..9d9659987b --- /dev/null +++ b/src/include/catalog/pg_log.h @@ -0,0 +1,40 @@ +/*------------------------------------------------------------------------- + * + * pg_log.h-- + * the system log relation "pg_log" is not a "heap" relation. + * it is automatically created by the transam/ code and the + * information here is all bogus and is just here to make the + * relcache code happy. + * + * + * Copyright (c) 1994, Regents of the University of California + * + * $Id: pg_log.h,v 1.1 1996/08/28 01:57:00 scrappy Exp $ + * + * NOTES + * The structures and macros used by the transam/ code + * to access pg_log should some day go here -cim 6/18/90 + * + *------------------------------------------------------------------------- + */ +#ifndef PG_LOG_H +#define PG_LOG_H + +/* ---------------- + * postgres.h contains the system type definintions and the + * CATALOG(), BOOTSTRAP and DATA() sugar words so this file + * can be read by both genbki.sh and the C compiler. + * ---------------- + */ +#include "postgres.h" + +CATALOG(pg_log) BOOTSTRAP { + Oid logfoo; +} FormData_pg_log; + +typedef FormData_pg_log *Form_pg_log; + +#define Natts_pg_log 1 +#define Anum_pg_log_logfoo 1 + +#endif /* PG_LOG_H */ diff --git a/src/include/catalog/pg_magic.h b/src/include/catalog/pg_magic.h new file mode 100644 index 0000000000..7cb8948945 --- /dev/null +++ b/src/include/catalog/pg_magic.h @@ -0,0 +1,54 @@ +/*------------------------------------------------------------------------- + * + * pg_magic.h-- + * definition of the system "magic" relation (pg_magic) + * along with the relation's initial contents. + * + * + * Copyright (c) 1994, Regents of the University of California + * + * $Id: pg_magic.h,v 1.1 1996/08/28 01:57:02 scrappy Exp $ + * + * NOTES + * the genbki.sh script reads this file and generates .bki + * information from the DATA() statements. + * + *------------------------------------------------------------------------- + */ +#ifndef PG_MAGIC_H +#define PG_MAGIC_H + +/* ---------------- + * postgres.h contains the system type definintions and the + * CATALOG(), BOOTSTRAP and DATA() sugar words so this file + * can be read by both genbki.sh and the C compiler. + * ---------------- + */ +#include "postgres.h" + +/* ---------------- + * pg_magic definition. cpp turns this into + * typedef struct FormData_pg_magic + * ---------------- + */ +CATALOG(pg_magic) BOOTSTRAP { + NameData magname; + NameData magvalue; +} FormData_pg_magic; + +/* ---------------- + * Form_pg_magic corresponds to a pointer to a tuple with + * the format of pg_magic relation. + * ---------------- + */ +typedef FormData_pg_magic *Form_pg_magic; + +/* ---------------- + * compiler constants for pg_magic + * ---------------- + */ +#define Natts_pg_magic 2 +#define Anum_pg_magic_magname 1 +#define Anum_pg_magic_magvalue 2 + +#endif /* PG_MAGIC_H */ diff --git a/src/include/catalog/pg_opclass.h b/src/include/catalog/pg_opclass.h new file mode 100644 index 0000000000..5a88163b10 --- /dev/null +++ b/src/include/catalog/pg_opclass.h @@ -0,0 +1,93 @@ +/*------------------------------------------------------------------------- + * + * pg_opclass.h-- + * definition of the system "opclass" relation (pg_opclass) + * along with the relation's initial contents. + * + * + * Copyright (c) 1994, Regents of the University of California + * + * $Id: pg_opclass.h,v 1.1 1996/08/28 01:57:03 scrappy Exp $ + * + * NOTES + * the genbki.sh script reads this file and generates .bki + * information from the DATA() statements. + * + *------------------------------------------------------------------------- + */ +#ifndef PG_OPCLASS_H +#define PG_OPCLASS_H + +/* ---------------- + * postgres.h contains the system type definintions and the + * CATALOG(), BOOTSTRAP and DATA() sugar words so this file + * can be read by both genbki.sh and the C compiler. + * ---------------- + */ +#include "postgres.h" + +/* ---------------- + * pg_opclass definition. cpp turns this into + * typedef struct FormData_pg_opclass + * ---------------- + */ + +CATALOG(pg_opclass) { + NameData opcname; + Oid opcdeftype; +} FormData_pg_opclass; + +/* ---------------- + * Form_pg_opclass corresponds to a pointer to a tuple with + * the format of pg_opclass relation. + * ---------------- + */ +typedef FormData_pg_opclass *Form_pg_opclass; + +/* ---------------- + * compiler constants for pg_opclass + * ---------------- + */ +#define Natts_pg_opclass 2 +#define Anum_pg_opclass_opcname 1 +#define Anum_pg_opclass_opcdeftype 2 + +/* ---------------- + * initial contents of pg_opclass + * ---------------- + */ + +/* + * putting _null_'s in the (fixed-length) type field is bad + * (see the README in this directory), so just put zeros + * in, which are invalid OID's anyway. --djm + */ +DATA(insert OID = 406 ( char2_ops 409 )); +DATA(insert OID = 407 ( char4_ops 410 )); +DATA(insert OID = 408 ( char8_ops 411 )); +/* OID 409 is already used in table pg_type--this one should be unused */ +DATA(insert OID = 1181 ( name_ops 19 )); +DATA(insert OID = 421 ( int2_ops 21 )); +DATA(insert OID = 422 ( box_ops 603 )); +DATA(insert OID = 423 ( float8_ops 701 )); +DATA(insert OID = 424 ( int24_ops 0 )); +DATA(insert OID = 425 ( int42_ops 0 )); +DATA(insert OID = 426 ( int4_ops 23 )); +#define INT4_OPS_OID 426 +DATA(insert OID = 427 ( oid_ops 26 )); +DATA(insert OID = 428 ( float4_ops 700 )); +DATA(insert OID = 429 ( char_ops 18 )); +DATA(insert OID = 430 ( char16_ops 20 )); +DATA(insert OID = 431 ( text_ops 25 )); +DATA(insert OID = 432 ( abstime_ops 702 )); +DATA(insert OID = 433 ( bigbox_ops 0 )); +DATA(insert OID = 434 ( poly_ops 604 )); +DATA(insert OID = 435 ( oidint4_ops 910 )); +DATA(insert OID = 436 ( oidname_ops 911 )); +DATA(insert OID = 437 ( oidint2_ops 810 )); +DATA(insert OID = 1076 ( bpchar_ops 1042 )); +DATA(insert OID = 1077 ( varchar_ops 1043 )); +DATA(insert OID = 1114 ( date_ops 1082 )); +DATA(insert OID = 1115 ( time_ops 1083 )); + +#endif /* PG_OPCLASS_H */ diff --git a/src/include/catalog/pg_operator.h b/src/include/catalog/pg_operator.h new file mode 100644 index 0000000000..de9f68b2bf --- /dev/null +++ b/src/include/catalog/pg_operator.h @@ -0,0 +1,484 @@ +/*------------------------------------------------------------------------- + * + * pg_operator.h-- + * definition of the system "operator" relation (pg_operator) + * along with the relation's initial contents. + * + * + * Copyright (c) 1994, Regents of the University of California + * + * $Id: pg_operator.h,v 1.1 1996/08/28 01:57:05 scrappy Exp $ + * + * NOTES + * the genbki.sh script reads this file and generates .bki + * information from the DATA() statements. + * + * XXX do NOT break up DATA() statements into multiple lines! + * the scripts are not as smart as you might think... + * + *------------------------------------------------------------------------- + */ +#ifndef PG_OPERATOR_H +#define PG_OPERATOR_H + +/* ---------------- + * postgres.h contains the system type definintions and the + * CATALOG(), BOOTSTRAP and DATA() sugar words so this file + * can be read by both genbki.sh and the C compiler. + * ---------------- + */ +#include "postgres.h" + +/* ---------------- + * pg_operator definition. cpp turns this into + * typedef struct FormData_pg_operator + * ---------------- + */ +CATALOG(pg_operator) { + NameData oprname; + Oid oprowner; + int2 oprprec; + char oprkind; + bool oprisleft; + bool oprcanhash; + Oid oprleft; + Oid oprright; + Oid oprresult; + Oid oprcom; + Oid oprnegate; + Oid oprlsortop; + Oid oprrsortop; + regproc oprcode; + regproc oprrest; + regproc oprjoin; +} FormData_pg_operator; + +/* ---------------- + * Form_pg_operator corresponds to a pointer to a tuple with + * the format of pg_operator relation. + * ---------------- + */ +typedef FormData_pg_operator *OperatorTupleForm; + +/* ---------------- + * compiler constants for pg_operator + * ---------------- + */ + +#define Natts_pg_operator 16 +#define Anum_pg_operator_oprname 1 +#define Anum_pg_operator_oprowner 2 +#define Anum_pg_operator_oprprec 3 +#define Anum_pg_operator_oprkind 4 +#define Anum_pg_operator_oprisleft 5 +#define Anum_pg_operator_oprcanhash 6 +#define Anum_pg_operator_oprleft 7 +#define Anum_pg_operator_oprright 8 +#define Anum_pg_operator_oprresult 9 +#define Anum_pg_operator_oprcom 10 +#define Anum_pg_operator_oprnegate 11 +#define Anum_pg_operator_oprlsortop 12 +#define Anum_pg_operator_oprrsortop 13 +#define Anum_pg_operator_oprcode 14 +#define Anum_pg_operator_oprrest 15 +#define Anum_pg_operator_oprjoin 16 + +/* ---------------- + * initial contents of pg_operator + * ---------------- + */ + +DATA(insert OID = 85 ( "<>" PGUID 0 b t f 16 16 16 85 91 0 0 boolne neqsel neqjoinsel )); +DATA(insert OID = 91 ( "=" PGUID 0 b t t 16 16 16 91 85 0 0 booleq eqsel eqjoinsel )); +#define BooleanEqualOperator 91 + +DATA(insert OID = 92 ( "=" PGUID 0 b t t 18 18 16 92 630 631 631 chareq eqsel eqjoinsel )); +DATA(insert OID = 93 ( "=" PGUID 0 b t t 19 19 16 93 643 660 660 nameeq eqsel eqjoinsel )); +DATA(insert OID = 94 ( "=" PGUID 0 b t t 21 21 16 94 519 95 95 int2eq eqsel eqjoinsel )); +DATA(insert OID = 95 ( "<" PGUID 0 b t f 21 21 16 520 524 0 0 int2lt intltsel intltjoinsel )); +DATA(insert OID = 96 ( "=" PGUID 0 b t t 23 23 16 96 518 97 97 int4eq eqsel eqjoinsel )); +DATA(insert OID = 97 ( "<" PGUID 0 b t f 23 23 16 521 525 0 0 int4lt intltsel intltjoinsel )); +DATA(insert OID = 98 ( "=" PGUID 0 b t t 25 25 16 98 531 664 664 texteq eqsel eqjoinsel )); +DATA(insert OID = 99 ( "=" PGUID 0 b t t 20 20 16 99 644 645 645 char16eq eqsel eqjoinsel )); +DATA(insert OID = 329 ( "=" PGUID 0 b t t 1000 1000 16 329 0 0 0 array_eq eqsel eqjoinsel )); +DATA(insert OID = 349 ( "=" PGUID 0 b t t 1001 1001 16 349 0 0 0 array_eq eqsel eqjoinsel )); +DATA(insert OID = 374 ( "=" PGUID 0 b t t 1002 1002 16 374 0 0 0 array_eq eqsel eqjoinsel )); +DATA(insert OID = 375 ( "=" PGUID 0 b t t 1003 1003 16 375 0 0 0 array_eq eqsel eqjoinsel )); +DATA(insert OID = 376 ( "=" PGUID 0 b t t 1004 1004 16 376 0 0 0 array_eq eqsel eqjoinsel )); +DATA(insert OID = 377 ( "=" PGUID 0 b t t 1005 1005 16 377 0 0 0 array_eq eqsel eqjoinsel )); +DATA(insert OID = 378 ( "=" PGUID 0 b t t 1006 1006 16 378 0 0 0 array_eq eqsel eqjoinsel )); +DATA(insert OID = 379 ( "=" PGUID 0 b t t 1007 1007 16 379 0 0 0 array_eq eqsel eqjoinsel )); +DATA(insert OID = 380 ( "=" PGUID 0 b t t 1008 1008 16 380 0 0 0 array_eq eqsel eqjoinsel )); +DATA(insert OID = 381 ( "=" PGUID 0 b t t 1009 1009 16 381 0 0 0 array_eq eqsel eqjoinsel )); +DATA(insert OID = 382 ( "=" PGUID 0 b t t 1028 1028 16 382 0 0 0 array_eq eqsel eqjoinsel )); +DATA(insert OID = 383 ( "=" PGUID 0 b t t 1010 1010 16 383 0 0 0 array_eq eqsel eqjoinsel )); +DATA(insert OID = 384 ( "=" PGUID 0 b t t 1011 1011 16 384 0 0 0 array_eq eqsel eqjoinsel )); +DATA(insert OID = 385 ( "=" PGUID 0 b t t 1012 1012 16 385 0 0 0 array_eq eqsel eqjoinsel )); +DATA(insert OID = 386 ( "=" PGUID 0 b t t 1013 1013 16 386 0 0 0 array_eq eqsel eqjoinsel )); +/* +DATA(insert OID = 387 ( "=" PGUID 0 b t t 1014 1014 16 387 0 0 0 array_eq eqsel eqjoinsel )); +*/ +DATA(insert OID = 388 ( "=" PGUID 0 b t t 1015 1015 16 388 0 0 0 array_eq eqsel eqjoinsel )); +DATA(insert OID = 389 ( "=" PGUID 0 b t t 1016 1016 16 389 0 0 0 array_eq eqsel eqjoinsel )); +DATA(insert OID = 390 ( "=" PGUID 0 b t t 1017 1017 16 390 0 0 0 array_eq eqsel eqjoinsel )); +DATA(insert OID = 391 ( "=" PGUID 0 b t t 1018 1018 16 391 0 0 0 array_eq eqsel eqjoinsel )); +DATA(insert OID = 392 ( "=" PGUID 0 b t t 1019 1019 16 392 0 0 0 array_eq eqsel eqjoinsel )); +DATA(insert OID = 393 ( "=" PGUID 0 b t t 1020 1020 16 393 0 0 0 array_eq eqsel eqjoinsel )); +DATA(insert OID = 394 ( "=" PGUID 0 b t t 1021 1021 16 394 0 0 0 array_eq eqsel eqjoinsel )); +DATA(insert OID = 395 ( "=" PGUID 0 b t t 1022 1022 16 395 0 0 0 array_eq eqsel eqjoinsel )); +DATA(insert OID = 396 ( "=" PGUID 0 b t t 1023 1023 16 396 0 0 0 array_eq eqsel eqjoinsel )); +DATA(insert OID = 397 ( "=" PGUID 0 b t t 1024 1024 16 397 0 0 0 array_eq eqsel eqjoinsel )); +DATA(insert OID = 398 ( "=" PGUID 0 b t t 1025 1025 16 398 0 0 0 array_eq eqsel eqjoinsel )); +DATA(insert OID = 399 ( "=" PGUID 0 b t t 1026 1026 16 399 0 0 0 array_eq eqsel eqjoinsel )); +DATA(insert OID = 400 ( "=" PGUID 0 b t t 1027 1027 16 400 0 0 0 array_eq eqsel eqjoinsel )); +DATA(insert OID = 401 ( "=" PGUID 0 b t t 1034 1034 16 401 0 0 0 array_eq eqsel eqjoinsel )); + +DATA(insert OID = 412 ( "=" PGUID 0 b t t 409 409 16 412 415 418 418 char2eq eqsel eqjoinsel )); +DATA(insert OID = 413 ( "=" PGUID 0 b t t 410 410 16 413 416 419 419 char4eq eqsel eqjoinsel )); +DATA(insert OID = 414 ( "=" PGUID 0 b t t 411 411 16 414 417 420 420 char8eq eqsel eqjoinsel )); + +DATA(insert OID = 415 ( "<>" PGUID 0 b t f 409 409 16 415 412 0 0 char2ne neqsel neqjoinsel )); +DATA(insert OID = 416 ( "<>" PGUID 0 b t f 410 410 16 416 413 0 0 char4ne neqsel neqjoinsel )); +DATA(insert OID = 417 ( "<>" PGUID 0 b t f 411 411 16 417 414 0 0 char8ne neqsel neqjoinsel )); +DATA(insert OID = 418 ( "<" PGUID 0 b t f 409 409 16 460 463 0 0 char2lt intltsel intltjoinsel )); +DATA(insert OID = 419 ( "<" PGUID 0 b t f 410 410 16 461 464 0 0 char4lt intltsel intltjoinsel )); +DATA(insert OID = 420 ( "<" PGUID 0 b t f 411 411 16 462 465 0 0 char8lt intltsel intltjoinsel )); + +DATA(insert OID = 457 ( "<=" PGUID 0 b t f 409 409 16 463 460 0 0 char2le intltsel intltjoinsel )); +DATA(insert OID = 458 ( "<=" PGUID 0 b t f 410 410 16 464 461 0 0 char4le intltsel intltjoinsel )); +DATA(insert OID = 459 ( "<=" PGUID 0 b t f 411 411 16 465 462 0 0 char8le intltsel intltjoinsel )); +DATA(insert OID = 460 ( ">" PGUID 0 b t f 409 409 16 418 457 0 0 char2gt intltsel intltjoinsel )); +DATA(insert OID = 461 ( ">" PGUID 0 b t f 410 410 16 419 458 0 0 char4gt intltsel intltjoinsel )); +DATA(insert OID = 462 ( ">" PGUID 0 b t f 411 411 16 420 459 0 0 char8gt intltsel intltjoinsel )); +DATA(insert OID = 463 ( ">=" PGUID 0 b t f 409 409 16 457 418 0 0 char2ge intltsel intltjoinsel )); +DATA(insert OID = 464 ( ">=" PGUID 0 b t f 410 410 16 458 418 0 0 char4ge intltsel intltjoinsel )); +DATA(insert OID = 465 ( ">=" PGUID 0 b t f 411 411 16 459 420 0 0 char8ge intltsel intltjoinsel )); + +DATA(insert OID = 485 ( "<<" PGUID 0 b t f 604 604 16 0 0 0 0 poly_left intltsel intltjoinsel )); +DATA(insert OID = 486 ( "&<" PGUID 0 b t f 604 604 16 0 0 0 0 poly_overleft intltsel intltjoinsel )); +DATA(insert OID = 487 ( "&>" PGUID 0 b t f 604 604 16 0 0 0 0 poly_overright intltsel intltjoinsel )); +DATA(insert OID = 488 ( ">>" PGUID 0 b t f 604 604 16 0 0 0 0 poly_right intltsel intltjoinsel )); +DATA(insert OID = 489 ( "@" PGUID 0 b t f 604 604 16 0 0 0 0 poly_contained intltsel intltjoinsel )); +DATA(insert OID = 490 ( "~" PGUID 0 b t f 604 604 16 0 0 0 0 poly_contain intltsel intltjoinsel )); +DATA(insert OID = 491 ( "~=" PGUID 0 b t f 604 604 16 0 0 0 0 poly_same intltsel intltjoinsel )); +DATA(insert OID = 492 ( "&&" PGUID 0 b t f 604 604 16 0 0 0 0 poly_overlap intltsel intltjoinsel )); +DATA(insert OID = 493 ( "<<" PGUID 0 b t f 603 603 16 0 0 0 0 box_left intltsel intltjoinsel )); +DATA(insert OID = 494 ( "&<" PGUID 0 b t f 603 603 16 0 0 0 0 box_overleft intltsel intltjoinsel )); +DATA(insert OID = 495 ( "&>" PGUID 0 b t f 603 603 16 0 0 0 0 box_overright intltsel intltjoinsel )); +DATA(insert OID = 496 ( ">>" PGUID 0 b t f 603 603 16 0 0 0 0 box_right intltsel intltjoinsel )); +DATA(insert OID = 497 ( "@" PGUID 0 b t f 603 603 16 0 0 0 0 box_contained intltsel intltjoinsel )); +DATA(insert OID = 498 ( "~" PGUID 0 b t f 603 603 16 0 0 0 0 box_contain intltsel intltjoinsel )); +DATA(insert OID = 499 ( "~=" PGUID 0 b t f 603 603 16 0 0 0 0 box_same intltsel intltjoinsel )); +DATA(insert OID = 500 ( "&&" PGUID 0 b t f 603 603 16 0 0 0 0 box_overlap intltsel intltjoinsel )); +DATA(insert OID = 501 ( ">=" PGUID 0 b t f 603 603 16 0 0 0 0 box_ge areasel areajoinsel )); +DATA(insert OID = 502 ( ">" PGUID 0 b t f 603 603 16 0 0 0 0 box_gt areasel areajoinsel )); +DATA(insert OID = 503 ( "=" PGUID 0 b t t 603 603 16 0 0 0 0 box_eq areasel areajoinsel )); +DATA(insert OID = 504 ( "<" PGUID 0 b t f 603 603 16 0 0 0 0 box_lt areasel areajoinsel )); +DATA(insert OID = 505 ( "<=" PGUID 0 b t f 603 603 16 0 0 0 0 box_le areasel areajoinsel )); +DATA(insert OID = 506 ( "!^" PGUID 0 b t f 600 600 16 0 0 0 0 point_above intltsel intltjoinsel )); +DATA(insert OID = 507 ( "!<" PGUID 0 b t f 600 600 16 0 0 0 0 point_left intltsel intltjoinsel )); +DATA(insert OID = 508 ( "!>" PGUID 0 b t f 600 600 16 0 0 0 0 point_right intltsel intltjoinsel )); +DATA(insert OID = 509 ( "!|" PGUID 0 b t f 600 600 16 0 0 0 0 point_below intltsel intltjoinsel )); +DATA(insert OID = 510 ( "=|=" PGUID 0 b t f 600 600 16 0 0 0 0 point_eq intltsel intltjoinsel )); +DATA(insert OID = 511 ( "===>" PGUID 0 b t f 600 603 16 0 0 0 0 on_pb intltsel intltjoinsel )); +DATA(insert OID = 512 ( "===`" PGUID 0 b t f 600 602 16 0 0 0 0 on_ppath intltsel intltjoinsel )); +DATA(insert OID = 513 ( "@@" PGUID 0 l t f 0 603 600 0 0 0 0 box_center intltsel intltjoinsel )); +DATA(insert OID = 514 ( "*" PGUID 0 b t f 23 23 23 514 0 0 0 int4mul intltsel intltjoinsel )); +DATA(insert OID = 515 ( "!" PGUID 0 r t f 23 0 23 0 0 0 0 int4fac intltsel intltjoinsel )); +DATA(insert OID = 516 ( "!!" PGUID 0 l t f 0 23 23 0 0 0 0 int4fac intltsel intltjoinsel )); +DATA(insert OID = 517 ( "<===>" PGUID 0 b t f 600 600 23 0 0 0 0 pointdist intltsel intltjoinsel )); +DATA(insert OID = 518 ( "<>" PGUID 0 b t f 23 23 16 518 96 0 0 int4ne neqsel neqjoinsel )); +DATA(insert OID = 519 ( "<>" PGUID 0 b t f 21 21 16 519 94 0 0 int2ne neqsel neqjoinsel )); +DATA(insert OID = 520 ( ">" PGUID 0 b t f 21 21 16 95 0 0 0 int2gt intgtsel intgtjoinsel )); +DATA(insert OID = 521 ( ">" PGUID 0 b t f 23 23 16 97 0 0 0 int4gt intgtsel intgtjoinsel )); +DATA(insert OID = 522 ( "<=" PGUID 0 b t f 21 21 16 524 520 0 0 int2le intltsel intltjoinsel )); +DATA(insert OID = 523 ( "<=" PGUID 0 b t f 23 23 16 525 521 0 0 int4le intltsel intltjoinsel )); +DATA(insert OID = 524 ( ">=" PGUID 0 b t f 21 21 16 522 95 0 0 int2ge intgtsel intgtjoinsel )); +DATA(insert OID = 525 ( ">=" PGUID 0 b t f 23 23 16 523 97 0 0 int4ge intgtsel intgtjoinsel )); +DATA(insert OID = 526 ( "*" PGUID 0 b t f 21 21 21 526 0 0 0 int2mul intltsel intltjoinsel )); +DATA(insert OID = 527 ( "/" PGUID 0 b t f 21 21 21 0 0 0 0 int2div intltsel intltjoinsel )); +DATA(insert OID = 528 ( "/" PGUID 0 b t f 23 23 23 0 0 0 0 int4div intltsel intltjoinsel )); +DATA(insert OID = 529 ( "%" PGUID 0 b t f 21 21 21 6 0 0 0 int2mod intltsel intltjoinsel )); +DATA(insert OID = 530 ( "%" PGUID 0 b t f 23 23 23 6 0 0 0 int4mod intltsel intltjoinsel )); +DATA(insert OID = 531 ( "<>" PGUID 0 b t f 25 25 16 531 98 0 0 textne neqsel neqjoinsel )); +DATA(insert OID = 532 ( "=" PGUID 0 b t t 21 23 16 533 538 95 97 int24eq eqsel eqjoinsel )); +DATA(insert OID = 533 ( "=" PGUID 0 b t t 23 21 16 532 539 97 95 int42eq eqsel eqjoinsel )); +DATA(insert OID = 534 ( "<" PGUID 0 b t f 21 23 16 537 542 0 0 int24lt intltsel intltjoinsel )); +DATA(insert OID = 535 ( "<" PGUID 0 b t f 23 21 16 536 543 0 0 int42lt intltsel intltjoinsel )); +DATA(insert OID = 536 ( ">" PGUID 0 b t f 21 23 16 535 540 0 0 int24gt intgtsel intgtjoinsel )); +DATA(insert OID = 537 ( ">" PGUID 0 b t f 23 21 16 534 541 0 0 int42gt intgtsel intgtjoinsel )); +DATA(insert OID = 538 ( "<>" PGUID 0 b t f 21 23 16 539 532 0 0 int24ne neqsel neqjoinsel )); +DATA(insert OID = 539 ( "<>" PGUID 0 b t f 23 21 16 538 533 0 0 int42ne neqsel neqjoinsel )); +DATA(insert OID = 540 ( "<=" PGUID 0 b t f 21 23 16 543 536 0 0 int24le intltsel intltjoinsel )); +DATA(insert OID = 541 ( "<=" PGUID 0 b t f 23 21 16 542 537 0 0 int42le intltsel intltjoinsel )); +DATA(insert OID = 542 ( ">=" PGUID 0 b t f 21 23 16 541 534 0 0 int24ge intgtsel intgtjoinsel )); +DATA(insert OID = 543 ( ">=" PGUID 0 b t f 23 21 16 540 535 0 0 int42ge intgtsel intgtjoinsel )); +DATA(insert OID = 544 ( "*" PGUID 0 b t f 21 23 23 545 0 0 0 int24mul intltsel intltjoinsel )); +DATA(insert OID = 545 ( "*" PGUID 0 b t f 23 21 23 544 0 0 0 int42mul intltsel intltjoinsel )); +DATA(insert OID = 546 ( "/" PGUID 0 b t f 21 23 23 0 0 0 0 int24div intltsel intltjoinsel )); +DATA(insert OID = 547 ( "/" PGUID 0 b t f 23 21 23 0 0 0 0 int42div intltsel intltjoinsel )); +DATA(insert OID = 548 ( "%" PGUID 0 b t f 21 23 23 6 0 0 0 int24mod intltsel intltjoinsel )); +DATA(insert OID = 549 ( "%" PGUID 0 b t f 23 21 23 6 0 0 0 int42mod intltsel intltjoinsel )); +DATA(insert OID = 550 ( "+" PGUID 0 b t f 21 21 21 550 0 0 0 int2pl intltsel intltjoinsel )); +DATA(insert OID = 551 ( "+" PGUID 0 b t f 23 23 23 551 0 0 0 int4pl intltsel intltjoinsel )); +DATA(insert OID = 552 ( "+" PGUID 0 b t f 21 23 23 553 0 0 0 int24pl intltsel intltjoinsel )); +DATA(insert OID = 553 ( "+" PGUID 0 b t f 23 21 23 552 0 0 0 int42pl intltsel intltjoinsel )); +DATA(insert OID = 554 ( "-" PGUID 0 b t f 21 21 21 0 0 0 0 int2mi intltsel intltjoinsel )); +DATA(insert OID = 555 ( "-" PGUID 0 b t f 23 23 23 0 0 0 0 int4mi intltsel intltjoinsel )); +DATA(insert OID = 556 ( "-" PGUID 0 b t f 21 23 23 0 0 0 0 int24mi intltsel intltjoinsel )); +DATA(insert OID = 557 ( "-" PGUID 0 b t f 23 21 23 0 0 0 0 int42mi intltsel intltjoinsel )); +DATA(insert OID = 558 ( "-" PGUID 0 l t f 0 23 23 0 0 0 0 int4um intltsel intltjoinsel )); +DATA(insert OID = 559 ( "-" PGUID 0 l t f 0 21 21 0 0 0 0 int2um intltsel intltjoinsel )); +DATA(insert OID = 560 ( "=" PGUID 0 b t t 702 702 16 560 561 562 562 abstimeeq eqsel eqjoinsel )); +DATA(insert OID = 561 ( "<>" PGUID 0 b t f 702 702 16 561 560 0 0 abstimene neqsel neqjoinsel )); +DATA(insert OID = 562 ( "<" PGUID 0 b t f 702 702 16 563 565 0 0 abstimelt intltsel intltjoinsel )); +DATA(insert OID = 563 ( ">" PGUID 0 b t f 702 702 16 562 564 0 0 abstimegt intltsel intltjoinsel )); +DATA(insert OID = 564 ( "<=" PGUID 0 b t f 702 702 16 565 563 0 0 abstimele intltsel intltjoinsel )); +DATA(insert OID = 565 ( ">=" PGUID 0 b t f 702 702 16 564 562 0 0 abstimege intltsel intltjoinsel )); +DATA(insert OID = 566 ( "=" PGUID 0 b t t 703 703 16 566 567 568 568 reltimeeq - - )); +DATA(insert OID = 567 ( "<>" PGUID 0 b t f 703 703 16 567 566 0 0 reltimene - - )); +DATA(insert OID = 568 ( "<" PGUID 0 b t f 703 703 16 569 571 0 0 reltimelt - - )); +DATA(insert OID = 569 ( ">" PGUID 0 b t f 703 703 16 568 570 0 0 reltimegt - - )); +DATA(insert OID = 570 ( "<=" PGUID 0 b t f 703 703 16 571 569 0 0 reltimele - - )); +DATA(insert OID = 571 ( ">=" PGUID 0 b t f 703 703 16 570 568 0 0 reltimege - - )); +DATA(insert OID = 572 ( "=" PGUID 0 b t t 704 704 16 572 0 0 0 intervaleq - - )); +DATA(insert OID = 573 ( "<<" PGUID 0 b t f 704 704 16 0 0 0 0 intervalct - - )); +DATA(insert OID = 574 ( "&&" PGUID 0 b t f 704 704 16 0 0 0 0 intervalov - - )); +DATA(insert OID = 575 ( "#=" PGUID 0 b t f 704 703 16 0 576 0 568 intervalleneq - - )); +DATA(insert OID = 576 ( "#<>" PGUID 0 b t f 704 703 16 0 575 0 568 intervallenne - - )); +DATA(insert OID = 577 ( "#<" PGUID 0 b t f 704 703 16 0 580 0 568 intervallenlt - - )); +DATA(insert OID = 578 ( "#>" PGUID 0 b t f 704 703 16 0 579 0 568 intervallengt - - )); +DATA(insert OID = 579 ( "#<=" PGUID 0 b t f 704 703 16 0 578 0 568 intervallenle - - )); +DATA(insert OID = 580 ( "#>=" PGUID 0 b t f 704 703 16 0 577 0 568 intervallenge - - )); +DATA(insert OID = 581 ( "+" PGUID 0 b t f 702 703 702 581 0 0 0 timepl - - )); +DATA(insert OID = 582 ( "-" PGUID 0 b t f 702 703 702 0 0 0 0 timemi - - )); +DATA(insert OID = 583 ( "" PGUID 0 b t f 702 704 16 0 0 562 0 ininterval - - )); +DATA(insert OID = 584 ( "-" PGUID 0 l t f 0 700 700 0 0 0 0 float4um - - )); +DATA(insert OID = 585 ( "-" PGUID 0 l t f 0 701 701 0 0 0 0 float8um - - )); +DATA(insert OID = 586 ( "+" PGUID 0 b t f 700 700 700 586 0 0 0 float4pl - - )); +DATA(insert OID = 587 ( "-" PGUID 0 b t f 700 700 700 0 0 0 0 float4mi - - )); +DATA(insert OID = 588 ( "/" PGUID 0 b t f 700 700 700 0 0 0 0 float4div - - )); +DATA(insert OID = 589 ( "*" PGUID 0 b t f 700 700 700 589 0 0 0 float4mul - - )); +DATA(insert OID = 590 ( "@" PGUID 0 l t f 0 700 700 0 0 0 0 float4abs - - )); +DATA(insert OID = 591 ( "+" PGUID 0 b t f 701 701 701 591 0 0 0 float8pl - - )); +DATA(insert OID = 592 ( "-" PGUID 0 b t f 701 701 701 0 0 0 0 float8mi - - )); +DATA(insert OID = 593 ( "/" PGUID 0 b t f 701 701 701 0 0 0 0 float8div - - )); +DATA(insert OID = 594 ( "*" PGUID 0 b t f 701 701 701 594 0 0 0 float8mul - - )); +DATA(insert OID = 595 ( "@" PGUID 0 l t f 0 701 701 0 0 0 0 float8abs - - )); +DATA(insert OID = 596 ( "|/" PGUID 0 l t f 0 701 701 0 0 0 0 dsqrt - - )); +DATA(insert OID = 597 ( "||/" PGUID 0 l t f 0 701 701 0 0 0 0 dcbrt - - )); +DATA(insert OID = 598 ( "%" PGUID 0 l t f 0 701 701 0 0 0 0 dtrunc - - )); +DATA(insert OID = 599 ( "%" PGUID 0 r t f 701 0 701 0 0 0 0 dround - - )); +DATA(insert OID = 601 ( ":" PGUID 0 l t f 0 701 701 0 0 0 0 dexp - - )); +DATA(insert OID = 602 ( ";" PGUID 0 l t f 0 701 701 0 0 0 0 dlog1 - - )); +DATA(insert OID = 603 ( "|" PGUID 0 l t f 0 704 702 0 0 0 0 intervalstart - - )); +DATA(insert OID = 606 ( "<#>" PGUID 0 b t f 702 702 704 0 0 0 0 mktinterval - - )); +DATA(insert OID = 607 ( "=" PGUID 0 b t t 26 26 16 607 608 97 97 oideq eqsel eqjoinsel )); +#define OIDEqualOperator 607 /* XXX planner/prep/semanopt.c crock */ +DATA(insert OID = 608 ( "<>" PGUID 0 b t f 26 26 16 608 607 0 0 oidne neqsel neqjoinsel )); +DATA(insert OID = 609 ( "<" PGUID 0 b t f 26 26 16 610 612 0 0 int4lt intltsel intltjoinsel )); +DATA(insert OID = 610 ( ">" PGUID 0 b t f 26 26 16 609 611 0 0 int4gt intgtsel intgtjoinsel )); +DATA(insert OID = 611 ( "<=" PGUID 0 b t f 26 26 16 612 610 0 0 int4le intltsel intltjoinsel )); +DATA(insert OID = 612 ( ">=" PGUID 0 b t f 26 26 16 611 609 0 0 int4ge intgtsel intgtjoinsel )); +DATA(insert OID = 620 ( "=" PGUID 0 b t t 700 700 16 620 621 622 622 float4eq eqsel eqjoinsel )); +DATA(insert OID = 621 ( "<>" PGUID 0 b t f 700 700 16 621 620 0 0 float4ne neqsel neqjoinsel )); +DATA(insert OID = 622 ( "<" PGUID 0 b t f 700 700 16 623 625 0 0 float4lt intltsel intltjoinsel )); +DATA(insert OID = 623 ( ">" PGUID 0 b t f 700 700 16 622 624 0 0 float4gt intgtsel intgtjoinsel )); +DATA(insert OID = 624 ( "<=" PGUID 0 b t f 700 700 16 625 623 0 0 float4le intltsel intltjoinsel )); +DATA(insert OID = 625 ( ">=" PGUID 0 b t f 700 700 16 624 622 0 0 float4ge intgtsel intgtjoinsel )); +DATA(insert OID = 626 ( "!!=" PGUID 0 b t f 23 19 16 0 0 0 0 int4notin "-" "-")); +DATA(insert OID = 627 ( "!!=" PGUID 0 b t f 26 19 16 0 0 0 0 oidnotin "-" "-")); +#define OIDNotInOperator 627 /* XXX planner/prep/semanopt.c crock */ +DATA(insert OID = 630 ( "<>" PGUID 0 b t f 18 18 16 630 92 0 0 charne neqsel neqjoinsel )); + +DATA(insert OID = 631 ( "<" PGUID 0 b t f 18 18 16 633 634 0 0 charlt intltsel intltjoinsel )); +DATA(insert OID = 632 ( "<=" PGUID 0 b t f 18 18 16 634 633 0 0 charle intltsel intltjoinsel )); +DATA(insert OID = 633 ( ">" PGUID 0 b t f 18 18 16 631 632 0 0 chargt intltsel intltjoinsel )); +DATA(insert OID = 634 ( ">=" PGUID 0 b t f 18 18 16 632 631 0 0 charge intltsel intltjoinsel )); + +DATA(insert OID = 635 ( "+" PGUID 0 b t f 18 18 18 0 0 0 0 charpl eqsel eqjoinsel )); +DATA(insert OID = 636 ( "-" PGUID 0 b t f 18 18 18 0 0 0 0 charmi eqsel eqjoinsel )); +DATA(insert OID = 637 ( "*" PGUID 0 b t f 18 18 18 0 0 0 0 charmul eqsel eqjoinsel )); +DATA(insert OID = 638 ( "/" PGUID 0 b t f 18 18 18 0 0 0 0 chardiv eqsel eqjoinsel )); + +DATA(insert OID = 639 ( "~" PGUID 0 b t f 19 25 16 0 640 0 0 nameregexeq eqsel eqjoinsel )); +DATA(insert OID = 640 ( "!~" PGUID 0 b t f 19 25 16 0 639 0 0 nameregexne neqsel neqjoinsel )); +DATA(insert OID = 641 ( "~" PGUID 0 b t f 25 25 16 0 642 0 0 textregexeq eqsel eqjoinsel )); +DATA(insert OID = 642 ( "!~" PGUID 0 b t f 25 25 16 0 641 0 0 textregexne eqsel eqjoinsel )); +DATA(insert OID = 643 ( "<>" PGUID 0 b t f 19 19 16 643 93 0 0 namene neqsel neqjoinsel )); +DATA(insert OID = 644 ( "<>" PGUID 0 b t f 20 20 16 644 99 0 0 char16ne neqsel neqjoinsel )); +DATA(insert OID = 645 ( "<" PGUID 0 b t f 20 20 16 647 648 0 0 char16lt intltsel intltjoinsel )); +DATA(insert OID = 646 ( "<=" PGUID 0 b t f 20 20 16 648 647 0 0 char16le intltsel intltjoinsel )); +DATA(insert OID = 647 ( ">" PGUID 0 b t f 20 20 16 645 646 0 0 char16gt intltsel intltjoinsel )); +DATA(insert OID = 648 ( ">=" PGUID 0 b t f 20 20 16 646 645 0 0 char16ge intltsel intltjoinsel )); +DATA(insert OID = 649 ( "~" PGUID 0 b t f 20 25 16 0 650 0 0 char16regexeq intltsel intltjoinsel )); +DATA(insert OID = 650 ( "!~" PGUID 0 b t f 20 25 16 650 0 0 0 char16regexne intltsel intltjoinsel )); +DATA(insert OID = 651 ( "~~" PGUID 0 b t f 20 25 16 0 651 0 0 char16like eqsel eqjoinsel )); +DATA(insert OID = 652 ( "!~~" PGUID 0 b t f 20 25 16 651 0 0 0 char16nlike neqsel neqjoinsel )); + +DATA(insert OID = 660 ( "<" PGUID 0 b t f 19 19 16 662 663 0 0 namelt intltsel intltjoinsel )); +DATA(insert OID = 661 ( "<=" PGUID 0 b t f 19 19 16 663 662 0 0 namele intltsel intltjoinsel )); +DATA(insert OID = 662 ( ">" PGUID 0 b t f 19 19 16 660 661 0 0 namegt intltsel intltjoinsel )); +DATA(insert OID = 663 ( ">=" PGUID 0 b t f 19 19 16 661 660 0 0 namege intltsel intltjoinsel )); +DATA(insert OID = 664 ( "<" PGUID 0 b t f 25 25 16 666 667 0 0 text_lt intltsel intltjoinsel )); +DATA(insert OID = 665 ( "<=" PGUID 0 b t f 25 25 16 667 666 0 0 text_le intltsel intltjoinsel )); +DATA(insert OID = 666 ( ">" PGUID 0 b t f 25 25 16 664 665 0 0 text_gt intltsel intltjoinsel )); +DATA(insert OID = 667 ( ">=" PGUID 0 b t f 25 25 16 665 664 0 0 text_ge intltsel intltjoinsel )); + +DATA(insert OID = 670 ( "=" PGUID 0 b t f 701 701 16 670 671 0 0 float8eq eqsel eqjoinsel )); +DATA(insert OID = 671 ( "<>" PGUID 0 b t f 701 701 16 671 670 0 0 float8ne neqsel neqjoinsel )); +DATA(insert OID = 672 ( "<" PGUID 0 b t f 701 701 16 674 675 0 0 float8lt intltsel intltjoinsel )); +DATA(insert OID = 673 ( "<=" PGUID 0 b t f 701 701 16 675 674 0 0 float8le intltsel intltjoinsel )); +DATA(insert OID = 674 ( ">" PGUID 0 b t f 701 701 16 672 673 0 0 float8gt intltsel intltjoinsel )); +DATA(insert OID = 675 ( ">=" PGUID 0 b t f 701 701 16 673 672 0 0 float8ge intltsel intltjoinsel )); + +DATA(insert OID = 676 ( "<" PGUID 0 b t f 911 911 16 680 679 0 0 oidnamelt intltsel intltjoinsel )); +DATA(insert OID = 677 ( "<=" PGUID 0 b t f 911 911 16 679 680 0 0 oidnamele intltsel intltjoinsel )); +DATA(insert OID = 678 ( "=" PGUID 0 b t f 911 911 16 678 681 0 0 oidnameeq intltsel intltjoinsel )); +DATA(insert OID = 679 ( ">=" PGUID 0 b t f 911 911 16 677 676 0 0 oidnamege intltsel intltjoinsel )); +DATA(insert OID = 680 ( ">" PGUID 0 b t f 911 911 16 676 677 0 0 oidnamegt intltsel intltjoinsel )); +DATA(insert OID = 681 ( "<>" PGUID 0 b t f 911 911 16 681 678 0 0 oidnamene intltsel intltjoinsel )); + +DATA(insert OID = 697 ( "~" PGUID 0 b t f 411 25 16 0 698 0 0 char8regexeq eqsel eqjoinsel )); +DATA(insert OID = 698 ( "!~" PGUID 0 b t f 411 25 16 0 697 0 0 char8regexne neqsel neqjoinsel )); + +DATA(insert OID = 830 ( "<" PGUID 0 b t f 810 810 16 834 833 0 0 oidint2lt intltsel intltjoinsel )); +DATA(insert OID = 831 ( "<=" PGUID 0 b t f 810 810 16 833 834 0 0 oidint2le intltsel intltjoinsel )); +DATA(insert OID = 832 ( "=" PGUID 0 b t f 810 810 16 832 835 0 0 oidint2eq intltsel intltjoinsel )); +DATA(insert OID = 833 ( ">=" PGUID 0 b t f 810 810 16 831 830 0 0 oidint2ge intltsel intltjoinsel )); +DATA(insert OID = 834 ( ">" PGUID 0 b t f 810 810 16 830 831 0 0 oidint2gt intltsel intltjoinsel )); +DATA(insert OID = 835 ( "<>" PGUID 0 b t f 810 810 16 835 832 0 0 oidint2ne intltsel intltjoinsel )); + +DATA(insert OID = 839 ( "~" PGUID 0 b t f 409 25 16 0 841 0 0 char2regexeq eqsel eqjoinsel )); +DATA(insert OID = 841 ( "!~" PGUID 0 b t f 409 25 16 0 839 0 0 char2regexne neqsel neqjoinsel )); +DATA(insert OID = 840 ( "~" PGUID 0 b t f 410 25 16 0 842 0 0 char4regexeq eqsel eqjoinsel )); +DATA(insert OID = 842 ( "!~" PGUID 0 b t f 410 25 16 0 840 0 0 char4regexne neqsel neqjoinsel )); + +DATA(insert OID = 930 ( "<" PGUID 0 b t f 910 910 16 934 933 0 0 oidint4lt intltsel intltjoinsel )); +DATA(insert OID = 931 ( "<=" PGUID 0 b t f 910 910 16 933 934 0 0 oidint4le intltsel intltjoinsel )); +DATA(insert OID = 932 ( "=" PGUID 0 b t f 910 910 16 932 935 0 0 oidint4eq intltsel intltjoinsel )); +DATA(insert OID = 933 ( ">=" PGUID 0 b t f 910 910 16 931 930 0 0 oidint4ge intltsel intltjoinsel )); +DATA(insert OID = 934 ( ">" PGUID 0 b t f 910 910 16 930 931 0 0 oidint4gt intltsel intltjoinsel )); +DATA(insert OID = 935 ( "<>" PGUID 0 b t f 910 910 16 935 932 0 0 oidint4ne intltsel intltjoinsel )); + +DATA(insert OID = 965 ( "^" PGUID 0 b t f 701 701 701 0 0 0 0 dpow - - )); +DATA(insert OID = 966 ( "+" PGUID 0 b t f 1034 1033 1034 0 0 0 0 aclinsert intltsel intltjoinsel )); +DATA(insert OID = 967 ( "-" PGUID 0 b t f 1034 1033 1034 0 0 0 0 aclremove intltsel intltjoinsel )); +DATA(insert OID = 968 ( "~" PGUID 0 b t f 1034 1033 16 0 0 0 0 aclcontains intltsel intltjoinsel )); + +DATA(insert OID = 1054 ( "=" PGUID 0 b t t 1042 1042 16 1054 1057 1058 1058 bpchareq eqsel eqjoinsel )); +DATA(insert OID = 1055 ( "~" PGUID 0 b t f 1042 25 16 0 1056 0 0 textregexeq eqsel eqjoinsel )); +DATA(insert OID = 1056 ( "!~" PGUID 0 b t f 1042 25 16 0 1055 0 0 textregexne neqsel neqjoinsel )); +DATA(insert OID = 1057 ( "<>" PGUID 0 b t f 1042 1042 16 1057 1054 0 0 bpcharne neqsel neqjoinsel )); +DATA(insert OID = 1058 ( "<" PGUID 0 b t f 1042 1042 16 1060 1061 0 0 bpcharlt intltsel intltjoinsel )); +DATA(insert OID = 1059 ( "<=" PGUID 0 b t f 1042 1042 16 1061 1060 0 0 bpcharle intltsel intltjoinsel )); +DATA(insert OID = 1060 ( ">" PGUID 0 b t f 1042 1042 16 1058 1059 0 0 bpchargt intltsel intltjoinsel )); +DATA(insert OID = 1061 ( ">=" PGUID 0 b t f 1042 1042 16 1059 1058 0 0 bpcharge intltsel intltjoinsel )); + +DATA(insert OID = 1062 ( "=" PGUID 0 b t t 1043 1043 16 1062 1065 1066 1066 varchareq eqsel eqjoinsel )); +DATA(insert OID = 1063 ( "~" PGUID 0 b t f 1043 25 16 0 1064 0 0 textregexeq eqsel eqjoinsel )); +DATA(insert OID = 1064 ( "!~" PGUID 0 b t f 1043 25 16 0 1063 0 0 textregexne neqsel neqjoinsel )); +DATA(insert OID = 1065 ( "<>" PGUID 0 b t f 1043 1043 16 1065 1062 0 0 varcharne neqsel neqjoinsel )); +DATA(insert OID = 1066 ( "<" PGUID 0 b t f 1043 1043 16 1068 1069 0 0 varcharlt intltsel intltjoinsel )); +DATA(insert OID = 1067 ( "<=" PGUID 0 b t f 1043 1043 16 1069 1068 0 0 varcharle intltsel intltjoinsel )); +DATA(insert OID = 1068 ( ">" PGUID 0 b t f 1043 1043 16 1066 1067 0 0 varchargt intltsel intltjoinsel )); +DATA(insert OID = 1069 ( ">=" PGUID 0 b t f 1043 1043 16 1067 1066 0 0 varcharge intltsel intltjoinsel )); + +DATA(insert OID = 1093 ( "=" PGUID 0 b t t 1082 1082 16 1093 1094 1095 1095 date_eq eqsel eqjoinsel )); +DATA(insert OID = 1094 ( "<>" PGUID 0 b t f 1082 1082 16 1094 1093 0 0 date_ne neqsel neqjoinsel )); +DATA(insert OID = 1095 ( "<" PGUID 0 b t f 1082 1082 16 1097 1098 0 0 date_lt intltsel intltjoinsel )); +DATA(insert OID = 1096 ( "<=" PGUID 0 b t f 1082 1082 16 1098 1097 0 0 date_le intltsel intltjoinsel )); +DATA(insert OID = 1097 ( ">" PGUID 0 b t f 1082 1082 16 1095 1096 0 0 date_gt intltsel intltjoinsel )); +DATA(insert OID = 1098 ( ">=" PGUID 0 b t f 1082 1082 16 1096 1065 0 0 date_ge intltsel intltjoinsel )); + +DATA(insert OID = 1108 ( "=" PGUID 0 b t t 1083 1083 16 1108 1109 1110 1110 time_eq eqsel eqjoinsel )); +DATA(insert OID = 1109 ( "<>" PGUID 0 b t f 1083 1083 16 1109 1108 0 0 time_ne neqsel neqjoinsel )); +DATA(insert OID = 1110 ( "<" PGUID 0 b t f 1083 1083 16 1112 1113 0 0 time_lt intltsel intltjoinsel )); +DATA(insert OID = 1111 ( "<=" PGUID 0 b t f 1083 1083 16 1113 1112 0 0 time_le intltsel intltjoinsel )); +DATA(insert OID = 1112 ( ">" PGUID 0 b t f 1083 1083 16 1110 1111 0 0 time_gt intltsel intltjoinsel )); +DATA(insert OID = 1113 ( ">=" PGUID 0 b t f 1083 1083 16 1111 1065 0 0 time_ge intltsel intltjoinsel )); + +/* float48 operators */ +DATA(insert OID = 1116 ( "+" PGUID 0 b t f 700 701 701 1116 0 0 0 float48pl - - )); +DATA(insert OID = 1117 ( "-" PGUID 0 b t f 700 701 701 0 0 0 0 float48mi - - )); +DATA(insert OID = 1118 ( "/" PGUID 0 b t f 700 701 701 0 0 0 0 float48div - - )); +DATA(insert OID = 1119 ( "*" PGUID 0 b t f 700 701 701 1119 0 0 0 float48mul - - )); +DATA(insert OID = 1120 ( "=" PGUID 0 b t t 700 701 16 1120 1121 1122 1122 float48eq eqsel eqjoinsel )); +DATA(insert OID = 1121 ( "<>" PGUID 0 b t f 700 701 16 1121 1120 0 0 float48ne neqsel neqjoinsel )); +DATA(insert OID = 1122 ( "<" PGUID 0 b t f 700 701 16 1123 1125 0 0 float48lt intltsel intltjoinsel )); +DATA(insert OID = 1123 ( ">" PGUID 0 b t f 700 701 16 1122 1124 0 0 float48gt intgtsel intgtjoinsel )); +DATA(insert OID = 1124 ( "<=" PGUID 0 b t f 700 701 16 1125 1123 0 0 float48le intltsel intltjoinsel )); +DATA(insert OID = 1125 ( ">=" PGUID 0 b t f 700 701 16 1124 1122 0 0 float48ge intgtsel intgtjoinsel )); + +/* float84 operators */ +DATA(insert OID = 1126 ( "+" PGUID 0 b t f 701 700 701 1126 0 0 0 float84pl - - )); +DATA(insert OID = 1127 ( "-" PGUID 0 b t f 701 700 701 0 0 0 0 float84mi - - )); +DATA(insert OID = 1128 ( "/" PGUID 0 b t f 701 700 701 0 0 0 0 float84div - - )); +DATA(insert OID = 1129 ( "*" PGUID 0 b t f 701 700 701 1129 0 0 0 float84mul - - )); +DATA(insert OID = 1130 ( "=" PGUID 0 b t t 701 700 16 1130 1131 1132 1132 float84eq eqsel eqjoinsel )); +DATA(insert OID = 1131 ( "<>" PGUID 0 b t f 701 700 16 1131 1130 0 0 float84ne neqsel neqjoinsel )); +DATA(insert OID = 1132 ( "<" PGUID 0 b t f 701 700 16 1133 1135 0 0 float84lt intltsel intltjoinsel )); +DATA(insert OID = 1133 ( ">" PGUID 0 b t f 701 700 16 1132 1134 0 0 float84gt intgtsel intgtjoinsel )); +DATA(insert OID = 1134 ( "<=" PGUID 0 b t f 701 700 16 1135 1133 0 0 float84le intltsel intltjoinsel )); +DATA(insert OID = 1135 ( ">=" PGUID 0 b t f 701 700 16 1134 1132 0 0 float84ge intgtsel intgtjoinsel )); + +/* int4 and oid equality */ +DATA(insert OID = 1136 ( "=" PGUID 0 b t t 23 26 16 1137 0 0 0 int4eqoid eqsel eqjoinsel )); +DATA(insert OID = 1137 ( "=" PGUID 0 b t t 26 23 16 1136 0 0 0 oideqint4 eqsel eqjoinsel )); + +/* LIKE hacks by Keith Parks. */ +DATA(insert OID = 1201 ( "~~" PGUID 0 b t f 409 25 16 0 1202 0 0 char2like eqsel eqjoinsel )); +DATA(insert OID = 1202 ( "!~~" PGUID 0 b t f 409 25 16 0 1201 0 0 char2nlike neqsel neqjoinsel )); +DATA(insert OID = 1203 ( "~~" PGUID 0 b t f 410 25 16 0 1204 0 0 char4like eqsel eqjoinsel )); +DATA(insert OID = 1204 ( "!~~" PGUID 0 b t f 410 25 16 0 1203 0 0 char4nlike neqsel neqjoinsel )); +DATA(insert OID = 1205 ( "~~" PGUID 0 b t f 411 25 16 0 1206 0 0 char8like eqsel eqjoinsel )); +DATA(insert OID = 1206 ( "!~~" PGUID 0 b t f 411 25 16 0 1205 0 0 char8nlike neqsel neqjoinsel )); +DATA(insert OID = 1207 ( "~~" PGUID 0 b t f 19 25 16 0 1208 0 0 namelike eqsel eqjoinsel )); +DATA(insert OID = 1208 ( "!~~" PGUID 0 b t f 19 25 16 0 1207 0 0 namenlike neqsel neqjoinsel )); +DATA(insert OID = 1209 ( "~~" PGUID 0 b t f 25 25 16 0 1210 0 0 textlike eqsel eqjoinsel )); +DATA(insert OID = 1210 ( "!~~" PGUID 0 b t f 25 25 16 0 1209 0 0 textnlike neqsel neqjoinsel )); +DATA(insert OID = 1211 ( "~~" PGUID 0 b t f 1042 25 16 0 1212 0 0 textlike eqsel eqjoinsel )); +DATA(insert OID = 1212 ( "!~~" PGUID 0 b t f 1042 25 16 0 1211 0 0 textnlike neqsel neqjoinsel )); +DATA(insert OID = 1213 ( "~~" PGUID 0 b t f 1043 25 16 0 1214 0 0 textlike eqsel eqjoinsel )); +DATA(insert OID = 1214 ( "!~~" PGUID 0 b t f 1043 25 16 0 1213 0 0 textnlike neqsel neqjoinsel )); +DATA(insert OID = 1215 ( "~~" PGUID 0 b t f 20 25 16 0 1216 0 0 char16like eqsel eqjoinsel )); +DATA(insert OID = 1216 ( "!~~" PGUID 0 b t f 20 25 16 0 1215 0 0 char16nlike neqsel neqjoinsel )); + +/* case-insensitive LIKE hacks */ +DATA(insert OID = 1220 ( "~*" PGUID 0 b t f 409 25 16 0 1221 0 0 char2icregexeq eqsel eqjoinsel )); +DATA(insert OID = 1221 ( "!~*" PGUID 0 b t f 409 25 16 0 1220 0 0 char2icregexne neqsel neqjoinsel )); +DATA(insert OID = 1222 ( "~*" PGUID 0 b t f 410 25 16 0 1223 0 0 char4icregexeq eqsel eqjoinsel )); +DATA(insert OID = 1223 ( "!~*" PGUID 0 b t f 410 25 16 0 1222 0 0 char4icregexne neqsel neqjoinsel )); +DATA(insert OID = 1224 ( "~*" PGUID 0 b t f 411 25 16 0 1225 0 0 char8icregexeq eqsel eqjoinsel )); +DATA(insert OID = 1225 ( "!~*" PGUID 0 b t f 411 25 16 0 1224 0 0 char8icregexne neqsel neqjoinsel )); +DATA(insert OID = 1226 ( "~*" PGUID 0 b t f 19 25 16 0 1227 0 0 nameicregexeq eqsel eqjoinsel )); +DATA(insert OID = 1227 ( "!~*" PGUID 0 b t f 19 25 16 0 1226 0 0 nameicregexne neqsel neqjoinsel )); +DATA(insert OID = 1228 ( "~*" PGUID 0 b t f 25 25 16 0 1229 0 0 texticregexeq eqsel eqjoinsel )); +DATA(insert OID = 1229 ( "!~*" PGUID 0 b t f 25 25 16 0 1228 0 0 texticregexne eqsel eqjoinsel )); +DATA(insert OID = 1230 ( "~*" PGUID 0 b t f 20 25 16 0 1231 0 0 char16icregexeq eqsel eqjoinsel )); +DATA(insert OID = 1231 ( "!~*" PGUID 0 b t f 20 25 16 0 1230 0 0 char16icregexne neqsel neqjoinsel )); +DATA(insert OID = 1232 ( "~*" PGUID 0 b t f 1043 25 16 0 1233 0 0 texticregexeq eqsel eqjoinsel )); +DATA(insert OID = 1233 ( "!~*" PGUID 0 b t f 1043 25 16 0 1232 0 0 texticregexne neqsel neqjoinsel )); +DATA(insert OID = 1234 ( "~*" PGUID 0 b t f 1042 25 16 0 1235 0 0 texticregexeq eqsel eqjoinsel )); +DATA(insert OID = 1235 ( "!~*" PGUID 0 b t f 1042 25 16 0 1234 0 0 texticregexne neqsel neqjoinsel )); + + + +/* + * function prototypes + */ +extern void OperatorCreate(char *operatorName, + char *leftTypeName, + char *rightTypeName, + char *procedureName, + uint16 precedence, + bool isLeftAssociative, + char *commutatorName, + char *negatorName, + char *restrictionName, + char *joinName, + bool canHash, + char *leftSortName, + char *rightSortName); + +#endif /* PG_OPERATOR_H */ diff --git a/src/include/catalog/pg_parg.h b/src/include/catalog/pg_parg.h new file mode 100644 index 0000000000..cb6f9253f1 --- /dev/null +++ b/src/include/catalog/pg_parg.h @@ -0,0 +1,116 @@ +/*------------------------------------------------------------------------- + * + * pg_parg.h-- + * definition of the system "parg" relation (pg_parg) + * along with the relation's initial contents. + * + * + * Copyright (c) 1994, Regents of the University of California + * + * $Id: pg_parg.h,v 1.1 1996/08/28 01:57:07 scrappy Exp $ + * + * NOTES + * the genbki.sh script reads this file and generates .bki + * information from the DATA() statements. + * + *------------------------------------------------------------------------- + */ +#ifndef PG_PARG_H +#define PG_PARG_H + +/* ---------------- + * postgres.h contains the system type definintions and the + * CATALOG(), BOOTSTRAP and DATA() sugar words so this file + * can be read by both genbki.sh and the C compiler. + * ---------------- + */ +#include "postgres.h" + +/* ---------------- + * pg_parg definition. cpp turns this into + * typedef struct FormData_pg_parg + * ---------------- + */ +CATALOG(pg_parg) { + Oid parproid; + int2 parnum; + char parbound; + Oid partype; +} FormData_pg_parg; + +/* ---------------- + * Form_pg_parg corresponds to a pointer to a tuple with + * the format of pg_parg relation. + * ---------------- + */ +typedef FormData_pg_parg *Form_pg_parg; + +/* ---------------- + * compiler constants for pg_parg + * ---------------- + */ +#define Natts_pg_parg 4 +#define Anum_pg_parg_parproid 1 +#define Anum_pg_parg_parnum 2 +#define Anum_pg_parg_parbound 3 +#define Anum_pg_parg_partype 4 + +/* ---------------- + * initial contents of pg_parg + * ---------------- + */ + +DATA(insert OID = 0 ( 28 1 - 23 )); +DATA(insert OID = 0 ( 29 1 - 16 )); +DATA(insert OID = 0 ( 30 1 - 23 )); +DATA(insert OID = 0 ( 31 1 - 17 )); +DATA(insert OID = 0 ( 32 1 - 23 )); +DATA(insert OID = 0 ( 33 1 - 18 )); +DATA(insert OID = 0 ( 34 1 - 23 )); +DATA(insert OID = 0 ( 35 1 - 19 )); +DATA(insert OID = 0 ( 36 1 - 23 )); +DATA(insert OID = 0 ( 37 1 - 20 )); +DATA(insert OID = 0 ( 38 1 - 23 )); +DATA(insert OID = 0 ( 39 1 - 21 )); +DATA(insert OID = 0 ( 40 1 - 23 )); +DATA(insert OID = 0 ( 41 1 - 22 )); +DATA(insert OID = 0 ( 42 1 - 23 )); +DATA(insert OID = 0 ( 43 1 - 23 )); +DATA(insert OID = 0 ( 44 1 - 23 )); +DATA(insert OID = 0 ( 45 1 - 24 )); +DATA(insert OID = 0 ( 46 1 - 23 )); +DATA(insert OID = 0 ( 47 1 - 25 )); +DATA(insert OID = 0 ( 50 1 - 23 )); +DATA(insert OID = 0 ( 50 2 - 23 )); +DATA(insert OID = 0 ( 50 3 - 23 )); +DATA(insert OID = 0 ( 51 1 - 23 )); +DATA(insert OID = 0 ( 52 1 - 23 )); +DATA(insert OID = 0 ( 52 2 - 23 )); +DATA(insert OID = 0 ( 52 3 - 23 )); +DATA(insert OID = 0 ( 52 4 - 23 )); +DATA(insert OID = 0 ( 53 1 - 23 )); +DATA(insert OID = 0 ( 54 1 - 23 )); +DATA(insert OID = 0 ( 54 2 - 23 )); +DATA(insert OID = 0 ( 55 1 - 23 )); +DATA(insert OID = 0 ( 55 2 - 23 )); +DATA(insert OID = 0 ( 56 1 - 23 )); +DATA(insert OID = 0 ( 56 2 - 23 )); +DATA(insert OID = 0 ( 57 1 - 23 )); +DATA(insert OID = 0 ( 57 2 - 23 )); +DATA(insert OID = 0 ( 57 3 - 23 )); +DATA(insert OID = 0 ( 60 1 - 16 )); +DATA(insert OID = 0 ( 60 2 - 16 )); +DATA(insert OID = 0 ( 61 1 - 18 )); +DATA(insert OID = 0 ( 61 2 - 18 )); +DATA(insert OID = 0 ( 63 1 - 21 )); +DATA(insert OID = 0 ( 63 2 - 21 )); +DATA(insert OID = 0 ( 64 1 - 21 )); +DATA(insert OID = 0 ( 64 2 - 21 )); +DATA(insert OID = 0 ( 65 1 - 23 )); +DATA(insert OID = 0 ( 65 2 - 23 )); +DATA(insert OID = 0 ( 66 1 - 23 )); +DATA(insert OID = 0 ( 66 2 - 23 )); +DATA(insert OID = 0 ( 67 1 - 25 )); +DATA(insert OID = 0 ( 67 2 - 25 )); + +#endif /* PG_PARG_H */ diff --git a/src/include/catalog/pg_proc.h b/src/include/catalog/pg_proc.h new file mode 100644 index 0000000000..51c50b0000 --- /dev/null +++ b/src/include/catalog/pg_proc.h @@ -0,0 +1,780 @@ +/*------------------------------------------------------------------------- + * + * pg_proc.h-- + * definition of the system "procedure" relation (pg_proc) + * along with the relation's initial contents. + * + * Copyright (c) 1994, Regents of the University of California + * + * $Id: pg_proc.h,v 1.1 1996/08/28 01:57:09 scrappy Exp $ + * + * NOTES + * The script catalog/genbki.sh reads this file and generates .bki + * information from the DATA() statements. utils/Gen_fmgrtab.sh + * generates fmgr.h and fmgrtab.c the same way. + * + * XXX do NOT break up DATA() statements into multiple lines! + * the scripts are not as smart as you might think... + * XXX (eg. #if 0 #endif won't do what you think) + * + *------------------------------------------------------------------------- + */ +#ifndef PG_PROC_H +#define PG_PROC_H + +/* ---------------- + * postgres.h contains the system type definintions and the + * CATALOG(), BOOTSTRAP and DATA() sugar words so this file + * can be read by both genbki.sh and the C compiler. + * ---------------- + */ +#include "postgres.h" +#include "nodes/pg_list.h" +#include "tcop/dest.h" + +/* ---------------- + * pg_proc definition. cpp turns this into + * typedef struct FormData_pg_proc + * ---------------- + */ +CATALOG(pg_proc) BOOTSTRAP { + NameData proname; + Oid proowner; + Oid prolang; + bool proisinh; + bool proistrusted; + bool proiscachable; + int2 pronargs; + bool proretset; + Oid prorettype; + oid8 proargtypes; + int4 probyte_pct; + int4 properbyte_cpu; + int4 propercall_cpu; + int4 prooutin_ratio; + text prosrc; /* VARIABLE LENGTH FIELD */ + bytea probin; /* VARIABLE LENGTH FIELD */ +} FormData_pg_proc; + +/* ---------------- + * Form_pg_proc corresponds to a pointer to a tuple with + * the format of pg_proc relation. + * ---------------- + */ +typedef FormData_pg_proc *Form_pg_proc; + +/* ---------------- + * compiler constants for pg_proc + * ---------------- + */ +#define Natts_pg_proc 16 +#define Anum_pg_proc_proname 1 +#define Anum_pg_proc_proowner 2 +#define Anum_pg_proc_prolang 3 +#define Anum_pg_proc_proisinh 4 +#define Anum_pg_proc_proistrusted 5 +#define Anum_pg_proc_proiscachable 6 +#define Anum_pg_proc_pronargs 7 +#define Anum_pg_proc_proretset 8 +#define Anum_pg_proc_prorettype 9 +#define Anum_pg_proc_proargtypes 10 +#define Anum_pg_proc_probyte_pct 11 +#define Anum_pg_proc_properbyte_cpu 12 +#define Anum_pg_proc_propercall_cpu 13 +#define Anum_pg_proc_prooutin_ratio 14 +#define Anum_pg_proc_prosrc 15 +#define Anum_pg_proc_probin 16 + +/* ---------------- + * initial contents of pg_proc + * ---------------- + */ + +/* keep the following ordered by OID so that later changes can be made easier*/ + +/* OIDS 1 - 99 */ +DATA(insert OID = 28 ( boolin PGUID 11 f t f 1 f 16 "0" 100 0 0 100 foo bar )); +DATA(insert OID = 29 ( boolout PGUID 11 f t f 1 f 23 "0" 100 0 0 100 foo bar )); +DATA(insert OID = 30 ( byteain PGUID 11 f t f 1 f 17 "0" 100 0 0 100 foo bar )); +DATA(insert OID = 31 ( byteaout PGUID 11 f t f 1 f 23 "0" 100 0 0 100 foo bar )); +DATA(insert OID = 32 ( charin PGUID 11 f t f 1 f 18 "0" 100 0 0 100 foo bar )); +DATA(insert OID = 33 ( charout PGUID 11 f t f 1 f 23 "0" 100 0 0 100 foo bar )); +DATA(insert OID = 34 ( namein PGUID 11 f t f 1 f 19 "0" 100 0 0 100 foo bar )); +DATA(insert OID = 35 ( nameout PGUID 11 f t f 1 f 23 "0" 100 0 0 100 foo bar )); +DATA(insert OID = 36 ( char16in PGUID 11 f t f 1 f 19 "0" 100 0 0 100 foo bar )); +DATA(insert OID = 37 ( char16out PGUID 11 f t f 1 f 23 "0" 100 0 0 100 foo bar )); +DATA(insert OID = 38 ( int2in PGUID 11 f t f 1 f 21 "0" 100 0 0 100 foo bar )); +DATA(insert OID = 39 ( int2out PGUID 11 f t f 1 f 23 "0" 100 0 0 100 foo bar )); +DATA(insert OID = 40 ( int28in PGUID 11 f t f 1 f 22 "0" 100 0 0 100 foo bar )); +DATA(insert OID = 41 ( int28out PGUID 11 f t f 1 f 23 "0" 100 0 0 100 foo bar )); +DATA(insert OID = 42 ( int4in PGUID 11 f t f 1 f 23 "0" 100 0 0 100 foo bar )); +DATA(insert OID = 43 ( int4out PGUID 11 f t f 1 f 19 "0" 100 0 0 100 foo bar )); +DATA(insert OID = 44 ( regprocin PGUID 11 f t f 1 f 24 "0" 100 0 0 100 foo bar )); +DATA(insert OID = 45 ( regprocout PGUID 11 f t f 1 f 23 "0" 100 0 0 100 foo bar )); +DATA(insert OID = 46 ( textin PGUID 11 f t f 1 f 25 "0" 100 0 0 100 foo bar )); +#define TextInRegProcedure 46 + +DATA(insert OID = 47 ( textout PGUID 11 f t f 1 f 23 "0" 100 0 0 100 foo bar )); +DATA(insert OID = 48 ( tidin PGUID 11 f t f 1 f 27 "0" 100 0 0 100 foo bar )); +DATA(insert OID = 49 ( tidout PGUID 11 f t f 1 f 23 "0" 100 0 0 100 foo bar )); +DATA(insert OID = 50 ( xidin PGUID 11 f t f 1 f 28 "0" 100 0 0 100 foo bar )); +DATA(insert OID = 51 ( xidout PGUID 11 f t f 1 f 23 "0" 100 0 0 100 foo bar )); +DATA(insert OID = 52 ( cidin PGUID 11 f t f 1 f 29 "0" 100 0 0 100 foo bar )); +DATA(insert OID = 53 ( cidout PGUID 11 f t f 1 f 23 "0" 100 0 0 100 foo bar )); +DATA(insert OID = 54 ( oid8in PGUID 11 f t f 1 f 30 "0" 100 0 0 100 foo bar )); +DATA(insert OID = 55 ( oid8out PGUID 11 f t f 1 f 23 "0" 100 0 0 100 foo bar )); +DATA(insert OID = 60 ( booleq PGUID 11 f t f 2 f 16 "16 16" 100 0 0 100 foo bar )); +DATA(insert OID = 61 ( chareq PGUID 11 f t f 2 f 16 "18 18" 100 0 0 100 foo bar )); +#define CharacterEqualRegProcedure 61 + +DATA(insert OID = 62 ( nameeq PGUID 11 f t f 2 f 16 "19 19" 100 0 0 100 foo bar )); +#define NameEqualRegProcedure 62 + +DATA(insert OID = 63 ( int2eq PGUID 11 f t f 2 f 16 "21 21" 100 0 0 100 foo bar )); +#define Integer16EqualRegProcedure 63 + +DATA(insert OID = 64 ( int2lt PGUID 11 f t f 2 f 16 "21 21" 100 0 0 100 foo bar )); +DATA(insert OID = 65 ( int4eq PGUID 11 f t f 2 f 16 "23 23" 100 0 0 100 foo bar )); +#define Integer32EqualRegProcedure 65 + +DATA(insert OID = 66 ( int4lt PGUID 11 f t f 2 f 16 "23 23" 100 0 0 100 foo bar )); +DATA(insert OID = 67 ( texteq PGUID 11 f t f 2 f 16 "25 25" 100 0 0 0 foo bar )); +#define TextEqualRegProcedure 67 + +DATA(insert OID = 68 ( xideq PGUID 11 f t f 2 f 16 "28 28" 100 0 0 100 foo bar )); +DATA(insert OID = 69 ( cideq PGUID 11 f t f 2 f 16 "29 29" 100 0 0 100 foo bar )); +DATA(insert OID = 70 ( charne PGUID 11 f t f 2 f 16 "18 18" 100 0 0 100 foo bar )); +DATA(insert OID = 71 ( charlt PGUID 11 f t f 2 f 16 "18 18" 100 0 0 100 foo bar )); +DATA(insert OID = 72 ( charle PGUID 11 f t f 2 f 16 "18 18" 100 0 0 100 foo bar )); +DATA(insert OID = 73 ( chargt PGUID 11 f t f 2 f 16 "18 18" 100 0 0 100 foo bar )); +DATA(insert OID = 74 ( charge PGUID 11 f t f 2 f 16 "18 18" 100 0 0 100 foo bar )); +DATA(insert OID = 75 ( charpl PGUID 11 f t f 2 f 18 "18 18" 100 0 0 100 foo bar )); +DATA(insert OID = 76 ( charmi PGUID 11 f t f 2 f 18 "18 18" 100 0 0 100 foo bar )); +DATA(insert OID = 77 ( charmul PGUID 11 f t f 2 f 18 "18 18" 100 0 0 100 foo bar )); +DATA(insert OID = 78 ( chardiv PGUID 11 f t f 2 f 18 "18 18" 100 0 0 100 foo bar )); + +DATA(insert OID = 79 ( nameregexeq PGUID 11 f t f 2 f 16 "19 25" 100 0 0 100 foo bar )); +DATA(insert OID = 80 ( nameregexne PGUID 11 f t f 2 f 16 "19 25" 100 0 0 100 foo bar )); +DATA(insert OID = 81 ( textregexeq PGUID 11 f t f 2 f 16 "25 25" 100 0 1 0 foo bar )); +DATA(insert OID = 82 ( textregexne PGUID 11 f t f 2 f 16 "25 25" 100 0 1 0 foo bar )); +DATA(insert OID = 83 ( textcat PGUID 11 f t f 2 f 25 "25 25" 100 0 1 0 foo bar )); +DATA(insert OID = 84 ( boolne PGUID 11 f t f 2 f 16 "16 16" 100 0 0 100 foo bar )); + +DATA(insert OID = 97 ( rtsel PGUID 11 f t f 7 f 701 "26 26 21 0 23 23 26" 100 0 0 100 foo bar )); +DATA(insert OID = 98 ( rtnpage PGUID 11 f t f 7 f 701 "26 26 21 0 23 23 26" 100 0 0 100 foo bar )); +DATA(insert OID = 99 ( btreesel PGUID 11 f t f 7 f 701 "26 26 21 0 23 23 26" 100 0 0 100 foo bar )); + +/* OIDS 100 - 199 */ + +DATA(insert OID = 100 ( btreenpage PGUID 11 f t f 7 f 701 "26 26 21 0 23 23 26" 100 0 0 100 foo bar )); +DATA(insert OID = 101 ( eqsel PGUID 11 f t f 5 f 701 "26 26 21 0 23" 100 0 0 100 foo bar )); +#define EqualSelectivityProcedure 101 + +DATA(insert OID = 102 ( neqsel PGUID 11 f t f 5 f 701 "26 26 21 0 23" 100 0 0 100 foo bar )); +DATA(insert OID = 103 ( intltsel PGUID 11 f t f 5 f 701 "26 26 21 0 23" 100 0 0 100 foo bar )); +DATA(insert OID = 104 ( intgtsel PGUID 11 f t f 5 f 701 "26 26 21 0 23" 100 0 0 100 foo bar )); +DATA(insert OID = 105 ( eqjoinsel PGUID 11 f t f 5 f 701 "26 26 21 26 21" 100 0 0 100 foo bar )); +DATA(insert OID = 106 ( neqjoinsel PGUID 11 f t f 5 f 701 "26 26 21 26 21" 100 0 0 100 foo bar )); +DATA(insert OID = 107 ( intltjoinsel PGUID 11 f t f 5 f 701 "26 26 21 26 21" 100 0 0 100 foo bar )); +DATA(insert OID = 108 ( intgtjoinsel PGUID 11 f t f 5 f 701 "26 26 21 26 21" 100 0 0 100 foo bar )); + + + +DATA(insert OID = 117 ( point_in PGUID 11 f t f 1 f 600 "0" 100 0 0 100 foo bar )); +DATA(insert OID = 118 ( point_out PGUID 11 f t f 1 f 23 "0" 100 0 0 100 foo bar )); +DATA(insert OID = 119 ( lseg_in PGUID 11 f t f 1 f 601 "0" 100 0 0 100 foo bar )); +DATA(insert OID = 120 ( lseg_out PGUID 11 f t f 1 f 23 "0" 100 0 0 100 foo bar )); +DATA(insert OID = 121 ( path_in PGUID 11 f t f 1 f 602 "0" 100 0 0 100 foo bar )); +DATA(insert OID = 122 ( path_out PGUID 11 f t f 1 f 23 "0" 100 0 0 100 foo bar )); +DATA(insert OID = 123 ( box_in PGUID 11 f t f 1 f 603 "0" 100 0 0 100 foo bar )); +DATA(insert OID = 124 ( box_out PGUID 11 f t f 1 f 23 "0" 100 0 0 100 foo bar )); +DATA(insert OID = 125 ( box_overlap PGUID 11 f t f 2 f 16 "603 603" 100 1 0 100 foo bar )); +DATA(insert OID = 126 ( box_ge PGUID 11 f t f 2 f 16 "603 603" 100 1 0 100 foo bar )); +DATA(insert OID = 127 ( box_gt PGUID 11 f t f 2 f 16 "603 603" 100 1 0 100 foo bar )); +DATA(insert OID = 128 ( box_eq PGUID 11 f t f 2 f 16 "603 603" 100 1 0 100 foo bar )); +DATA(insert OID = 129 ( box_lt PGUID 11 f t f 2 f 16 "603 603" 100 1 0 100 foo bar )); +DATA(insert OID = 130 ( box_le PGUID 11 f t f 2 f 16 "603 603" 100 1 0 100 foo bar )); +DATA(insert OID = 131 ( point_above PGUID 11 f t f 2 f 16 "600 600" 100 0 0 100 foo bar )); +DATA(insert OID = 132 ( point_left PGUID 11 f t f 2 f 16 "600 600" 100 0 0 100 foo bar )); +DATA(insert OID = 133 ( point_right PGUID 11 f t f 2 f 16 "600 600" 100 0 0 100 foo bar )); +DATA(insert OID = 134 ( point_below PGUID 11 f t f 2 f 16 "600 600" 100 0 0 100 foo bar )); +DATA(insert OID = 135 ( point_eq PGUID 11 f t f 2 f 16 "600 600" 100 0 0 100 foo bar )); +DATA(insert OID = 136 ( on_pb PGUID 11 f t f 2 f 16 "600 603" 100 0 0 100 foo bar )); +DATA(insert OID = 137 ( on_ppath PGUID 11 f t f 2 f 16 "600 602" 100 0 1 0 foo bar )); +DATA(insert OID = 138 ( box_center PGUID 11 f t f 1 f 600 "603" 100 1 0 100 foo bar )); +DATA(insert OID = 139 ( areasel PGUID 11 f t f 5 f 701 "26 26 21 0 23" 100 0 0 100 foo bar )); +DATA(insert OID = 140 ( areajoinsel PGUID 11 f t f 5 f 701 "26 26 21 0 23" 100 0 0 100 foo bar )); +DATA(insert OID = 141 ( int4mul PGUID 11 f t f 2 f 23 "23 23" 100 0 0 100 foo bar )); +DATA(insert OID = 142 ( int4fac PGUID 11 f t f 1 f 23 "23" 100 0 0 100 foo bar )); +DATA(insert OID = 143 ( pointdist PGUID 11 f t f 2 f 23 "600 600" 100 0 0 100 foo bar )); +DATA(insert OID = 144 ( int4ne PGUID 11 f t f 2 f 16 "23 23" 100 0 0 100 foo bar )); +DATA(insert OID = 145 ( int2ne PGUID 11 f t f 2 f 16 "21 21" 100 0 0 100 foo bar )); +DATA(insert OID = 146 ( int2gt PGUID 11 f t f 2 f 16 "21 21" 100 0 0 100 foo bar )); +DATA(insert OID = 147 ( int4gt PGUID 11 f t f 2 f 16 "23 23" 100 0 0 100 foo bar )); +DATA(insert OID = 148 ( int2le PGUID 11 f t f 2 f 16 "21 21" 100 0 0 100 foo bar )); +DATA(insert OID = 149 ( int4le PGUID 11 f t f 2 f 16 "23 23" 100 0 0 100 foo bar )); +DATA(insert OID = 150 ( int4ge PGUID 11 f t f 2 f 16 "23 23" 100 0 0 100 foo bar )); +#define INT4GE_PROC_OID 150 +DATA(insert OID = 151 ( int2ge PGUID 11 f t f 2 f 16 "21 21" 100 0 0 100 foo bar )); +DATA(insert OID = 152 ( int2mul PGUID 11 f t f 2 f 21 "21 21" 100 0 0 100 foo bar )); +DATA(insert OID = 153 ( int2div PGUID 11 f t f 2 f 21 "21 21" 100 0 0 100 foo bar )); +DATA(insert OID = 154 ( int4div PGUID 11 f t f 2 f 23 "23 23" 100 0 0 100 foo bar )); +DATA(insert OID = 155 ( int2mod PGUID 11 f t f 2 f 21 "21 21" 100 0 0 100 foo bar )); +DATA(insert OID = 156 ( int4mod PGUID 11 f t f 2 f 23 "23 23" 100 0 0 100 foo bar )); +DATA(insert OID = 157 ( textne PGUID 11 f t f 2 f 16 "25 25" 100 0 0 0 foo bar )); +DATA(insert OID = 158 ( int24eq PGUID 11 f t f 2 f 23 "21 23" 100 0 0 100 foo bar )); +DATA(insert OID = 159 ( int42eq PGUID 11 f t f 2 f 23 "23 21" 100 0 0 100 foo bar )); +DATA(insert OID = 160 ( int24lt PGUID 11 f t f 2 f 23 "21 23" 100 0 0 100 foo bar )); +DATA(insert OID = 161 ( int42lt PGUID 11 f t f 2 f 23 "23 21" 100 0 0 100 foo bar )); +DATA(insert OID = 162 ( int24gt PGUID 11 f t f 2 f 23 "21 23" 100 0 0 100 foo bar )); +DATA(insert OID = 163 ( int42gt PGUID 11 f t f 2 f 23 "23 21" 100 0 0 100 foo bar )); +DATA(insert OID = 164 ( int24ne PGUID 11 f t f 2 f 23 "21 23" 100 0 0 100 foo bar )); +DATA(insert OID = 165 ( int42ne PGUID 11 f t f 2 f 23 "23 21" 100 0 0 100 foo bar )); +DATA(insert OID = 166 ( int24le PGUID 11 f t f 2 f 23 "21 23" 100 0 0 100 foo bar )); +DATA(insert OID = 167 ( int42le PGUID 11 f t f 2 f 23 "23 21" 100 0 0 100 foo bar )); +DATA(insert OID = 168 ( int24ge PGUID 11 f t f 2 f 23 "21 23" 100 0 0 100 foo bar )); +DATA(insert OID = 169 ( int42ge PGUID 11 f t f 2 f 23 "23 21" 100 0 0 100 foo bar )); +DATA(insert OID = 170 ( int24mul PGUID 11 f t f 2 f 23 "21 23" 100 0 0 100 foo bar )); +DATA(insert OID = 171 ( int42mul PGUID 11 f t f 2 f 23 "23 21" 100 0 0 100 foo bar )); +DATA(insert OID = 172 ( int24div PGUID 11 f t f 2 f 23 "21 23" 100 0 0 100 foo bar )); +DATA(insert OID = 173 ( int42div PGUID 11 f t f 2 f 23 "23 21" 100 0 0 100 foo bar )); +DATA(insert OID = 174 ( int24mod PGUID 11 f t f 2 f 23 "21 23" 100 0 0 100 foo bar )); +DATA(insert OID = 175 ( int42mod PGUID 11 f t f 2 f 23 "23 21" 100 0 0 100 foo bar )); +DATA(insert OID = 176 ( int2pl PGUID 11 f t f 2 f 21 "21 21" 100 0 0 100 foo bar )); +DATA(insert OID = 177 ( int4pl PGUID 11 f t f 2 f 23 "23 23" 100 0 0 100 foo bar )); +DATA(insert OID = 178 ( int24pl PGUID 11 f t f 2 f 23 "21 23" 100 0 0 100 foo bar )); +DATA(insert OID = 179 ( int42pl PGUID 11 f t f 2 f 23 "23 21" 100 0 0 100 foo bar )); +DATA(insert OID = 180 ( int2mi PGUID 11 f t f 2 f 21 "21 21" 100 0 0 100 foo bar )); +DATA(insert OID = 181 ( int4mi PGUID 11 f t f 2 f 23 "23 23" 100 0 0 100 foo bar )); +DATA(insert OID = 182 ( int24mi PGUID 11 f t f 2 f 23 "21 23" 100 0 0 100 foo bar )); +DATA(insert OID = 183 ( int42mi PGUID 11 f t f 2 f 23 "23 21" 100 0 0 100 foo bar )); +DATA(insert OID = 184 ( oideq PGUID 11 f t f 2 f 16 "26 26" 100 0 0 100 foo bar )); +#define ObjectIdEqualRegProcedure 184 + +DATA(insert OID = 185 ( oidne PGUID 11 f t f 2 f 16 "26 26" 100 0 0 100 foo bar )); +DATA(insert OID = 186 ( box_same PGUID 11 f t f 2 f 16 "603 603" 100 0 0 100 foo bar )); +DATA(insert OID = 187 ( box_contain PGUID 11 f t f 2 f 16 "603 603" 100 0 0 100 foo bar )); +DATA(insert OID = 188 ( box_left PGUID 11 f t f 2 f 16 "603 603" 100 0 0 100 foo bar )); +DATA(insert OID = 189 ( box_overleft PGUID 11 f t f 2 f 16 "603 603" 100 0 0 100 foo bar )); +DATA(insert OID = 190 ( box_overright PGUID 11 f t f 2 f 16 "603 603" 100 0 0 100 foo bar )); +DATA(insert OID = 191 ( box_right PGUID 11 f t f 2 f 16 "603 603" 100 0 0 100 foo bar )); +DATA(insert OID = 192 ( box_contained PGUID 11 f t f 2 f 16 "603 603" 100 0 0 100 foo bar )); +DATA(insert OID = 193 ( rt_box_union PGUID 11 f t f 2 f 603 "603 603" 100 0 0 100 foo bar )); +DATA(insert OID = 194 ( rt_box_inter PGUID 11 f t f 2 f 603 "603 603" 100 0 0 100 foo bar )); +DATA(insert OID = 195 ( rt_box_size PGUID 11 f t f 2 f 700 "603 700" 100 0 0 100 foo bar )); +DATA(insert OID = 196 ( rt_bigbox_size PGUID 11 f t f 2 f 700 "603 700" 100 0 0 100 foo bar )); +DATA(insert OID = 197 ( rt_poly_union PGUID 11 f t f 2 f 604 "604 604" 100 0 0 100 foo bar )); +DATA(insert OID = 198 ( rt_poly_inter PGUID 11 f t f 2 f 604 "604 604" 100 0 0 100 foo bar )); +DATA(insert OID = 199 ( rt_poly_size PGUID 11 f t f 2 f 23 "604 23" 100 0 0 100 foo bar )); + +/* OIDS 200 - 299 */ + +DATA(insert OID = 200 ( float4in PGUID 11 f t f 1 f 700 "0" 100 0 0 100 foo bar )); +DATA(insert OID = 201 ( float4out PGUID 11 f t f 1 f 23 "0" 100 0 0 100 foo bar )); +DATA(insert OID = 202 ( float4mul PGUID 11 f t f 2 f 700 "700 700" 100 0 0 100 foo bar )); +DATA(insert OID = 203 ( float4div PGUID 11 f t f 2 f 700 "700 700" 100 0 0 100 foo bar )); +DATA(insert OID = 204 ( float4pl PGUID 11 f t f 2 f 700 "700 700" 100 0 0 100 foo bar )); +DATA(insert OID = 205 ( float4mi PGUID 11 f t f 2 f 700 "700 700" 100 0 0 100 foo bar )); +DATA(insert OID = 206 ( float4um PGUID 11 f t f 1 f 700 "700" 100 0 0 100 foo bar )); +DATA(insert OID = 207 ( float4abs PGUID 11 f t f 1 f 700 "700 700" 100 0 0 100 foo bar )); +DATA(insert OID = 208 ( float4inc PGUID 11 f t f 1 f 700 "700" 100 0 0 100 foo bar )); +DATA(insert OID = 209 ( float4larger PGUID 11 f t f 2 f 700 "700 700" 100 0 0 100 foo bar )); +DATA(insert OID = 211 ( float4smaller PGUID 11 f t f 2 f 700 "700 700" 100 0 0 100 foo bar )); + +DATA(insert OID = 212 ( int4um PGUID 11 f t f 1 f 23 "23" 100 0 0 100 foo bar )); +DATA(insert OID = 213 ( int2um PGUID 11 f t f 1 f 21 "21" 100 0 0 100 foo bar )); + +DATA(insert OID = 214 ( float8in PGUID 11 f t f 1 f 701 "0" 100 0 0 100 foo bar )); +DATA(insert OID = 215 ( float8out PGUID 11 f t f 1 f 23 "0" 100 0 0 100 foo bar )); +DATA(insert OID = 216 ( float8mul PGUID 11 f t f 2 f 701 "701 701" 100 0 0 100 foo bar )); +DATA(insert OID = 217 ( float8div PGUID 11 f t f 2 f 701 "701 701" 100 0 0 100 foo bar )); +DATA(insert OID = 218 ( float8pl PGUID 11 f t f 2 f 701 "701 701" 100 0 0 100 foo bar )); +DATA(insert OID = 219 ( float8mi PGUID 11 f t f 2 f 701 "701 701" 100 0 0 100 foo bar )); +DATA(insert OID = 220 ( float8um PGUID 11 f t f 1 f 701 "701" 100 0 0 100 foo bar )); +DATA(insert OID = 221 ( float8abs PGUID 11 f t f 1 f 701 "701" 100 0 0 100 foo bar )); +DATA(insert OID = 222 ( float8inc PGUID 11 f t f 1 f 701 "701" 100 0 0 100 foo bar )); +DATA(insert OID = 223 ( float8larger PGUID 11 f t f 2 f 701 "701 701" 100 0 0 100 foo bar )); +DATA(insert OID = 224 ( float8smaller PGUID 11 f t f 2 f 701 "701 701" 100 0 0 100 foo bar )); +DATA(insert OID = 228 ( dround PGUID 11 f t f 1 f 701 "701" 100 0 0 100 foo bar )); +DATA(insert OID = 229 ( dtrunc PGUID 11 f t f 1 f 701 "701" 100 0 0 100 foo bar )); +DATA(insert OID = 230 ( dsqrt PGUID 11 f t f 1 f 701 "701" 100 0 0 100 foo bar )); +DATA(insert OID = 231 ( dcbrt PGUID 11 f t f 1 f 701 "701" 100 0 0 100 foo bar )); +DATA(insert OID = 232 ( dpow PGUID 11 f t f 2 f 701 "701" 100 0 0 100 foo bar )); +DATA(insert OID = 233 ( dexp PGUID 11 f t f 1 f 701 "701" 100 0 0 100 foo bar )); +DATA(insert OID = 234 ( dlog1 PGUID 11 f t f 1 f 701 "701" 100 0 0 100 foo bar )); + +DATA(insert OID = 240 ( nabstimein PGUID 11 f t f 1 f 702 "0" 100 0 0 100 foo bar )); +DATA(insert OID = 241 ( nabstimeout PGUID 11 f t f 1 f 23 "0" 100 0 0 100 foo bar )); +DATA(insert OID = 242 ( reltimein PGUID 11 f t f 1 f 703 "0" 100 0 0 100 foo bar )); +DATA(insert OID = 243 ( reltimeout PGUID 11 f t f 1 f 23 "0" 100 0 0 100 foo bar )); +DATA(insert OID = 244 ( timepl PGUID 11 f t f 2 f 702 "702 703" 100 0 0 100 foo bar )); +DATA(insert OID = 245 ( timemi PGUID 11 f t f 2 f 702 "702 703" 100 0 0 100 foo bar )); +DATA(insert OID = 246 ( tintervalin PGUID 11 f t f 1 f 704 "0" 100 0 0 100 foo bar )); +DATA(insert OID = 247 ( tintervalout PGUID 11 f t f 1 f 23 "0" 100 0 0 100 foo bar )); +DATA(insert OID = 248 ( ininterval PGUID 11 f t f 2 f 16 "702 704" 100 0 0 100 foo bar )); +DATA(insert OID = 249 ( intervalrel PGUID 11 f t f 1 f 703 "704" 100 0 0 100 foo bar )); +DATA(insert OID = 250 ( timenow PGUID 11 f t f 0 f 702 "0" 100 0 0 100 foo bar )); +DATA(insert OID = 251 ( abstimeeq PGUID 11 f t f 2 f 16 "702 702" 100 0 0 100 foo bar )); +DATA(insert OID = 252 ( abstimene PGUID 11 f t f 2 f 16 "702 702" 100 0 0 100 foo bar )); +DATA(insert OID = 253 ( abstimelt PGUID 11 f t f 2 f 16 "702 702" 100 0 0 100 foo bar )); +DATA(insert OID = 254 ( abstimegt PGUID 11 f t f 2 f 16 "702 702" 100 0 0 100 foo bar )); +DATA(insert OID = 255 ( abstimele PGUID 11 f t f 2 f 16 "702 702" 100 0 0 100 foo bar )); +DATA(insert OID = 256 ( abstimege PGUID 11 f t f 2 f 16 "702 702" 100 0 0 100 foo bar )); +DATA(insert OID = 257 ( reltimeeq PGUID 11 f t f 2 f 16 "703 703" 100 0 0 100 foo bar )); +DATA(insert OID = 258 ( reltimene PGUID 11 f t f 2 f 16 "703 703" 100 0 0 100 foo bar )); +DATA(insert OID = 259 ( reltimelt PGUID 11 f t f 2 f 16 "703 703" 100 0 0 100 foo bar )); +DATA(insert OID = 260 ( reltimegt PGUID 11 f t f 2 f 16 "703 703" 100 0 0 100 foo bar )); +DATA(insert OID = 261 ( reltimele PGUID 11 f t f 2 f 16 "703 703" 100 0 0 100 foo bar )); +DATA(insert OID = 262 ( reltimege PGUID 11 f t f 2 f 16 "703 703" 100 0 0 100 foo bar )); +DATA(insert OID = 263 ( intervaleq PGUID 11 f t f 2 f 16 "704 704" 100 0 0 100 foo bar )); +DATA(insert OID = 264 ( intervalct PGUID 11 f t f 2 f 16 "704 704" 100 0 0 100 foo bar )); +DATA(insert OID = 265 ( intervalov PGUID 11 f t f 2 f 16 "704 704" 100 0 0 100 foo bar )); +DATA(insert OID = 266 ( intervalleneq PGUID 11 f t f 2 f 16 "704 703" 100 0 0 100 foo bar )); +DATA(insert OID = 267 ( intervallenne PGUID 11 f t f 2 f 16 "704 703" 100 0 0 100 foo bar )); +DATA(insert OID = 268 ( intervallenlt PGUID 11 f t f 2 f 16 "704 703" 100 0 0 100 foo bar )); +DATA(insert OID = 269 ( intervallengt PGUID 11 f t f 2 f 16 "704 703" 100 0 0 100 foo bar )); +DATA(insert OID = 270 ( intervallenle PGUID 11 f t f 2 f 16 "704 703" 100 0 0 100 foo bar )); +DATA(insert OID = 271 ( intervallenge PGUID 11 f t f 2 f 16 "704 703" 100 0 0 100 foo bar )); +DATA(insert OID = 272 ( intervalstart PGUID 11 f t f 1 f 702 "704" 100 0 0 100 foo bar )); +DATA(insert OID = 273 ( intervalend PGUID 11 f t f 1 f 702 "704" 100 0 0 100 foo bar )); +DATA(insert OID = 274 ( timeofday PGUID 11 f t f 0 f 25 "0" 100 0 0 100 foo bar )); + +DATA(insert OID = 276 ( int2fac PGUID 11 f t f 1 f 21 "21" 100 0 0 100 foo bar )); +DATA(insert OID = 279 ( float48mul PGUID 11 f t f 2 f 701 "700 701" 100 0 0 100 foo bar )); +DATA(insert OID = 280 ( float48div PGUID 11 f t f 2 f 701 "700 701" 100 0 0 100 foo bar )); +DATA(insert OID = 281 ( float48pl PGUID 11 f t f 2 f 701 "700 701" 100 0 0 100 foo bar )); +DATA(insert OID = 282 ( float48mi PGUID 11 f t f 2 f 701 "700 701" 100 0 0 100 foo bar )); +DATA(insert OID = 283 ( float84mul PGUID 11 f t f 2 f 701 "701 700" 100 0 0 100 foo bar )); +DATA(insert OID = 284 ( float84div PGUID 11 f t f 2 f 701 "701 700" 100 0 0 100 foo bar )); +DATA(insert OID = 285 ( float84pl PGUID 11 f t f 2 f 701 "701 700" 100 0 0 100 foo bar )); +DATA(insert OID = 286 ( float84mi PGUID 11 f t f 2 f 701 "701 700" 100 0 0 100 foo bar )); + +DATA(insert OID = 287 ( float4eq PGUID 11 f t f 2 f 16 "700 700" 100 0 0 100 foo bar )); +DATA(insert OID = 288 ( float4ne PGUID 11 f t f 2 f 16 "700 700" 100 0 0 100 foo bar )); +DATA(insert OID = 289 ( float4lt PGUID 11 f t f 2 f 16 "700 700" 100 0 0 100 foo bar )); +DATA(insert OID = 290 ( float4le PGUID 11 f t f 2 f 16 "700 700" 100 0 0 100 foo bar )); +DATA(insert OID = 291 ( float4gt PGUID 11 f t f 2 f 16 "700 700" 100 0 0 100 foo bar )); +DATA(insert OID = 292 ( float4ge PGUID 11 f t f 2 f 16 "700 700" 100 0 0 100 foo bar )); + +DATA(insert OID = 293 ( float8eq PGUID 11 f t f 2 f 16 "701 701" 100 0 0 100 foo bar )); +DATA(insert OID = 294 ( float8ne PGUID 11 f t f 2 f 16 "701 701" 100 0 0 100 foo bar )); +DATA(insert OID = 295 ( float8lt PGUID 11 f t f 2 f 16 "701 701" 100 0 0 100 foo bar )); +DATA(insert OID = 296 ( float8le PGUID 11 f t f 2 f 16 "701 701" 100 0 0 100 foo bar )); +DATA(insert OID = 297 ( float8gt PGUID 11 f t f 2 f 16 "701 701" 100 0 0 100 foo bar )); +DATA(insert OID = 298 ( float8ge PGUID 11 f t f 2 f 16 "701 701" 100 0 0 100 foo bar )); + +DATA(insert OID = 299 ( float48eq PGUID 11 f t f 2 f 16 "700 701" 100 0 0 100 foo bar )); + +/* OIDS 300 - 399 */ + +DATA(insert OID = 300 ( float48ne PGUID 11 f t f 2 f 16 "700 701" 100 0 0 100 foo bar )); +DATA(insert OID = 301 ( float48lt PGUID 11 f t f 2 f 16 "700 701" 100 0 0 100 foo bar )); +DATA(insert OID = 302 ( float48le PGUID 11 f t f 2 f 16 "700 701" 100 0 0 100 foo bar )); +DATA(insert OID = 303 ( float48gt PGUID 11 f t f 2 f 16 "700 701" 100 0 0 100 foo bar )); +DATA(insert OID = 304 ( float48ge PGUID 11 f t f 2 f 16 "700 701" 100 0 0 100 foo bar )); +DATA(insert OID = 305 ( float84eq PGUID 11 f t f 2 f 16 "701 700" 100 0 0 100 foo bar )); +DATA(insert OID = 306 ( float84ne PGUID 11 f t f 2 f 16 "701 700" 100 0 0 100 foo bar )); +DATA(insert OID = 307 ( float84lt PGUID 11 f t f 2 f 16 "701 700" 100 0 0 100 foo bar )); +DATA(insert OID = 308 ( float84le PGUID 11 f t f 2 f 16 "701 700" 100 0 0 100 foo bar )); +DATA(insert OID = 309 ( float84gt PGUID 11 f t f 2 f 16 "701 700" 100 0 0 100 foo bar )); +DATA(insert OID = 310 ( float84ge PGUID 11 f t f 2 f 16 "701 700" 100 0 0 100 foo bar )); + +DATA(insert OID = 311 ( ftod PGUID 11 f t f 2 f 701 "700" 100 0 0 100 foo bar )); +DATA(insert OID = 312 ( dtof PGUID 11 f t f 2 f 700 "701" 100 0 0 100 foo bar )); +DATA(insert OID = 313 ( i2toi4 PGUID 11 f t f 2 f 23 "21" 100 0 0 100 foo bar )); +DATA(insert OID = 314 ( i4toi2 PGUID 11 f t f 2 f 21 "23" 100 0 0 100 foo bar )); +DATA(insert OID = 315 ( keyfirsteq PGUID 11 f t f 2 f 16 "0 21" 100 0 0 100 foo bar )); + +DATA(insert OID = 320 ( rtinsert PGUID 11 f t f 4 f 23 "0" 100 0 0 100 foo bar )); +DATA(insert OID = 321 ( rtdelete PGUID 11 f t f 2 f 23 "0" 100 0 0 100 foo bar )); +DATA(insert OID = 322 ( rtgettuple PGUID 11 f t f 2 f 23 "0" 100 0 0 100 foo bar )); +DATA(insert OID = 323 ( rtbuild PGUID 11 f t f 9 f 23 "0" 100 0 0 100 foo bar )); +DATA(insert OID = 324 ( rtbeginscan PGUID 11 f t f 4 f 23 "0" 100 0 0 100 foo bar )); +DATA(insert OID = 325 ( rtendscan PGUID 11 f t f 1 f 23 "0" 100 0 0 100 foo bar )); +DATA(insert OID = 326 ( rtmarkpos PGUID 11 f t f 1 f 23 "0" 100 0 0 100 foo bar )); +DATA(insert OID = 327 ( rtrestrpos PGUID 11 f t f 1 f 23 "0" 100 0 0 100 foo bar )); +DATA(insert OID = 328 ( rtrescan PGUID 11 f t f 3 f 23 "0" 100 0 0 100 foo bar )); + +DATA(insert OID = 330 ( btgettuple PGUID 11 f t f 2 f 23 "0" 100 0 0 100 foo bar )); +DATA(insert OID = 331 ( btinsert PGUID 11 f t f 4 f 23 "0" 100 0 0 100 foo bar )); +DATA(insert OID = 332 ( btdelete PGUID 11 f t f 2 f 23 "0" 100 0 0 100 foo bar )); +DATA(insert OID = 333 ( btbeginscan PGUID 11 f t f 4 f 23 "0" 100 0 0 100 foo bar )); +DATA(insert OID = 334 ( btrescan PGUID 11 f t f 3 f 23 "0" 100 0 0 100 foo bar )); +DATA(insert OID = 335 ( btendscan PGUID 11 f t f 1 f 23 "0" 100 0 0 100 foo bar )); +DATA(insert OID = 336 ( btmarkpos PGUID 11 f t f 1 f 23 "0" 100 0 0 100 foo bar )); +DATA(insert OID = 337 ( btrestrpos PGUID 11 f t f 1 f 23 "0" 100 0 0 100 foo bar )); +DATA(insert OID = 338 ( btbuild PGUID 11 f t f 9 f 23 "0" 100 0 0 100 foo bar )); +DATA(insert OID = 339 ( poly_same PGUID 11 f t f 2 f 16 "604 604" 100 0 1 0 foo bar )); +DATA(insert OID = 340 ( poly_contain PGUID 11 f t f 2 f 16 "604 604" 100 0 1 0 foo bar )); +DATA(insert OID = 341 ( poly_left PGUID 11 f t f 2 f 16 "604 604" 100 0 1 0 foo bar )); +DATA(insert OID = 342 ( poly_overleft PGUID 11 f t f 2 f 16 "604 604" 100 0 1 0 foo bar )); +DATA(insert OID = 343 ( poly_overright PGUID 11 f t f 2 f 16 "604 604" 100 0 1 0 foo bar )); +DATA(insert OID = 344 ( poly_right PGUID 11 f t f 2 f 16 "604 604" 100 0 1 0 foo bar )); +DATA(insert OID = 345 ( poly_contained PGUID 11 f t f 2 f 16 "604 604" 100 0 1 0 foo bar )); +DATA(insert OID = 346 ( poly_overlap PGUID 11 f t f 2 f 16 "604 604" 100 0 1 0 foo bar )); +DATA(insert OID = 347 ( poly_in PGUID 11 f t f 1 f 604 "0" 100 0 1 0 foo bar )); +DATA(insert OID = 348 ( poly_out PGUID 11 f t f 1 f 23 "0" 100 0 1 0 foo bar )); + +DATA(insert OID = 350 ( btint2cmp PGUID 11 f t f 2 f 23 "21 21" 100 0 0 100 foo bar )); +DATA(insert OID = 351 ( btint4cmp PGUID 11 f t f 2 f 23 "23 23" 100 0 0 100 foo bar )); +DATA(insert OID = 352 ( btint42cmp PGUID 11 f t f 2 f 23 "23 21" 100 0 0 100 foo bar )); +DATA(insert OID = 353 ( btint24cmp PGUID 11 f t f 2 f 23 "21 23" 100 0 0 100 foo bar )); +DATA(insert OID = 354 ( btfloat4cmp PGUID 11 f t f 2 f 23 "700 700" 100 0 0 100 foo bar )); +DATA(insert OID = 355 ( btfloat8cmp PGUID 11 f t f 2 f 23 "701 701" 100 0 0 100 foo bar )); +DATA(insert OID = 356 ( btoidcmp PGUID 11 f t f 2 f 23 "26 26" 100 0 0 100 foo bar )); +DATA(insert OID = 357 ( btabstimecmp PGUID 11 f t f 2 f 23 "702 702" 100 0 0 100 foo bar )); +DATA(insert OID = 358 ( btcharcmp PGUID 11 f t f 2 f 23 "18 18" 100 0 0 100 foo bar )); +DATA(insert OID = 359 ( btnamecmp PGUID 11 f t f 2 f 23 "19 19" 100 0 0 100 foo bar )); +DATA(insert OID = 360 ( bttextcmp PGUID 11 f t f 2 f 23 "25 25" 100 0 0 100 foo bar )); + +DATA(insert OID = 361 ( lseg_distance PGUID 11 f t f 2 f 701 "601 601" 100 0 0 100 foo bar )); +DATA(insert OID = 362 ( lseg_interpt PGUID 11 f t f 2 f 600 "601 601" 100 0 0 100 foo bar )); +DATA(insert OID = 363 ( dist_ps PGUID 11 f t f 2 f 701 "600 601" 100 0 0 100 foo bar )); +DATA(insert OID = 364 ( dist_pb PGUID 11 f t f 2 f 701 "600 603" 100 0 0 100 foo bar )); +DATA(insert OID = 365 ( dist_sb PGUID 11 f t f 2 f 701 "601 603" 100 0 0 100 foo bar )); +DATA(insert OID = 366 ( close_ps PGUID 11 f t f 2 f 600 "600 601" 100 0 0 100 foo bar )); +DATA(insert OID = 367 ( close_pb PGUID 11 f t f 2 f 600 "600 603" 100 0 0 100 foo bar )); +DATA(insert OID = 368 ( close_sb PGUID 11 f t f 2 f 600 "601 603" 100 0 0 100 foo bar )); +DATA(insert OID = 369 ( on_ps PGUID 11 f t f 2 f 16 "600 601" 100 0 0 100 foo bar )); +DATA(insert OID = 370 ( path_distance PGUID 11 f t f 2 f 701 "602 602" 100 0 1 0 foo bar )); +DATA(insert OID = 371 ( dist_ppth PGUID 11 f t f 2 f 701 "600 602" 100 0 1 0 foo bar )); +DATA(insert OID = 372 ( on_sb PGUID 11 f t f 2 f 16 "601 603" 100 0 0 100 foo bar )); +DATA(insert OID = 373 ( inter_sb PGUID 11 f t f 2 f 16 "601 603" 100 0 0 100 foo bar )); +DATA(insert OID = 374 ( btchar16cmp PGUID 11 f t f 2 f 23 "19 19" 100 0 0 100 foo bar )); + +/* OIDS 400 - 499 */ + +DATA(insert OID = 438 ( hashsel PGUID 11 f t t 7 f 701 "26 26 21 0 23 23 26" 100 0 0 100 foo bar )); +DATA(insert OID = 439 ( hashnpage PGUID 11 f t t 7 f 701 "26 26 21 0 23 23 26" 100 0 0 100 foo bar )); + +DATA(insert OID = 440 ( hashgettuple PGUID 11 f t f 2 f 23 "0" 100 0 0 100 foo bar )); +DATA(insert OID = 441 ( hashinsert PGUID 11 f t f 4 f 23 "0" 100 0 0 100 foo bar )); +DATA(insert OID = 442 ( hashdelete PGUID 11 f t f 2 f 23 "0" 100 0 0 100 foo bar )); +DATA(insert OID = 443 ( hashbeginscan PGUID 11 f t f 4 f 23 "0" 100 0 0 100 foo bar )); +DATA(insert OID = 444 ( hashrescan PGUID 11 f t f 3 f 23 "0" 100 0 0 100 foo bar )); +DATA(insert OID = 445 ( hashendscan PGUID 11 f t f 1 f 23 "0" 100 0 0 100 foo bar )); +DATA(insert OID = 446 ( hashmarkpos PGUID 11 f t f 1 f 23 "0" 100 0 0 100 foo bar )); +DATA(insert OID = 447 ( hashrestrpos PGUID 11 f t f 1 f 23 "0" 100 0 0 100 foo bar )); +DATA(insert OID = 448 ( hashbuild PGUID 11 f t f 9 f 23 "0" 100 0 0 100 foo bar )); +DATA(insert OID = 449 ( hashint2 PGUID 11 f t f 2 f 23 "21 21" 100 0 0 100 foo bar )); +DATA(insert OID = 450 ( hashint4 PGUID 11 f t f 2 f 23 "23 23" 100 0 0 100 foo bar )); +DATA(insert OID = 451 ( hashfloat4 PGUID 11 f t f 2 f 23 "700 700" 100 0 0 100 foo bar )); +DATA(insert OID = 452 ( hashfloat8 PGUID 11 f t f 2 f 23 "701 701" 100 0 0 100 foo bar )); +DATA(insert OID = 453 ( hashoid PGUID 11 f t f 2 f 23 "26 26" 100 0 0 100 foo bar )); +DATA(insert OID = 454 ( hashchar PGUID 11 f t f 2 f 23 "18 18" 100 0 0 100 foo bar )); +DATA(insert OID = 455 ( hashname PGUID 11 f t f 2 f 23 "19 19" 100 0 0 100 foo bar )); +DATA(insert OID = 456 ( hashtext PGUID 11 f t f 2 f 23 "25 25" 100 0 0 100 foo bar )); +DATA(insert OID = 466 ( char2in PGUID 11 f t f 1 f 409 "0" 100 0 0 100 foo bar )); +DATA(insert OID = 467 ( char4in PGUID 11 f t f 1 f 410 "0" 100 0 0 100 foo bar )); +DATA(insert OID = 468 ( char8in PGUID 11 f t f 1 f 411 "0" 100 0 0 100 foo bar )); +DATA(insert OID = 469 ( char2out PGUID 11 f t f 1 f 23 "0" 100 0 0 100 foo bar )); +DATA(insert OID = 470 ( char4out PGUID 11 f t f 1 f 23 "0" 100 0 0 100 foo bar )); +DATA(insert OID = 471 ( char8out PGUID 11 f t f 1 f 23 "0" 100 0 0 100 foo bar )); +DATA(insert OID = 472 ( char2eq PGUID 11 f t f 2 f 16 "409 409" 100 0 0 100 foo bar )); +DATA(insert OID = 473 ( char4eq PGUID 11 f t f 2 f 16 "410 410" 100 0 0 100 foo bar )); +DATA(insert OID = 474 ( char8eq PGUID 11 f t f 2 f 16 "411 411" 100 0 0 100 foo bar )); +DATA(insert OID = 475 ( char2lt PGUID 11 f t f 2 f 16 "409 409" 100 0 0 100 foo bar )); +DATA(insert OID = 476 ( char4lt PGUID 11 f t f 2 f 16 "410 410" 100 0 0 100 foo bar )); +DATA(insert OID = 477 ( char8lt PGUID 11 f t f 2 f 16 "411 411" 100 0 0 100 foo bar )); +DATA(insert OID = 478 ( char2le PGUID 11 f t f 2 f 16 "409 409" 100 0 0 100 foo bar )); +DATA(insert OID = 479 ( char4le PGUID 11 f t f 2 f 16 "410 410" 100 0 0 100 foo bar )); +DATA(insert OID = 480 ( char8le PGUID 11 f t f 2 f 16 "411 411" 100 0 0 100 foo bar )); +DATA(insert OID = 481 ( char2gt PGUID 11 f t f 2 f 16 "409 409" 100 0 0 100 foo bar )); +DATA(insert OID = 482 ( char4gt PGUID 11 f t f 2 f 16 "410 410" 100 0 0 100 foo bar )); +DATA(insert OID = 483 ( char8gt PGUID 11 f t f 2 f 16 "411 411" 100 0 0 100 foo bar )); +DATA(insert OID = 484 ( char2ge PGUID 11 f t f 2 f 16 "409 409" 100 0 0 100 foo bar )); +DATA(insert OID = 490 ( char16eq PGUID 11 f t f 2 f 16 "19 19" 100 0 0 100 foo bar )); +#define Character16EqualRegProcedure 490 +DATA(insert OID = 492 ( char16lt PGUID 11 f t f 2 f 16 "19 19" 100 0 0 100 foo bar )); +DATA(insert OID = 493 ( char16le PGUID 11 f t f 2 f 16 "19 19" 100 0 0 100 foo bar )); +DATA(insert OID = 494 ( char16gt PGUID 11 f t f 2 f 16 "19 19" 100 0 0 100 foo bar )); +DATA(insert OID = 495 ( char16ge PGUID 11 f t f 2 f 16 "19 19" 100 0 0 100 foo bar )); +DATA(insert OID = 496 ( char16ne PGUID 11 f t f 2 f 16 "19 19" 100 0 0 100 foo bar )); + +DATA(insert OID = 499 ( hashchar16 PGUID 11 f t f 2 f 23 "19 19" 100 0 0 100 foo bar )); + +/* OIDS 500 - 599 */ + +/* OIDS 600 - 699 */ + +DATA(insert OID = 650 ( int4notin PGUID 11 f t f 2 f 16 "21 0" 100 0 0 100 foo bar )); +DATA(insert OID = 651 ( oidnotin PGUID 11 f t f 2 f 16 "26 0" 100 0 0 100 foo bar )); +DATA(insert OID = 652 ( int44in PGUID 11 f t f 1 f 22 "0" 100 0 0 100 foo bar )); +DATA(insert OID = 653 ( int44out PGUID 11 f t f 1 f 23 "0" 100 0 0 100 foo bar )); +DATA(insert OID = 655 ( namelt PGUID 11 f t f 2 f 16 "19 19" 100 0 0 100 foo bar )); +DATA(insert OID = 656 ( namele PGUID 11 f t f 2 f 16 "19 19" 100 0 0 100 foo bar )); +DATA(insert OID = 657 ( namegt PGUID 11 f t f 2 f 16 "19 19" 100 0 0 100 foo bar )); +DATA(insert OID = 658 ( namege PGUID 11 f t f 2 f 16 "19 19" 100 0 0 100 foo bar )); +DATA(insert OID = 659 ( namene PGUID 11 f t f 2 f 16 "19 19" 100 0 0 100 foo bar )); +DATA(insert OID = 682 ( mktinterval PGUID 11 f t f 2 f 704 "702 702" 100 0 0 100 foo bar )); +DATA(insert OID = 683 ( oid8eq PGUID 11 f t f 2 f 16 "30 30" 100 0 0 100 foo bar )); +DATA(insert OID = 684 ( char4ge PGUID 11 f t f 2 f 16 "410 410" 100 0 0 100 foo bar )); +DATA(insert OID = 685 ( char8ge PGUID 11 f t f 2 f 16 "411 411" 100 0 0 100 foo bar )); +DATA(insert OID = 686 ( char2ne PGUID 11 f t f 2 f 16 "409 409" 100 0 0 100 foo bar )); +DATA(insert OID = 687 ( char4ne PGUID 11 f t f 2 f 16 "410 410" 100 0 0 100 foo bar )); +DATA(insert OID = 688 ( char8ne PGUID 11 f t f 2 f 16 "411 411" 100 0 0 100 foo bar )); +DATA(insert OID = 689 ( btchar2cmp PGUID 11 f t f 2 f 23 "409 409" 100 0 0 100 foo bar )); +DATA(insert OID = 690 ( btchar4cmp PGUID 11 f t f 2 f 23 "410 410" 100 0 0 100 foo bar )); +DATA(insert OID = 691 ( btchar8cmp PGUID 11 f t f 2 f 23 "411 411" 100 0 0 100 foo bar )); +DATA(insert OID = 692 ( hashchar2 PGUID 11 f t f 2 f 23 "409 409" 100 0 0 100 foo bar )); +DATA(insert OID = 693 ( hashchar4 PGUID 11 f t f 2 f 23 "410 410" 100 0 0 100 foo bar )); +DATA(insert OID = 694 ( hashchar8 PGUID 11 f t f 2 f 23 "411 411" 100 0 0 100 foo bar )); +DATA(insert OID = 695 ( char8regexeq PGUID 11 f t f 2 f 16 "411 25" 100 0 0 100 foo bar )); +DATA(insert OID = 696 ( char8regexne PGUID 11 f t f 2 f 16 "411 25" 100 0 0 100 foo bar )); +DATA(insert OID = 699 ( char2regexeq PGUID 11 f t f 2 f 16 "409 25" 100 0 0 100 foo bar )); + +/* OIDS 700 - 799 */ +DATA(insert OID = 700 ( char16regexeq PGUID 11 f t f 2 f 16 "19 25" 100 0 0 100 foo bar )); +DATA(insert OID = 701 ( char16regexne PGUID 11 f t f 2 f 16 "19 25" 100 0 0 100 foo bar )); + +DATA(insert OID = 710 ( GetPgUserName PGUID 11 f t f 0 f 19 "0" 100 0 0 100 foo bar )); +DATA(insert OID = 711 ( userfntest PGUID 11 f t f 1 f 23 "23" 100 0 0 100 foo bar )); +DATA(insert OID = 713 ( oidrand PGUID 11 f t f 2 f 16 "26 23" 100 0 0 100 foo bar )); +DATA(insert OID = 715 ( oidsrand PGUID 11 f t f 1 f 16 "23" 100 0 0 100 foo bar )); +DATA(insert OID = 716 ( oideqint4 PGUID 11 f t f 2 f 16 "26 23" 100 0 0 100 foo bar )); +DATA(insert OID = 717 ( int4eqoid PGUID 11 f t f 2 f 16 "23 26" 100 0 0 100 foo bar )); + + +DATA(insert OID = 720 ( byteaGetSize PGUID 11 f t f 1 f 23 "17" 100 0 0 100 foo bar )); +DATA(insert OID = 721 ( byteaGetByte PGUID 11 f t f 2 f 23 "17 23" 100 0 0 100 foo bar )); +DATA(insert OID = 722 ( byteaSetByte PGUID 11 f t f 3 f 17 "17 23 23" 100 0 0 100 foo bar )); +DATA(insert OID = 723 ( byteaGetBit PGUID 11 f t f 2 f 23 "17 23" 100 0 0 100 foo bar )); +DATA(insert OID = 724 ( byteaSetBit PGUID 11 f t f 3 f 17 "17 23 23" 100 0 0 100 foo bar )); + +DATA(insert OID = 730 ( pqtest PGUID 11 f t f 1 f 23 "25" 100 0 0 100 foo bar )); + +DATA(insert OID = 740 ( text_lt PGUID 11 f t f 2 f 16 "25 25" 100 0 0 0 foo bar )); +DATA(insert OID = 741 ( text_le PGUID 11 f t f 2 f 16 "25 25" 100 0 0 0 foo bar )); +DATA(insert OID = 742 ( text_gt PGUID 11 f t f 2 f 16 "25 25" 100 0 0 0 foo bar )); +DATA(insert OID = 743 ( text_ge PGUID 11 f t f 2 f 16 "25 25" 100 0 0 0 foo bar )); + +DATA(insert OID = 744 ( array_eq PGUID 11 f t f 2 f 16 "0 0" 100 0 0 100 foo bar)); +DATA(insert OID = 745 ( array_assgn PGUID 11 f t f 8 f 23 "0 23 0 0 0 23 23 0" 100 0 0 100 foo bar)); +DATA(insert OID = 746 ( array_clip PGUID 11 f t f 7 f 23 "0 23 0 0 23 23 0" 100 0 0 100 foo bar)); +DATA(insert OID = 747 ( array_dims PGUID 11 f t f 1 f 25 "0" 100 0 0 100 foo bar)); +DATA(insert OID = 748 ( array_set PGUID 11 f t f 8 f 23 "0 23 0 0 23 23 23 0" 100 0 0 100 foo bar)); +DATA(insert OID = 749 ( array_ref PGUID 11 f t f 7 f 23 "0 23 0 23 23 23 0" 100 0 0 100 foo bar)); +DATA(insert OID = 750 ( array_in PGUID 11 f t f 2 f 23 "0 0" 100 0 0 100 foo bar )); +DATA(insert OID = 751 ( array_out PGUID 11 f t f 2 f 23 "0 0" 100 0 0 100 foo bar )); + +DATA(insert OID = 752 ( filename_in PGUID 11 f t f 2 f 605 "0" 100 0 0 100 foo bar )); +DATA(insert OID = 753 ( filename_out PGUID 11 f t f 2 f 19 "0" 100 0 0 100 foo bar )); + +DATA(insert OID = 760 ( smgrin PGUID 11 f t f 1 f 210 "0" 100 0 0 100 foo bar )); +DATA(insert OID = 761 ( smgrout PGUID 11 f t f 1 f 23 "0" 100 0 0 100 foo bar )); +DATA(insert OID = 762 ( smgreq PGUID 11 f t f 2 f 16 "210 210" 100 0 0 100 foo bar )); +DATA(insert OID = 763 ( smgrne PGUID 11 f t f 2 f 16 "210 210" 100 0 0 100 foo bar )); + +DATA(insert OID = 764 ( lo_import PGUID 11 f t f 1 f 26 "25" 100 0 0 100 foo bar )); +DATA(insert OID = 765 ( lo_export PGUID 11 f t f 2 f 23 "26 25" 100 0 0 100 foo bar )); + +DATA(insert OID = 766 ( int4inc PGUID 11 f t f 1 f 23 "23" 100 0 0 100 foo bar )); +DATA(insert OID = 767 ( int2inc PGUID 11 f t f 1 f 21 "21" 100 0 0 100 foo bar )); +DATA(insert OID = 768 ( int4larger PGUID 11 f t f 2 f 23 "23 23" 100 0 0 100 foo bar )); +DATA(insert OID = 769 ( int4smaller PGUID 11 f t f 2 f 23 "23 23" 100 0 0 100 foo bar )); +DATA(insert OID = 770 ( int2larger PGUID 11 f t f 2 f 23 "21 21" 100 0 0 100 foo bar )); +DATA(insert OID = 771 ( int2smaller PGUID 11 f t f 2 f 23 "21 21" 100 0 0 100 foo bar )); +DATA(insert OID = 772 ( gistsel PGUID 11 f t t 7 f 701 "26 26 21 0 23 23 26" 100 0 0 100 foo bar )); +DATA(insert OID = 773 ( gistnpage PGUID 11 f t t 7 f 701 "26 26 21 0 23 23 26" 100 0 0 100 foo bar )); +DATA(insert OID = 774 ( gistgettuple PGUID 11 f t f 2 f 23 "0" 100 0 0 100 foo bar )); +DATA(insert OID = 775 ( gistinsert PGUID 11 f t f 4 f 23 "0" 100 0 0 100 foo bar )); +DATA(insert OID = 776 ( gistdelete PGUID 11 f t f 2 f 23 "0" 100 0 0 100 foo bar )); +DATA(insert OID = 777 ( gistbeginscan PGUID 11 f t f 4 f 23 "0" 100 0 0 100 foo bar )); +DATA(insert OID = 778 ( gistrescan PGUID 11 f t f 3 f 23 "0" 100 0 0 100 foo bar )); +DATA(insert OID = 779 ( gistendscan PGUID 11 f t f 1 f 23 "0" 100 0 0 100 foo bar )); +DATA(insert OID = 780 ( gistmarkpos PGUID 11 f t f 1 f 23 "0" 100 0 0 100 foo bar )); +DATA(insert OID = 781 ( gistrestrpos PGUID 11 f t f 1 f 23 "0" 100 0 0 100 foo bar )); +DATA(insert OID = 782 ( gistbuild PGUID 11 f t f 9 f 23 "0" 100 0 0 100 foo bar )); + +/* OIDS 800 - 899 */ +DATA(insert OID = 820 ( oidint2in PGUID 11 f t f 1 f 810 "0" 100 0 0 100 foo bar)); +DATA(insert OID = 821 ( oidint2out PGUID 11 f t f 1 f 19 "0" 100 0 0 100 foo bar)); +DATA(insert OID = 822 ( oidint2lt PGUID 11 f t f 2 f 16 "810 810" 100 0 0 100 foo bar)); +DATA(insert OID = 823 ( oidint2le PGUID 11 f t f 2 f 16 "810 810" 100 0 0 100 foo bar)); +DATA(insert OID = 824 ( oidint2eq PGUID 11 f t f 2 f 16 "810 810" 100 0 0 100 foo bar)); + +#define OidInt2EqRegProcedure 824 + +DATA(insert OID = 825 ( oidint2ge PGUID 11 f t f 2 f 16 "810 810" 100 0 0 100 foo bar)); +DATA(insert OID = 826 ( oidint2gt PGUID 11 f t f 2 f 16 "810 810" 100 0 0 100 foo bar)); +DATA(insert OID = 827 ( oidint2ne PGUID 11 f t f 2 f 16 "810 810" 100 0 0 100 foo bar)); +DATA(insert OID = 828 ( oidint2cmp PGUID 11 f t f 2 f 21 "810 810" 100 0 0 100 foo bar)); +DATA(insert OID = 829 ( mkoidint2 PGUID 11 f t f 2 f 810 "26 21" 100 0 0 100 foo bar)); + +DATA(insert OID = 837 ( char2regexne PGUID 11 f t f 2 f 16 "409 25" 100 0 0 100 foo bar )); +DATA(insert OID = 836 ( char4regexeq PGUID 11 f t f 2 f 16 "410 25" 100 0 0 100 foo bar )); +DATA(insert OID = 838 ( char4regexne PGUID 11 f t f 2 f 16 "410 25" 100 0 0 100 foo bar )); + +DATA(insert OID = 850 ( textlike PGUID 11 f t f 2 f 16 "25 25" 100 0 1 0 foo bar )); +DATA(insert OID = 851 ( textnlike PGUID 11 f t f 2 f 16 "25 25" 100 0 1 0 foo bar )); +DATA(insert OID = 852 ( char2like PGUID 11 f t f 2 f 16 "409 25" 100 0 0 100 foo bar )); +DATA(insert OID = 853 ( char2nlike PGUID 11 f t f 2 f 16 "409 25" 100 0 0 100 foo bar )); +DATA(insert OID = 854 ( char4like PGUID 11 f t f 2 f 16 "410 25" 100 0 0 100 foo bar )); +DATA(insert OID = 855 ( char4nlike PGUID 11 f t f 2 f 16 "410 25" 100 0 0 100 foo bar )); +DATA(insert OID = 856 ( char8like PGUID 11 f t f 2 f 16 "411 25" 100 0 0 100 foo bar )); +DATA(insert OID = 857 ( char8nlike PGUID 11 f t f 2 f 16 "411 25" 100 0 0 100 foo bar )); +DATA(insert OID = 858 ( namelike PGUID 11 f t f 2 f 16 "19 25" 100 0 0 100 foo bar )); +DATA(insert OID = 859 ( namenlike PGUID 11 f t f 2 f 16 "19 25" 100 0 0 100 foo bar )); +DATA(insert OID = 860 ( char16like PGUID 11 f t f 2 f 16 "20 25" 100 0 0 100 foo bar )); +DATA(insert OID = 861 ( char16nlike PGUID 11 f t f 2 f 16 "20 25" 100 0 0 100 foo bar )); + +/* OIDS 900 - 999 */ + +DATA(insert OID = 920 ( oidint4in PGUID 11 f t f 1 f 910 "0" 100 0 0 100 foo bar)); +DATA(insert OID = 921 ( oidint4out PGUID 11 f t f 1 f 19 "0" 100 0 0 100 foo bar)); +DATA(insert OID = 922 ( oidint4lt PGUID 11 f t f 2 f 16 "910 910" 100 0 0 100 foo bar)); +DATA(insert OID = 923 ( oidint4le PGUID 11 f t f 2 f 16 "910 910" 100 0 0 100 foo bar)); +DATA(insert OID = 924 ( oidint4eq PGUID 11 f t f 2 f 16 "910 910" 100 0 0 100 foo bar)); + +#define OidInt4EqRegProcedure 924 + +DATA(insert OID = 925 ( oidint4ge PGUID 11 f t f 2 f 16 "910 910" 100 0 0 100 foo bar)); +DATA(insert OID = 926 ( oidint4gt PGUID 11 f t f 2 f 16 "910 910" 100 0 0 100 foo bar)); +DATA(insert OID = 927 ( oidint4ne PGUID 11 f t f 2 f 16 "910 910" 100 0 0 100 foo bar)); +DATA(insert OID = 928 ( oidint4cmp PGUID 11 f t f 2 f 23 "910 910" 100 0 0 100 foo bar)); +DATA(insert OID = 929 ( mkoidint4 PGUID 11 f t f 2 f 910 "26 23" 100 0 0 100 foo bar)); + +DATA(insert OID = 940 ( oidnamein PGUID 11 f t f 1 f 911 "0" 100 0 0 100 foo bar)); +DATA(insert OID = 941 ( oidnameout PGUID 11 f t f 1 f 19 "0" 100 0 0 100 foo bar)); +DATA(insert OID = 942 ( oidnamelt PGUID 11 f t f 2 f 16 "911 911" 100 0 0 100 foo bar)); +DATA(insert OID = 943 ( oidnamele PGUID 11 f t f 2 f 16 "911 911" 100 0 0 100 foo bar)); +DATA(insert OID = 944 ( oidnameeq PGUID 11 f t f 2 f 16 "911 911" 100 0 0 100 foo bar)); + +#define OidNameEqRegProcedure 944 + +DATA(insert OID = 945 ( oidnamege PGUID 11 f t f 2 f 16 "911 911" 100 0 0 100 foo bar)); +DATA(insert OID = 946 ( oidnamegt PGUID 11 f t f 2 f 16 "911 911" 100 0 0 100 foo bar)); +DATA(insert OID = 947 ( oidnamene PGUID 11 f t f 2 f 16 "911 911" 100 0 0 100 foo bar)); +DATA(insert OID = 948 ( oidnamecmp PGUID 11 f t f 2 f 23 "911 911" 100 0 0 100 foo bar)); +DATA(insert OID = 949 ( mkoidname PGUID 11 f t f 2 f 911 "26 19" 100 0 0 100 foo bar)); + +DATA(insert OID = 952 ( lo_open PGUID 11 f t f 2 f 23 "26 23" 100 0 0 100 foo bar )); +DATA(insert OID = 953 ( lo_close PGUID 11 f t f 1 f 23 "23" 100 0 0 100 foo bar )); +DATA(insert OID = 954 ( LOread PGUID 11 f t f 2 f 17 "23 23" 100 0 0 100 foo bar )); +DATA(insert OID = 955 ( LOwrite PGUID 11 f t f 2 f 23 "23 17" 100 0 0 100 foo bar )); +DATA(insert OID = 956 ( lo_lseek PGUID 11 f t f 3 f 23 "23 23 23" 100 0 0 100 foo bar )); +DATA(insert OID = 957 ( lo_creat PGUID 11 f t f 1 f 26 "23" 100 0 0 100 foo bar )); +DATA(insert OID = 958 ( lo_tell PGUID 11 f t f 1 f 23 "23" 100 0 0 100 foo bar )); +DATA(insert OID = 964 ( lo_unlink PGUID 11 f t f 1 f 23 "23" 100 0 0 100 foo bar )); + +DATA(insert OID = 972 ( RegprocToOid PGUID 11 f t f 1 f 26 "24" 100 0 0 100 foo bar )); + +DATA(insert OID = 973 ( path_inter PGUID 11 f t f 2 f 16 "602 602" 100 0 10 100 foo bar )); +DATA(insert OID = 974 ( box_copy PGUID 11 f t f 1 f 603 "603" 100 0 0 100 foo bar )); +DATA(insert OID = 975 ( box_area PGUID 11 f t f 1 f 701 "603" 100 0 0 100 foo bar )); +DATA(insert OID = 976 ( box_length PGUID 11 f t f 1 f 701 "603" 100 0 0 100 foo bar )); +DATA(insert OID = 977 ( box_height PGUID 11 f t f 1 f 701 "603" 100 0 0 100 foo bar )); +DATA(insert OID = 978 ( box_distance PGUID 11 f t f 2 f 701 "603 603" 100 0 0 100 foo bar )); +DATA(insert OID = 980 ( box_intersect PGUID 11 f t f 2 f 603 "603 603" 100 0 0 100 foo bar )); +DATA(insert OID = 981 ( box_diagonal PGUID 11 f t f 1 f 601 "603" 100 0 0 100 foo bar )); +DATA(insert OID = 982 ( path_n_lt PGUID 11 f t f 2 f 16 "602 602" 100 0 0 100 foo bar )); +DATA(insert OID = 983 ( path_n_gt PGUID 11 f t f 2 f 16 "602 602" 100 0 0 100 foo bar )); +DATA(insert OID = 984 ( path_n_eq PGUID 11 f t f 2 f 16 "602 602" 100 0 0 100 foo bar )); +DATA(insert OID = 985 ( path_n_le PGUID 11 f t f 2 f 16 "602 602" 100 0 0 100 foo bar )); +DATA(insert OID = 986 ( path_n_ge PGUID 11 f t f 2 f 16 "602 602" 100 0 0 100 foo bar )); +DATA(insert OID = 987 ( path_length PGUID 11 f t f 1 f 701 "602" 100 0 1 0 foo bar )); +DATA(insert OID = 988 ( point_copy PGUID 11 f t f 1 f 600 "600" 100 0 0 100 foo bar )); +DATA(insert OID = 989 ( point_vert PGUID 11 f t f 2 f 16 "600 600" 100 0 0 100 foo bar )); +DATA(insert OID = 990 ( point_horiz PGUID 11 f t f 2 f 16 "600 600" 100 0 0 100 foo bar )); +DATA(insert OID = 991 ( point_distance PGUID 11 f t f 2 f 701 "600 600" 100 0 0 100 foo bar )); +DATA(insert OID = 992 ( point_slope PGUID 11 f t f 2 f 701 "600 600" 100 0 0 100 foo bar )); +DATA(insert OID = 993 ( lseg_construct PGUID 11 f t f 2 f 601 "600 600" 100 0 0 100 foo bar )); +DATA(insert OID = 994 ( lseg_intersect PGUID 11 f t f 2 f 16 "601 601" 100 0 0 100 foo bar )); +DATA(insert OID = 995 ( lseg_parallel PGUID 11 f t f 2 f 16 "601 601" 100 0 0 100 foo bar )); +DATA(insert OID = 996 ( lseg_perp PGUID 11 f t f 2 f 16 "601 601" 100 0 0 100 foo bar )); +DATA(insert OID = 997 ( lseg_vertical PGUID 11 f t f 1 f 16 "601" 100 0 0 100 foo bar )); +DATA(insert OID = 998 ( lseg_horizontal PGUID 11 f t f 1 f 16 "601" 100 0 0 100 foo bar )); +DATA(insert OID = 999 ( lseg_eq PGUID 11 f t f 2 f 16 "601 601" 100 0 0 100 foo bar )); + +/* OIDS 1000 - 1999 */ + +DATA(insert OID = 1029 ( NullValue PGUID 11 f t f 1 f 16 "0" 100 0 0 100 foo bar )); +DATA(insert OID = 1030 ( NonNullValue PGUID 11 f t f 1 f 16 "0" 100 0 0 100 foo bar )); +DATA(insert OID = 1031 ( aclitemin PGUID 11 f t f 1 f 1033 "0" 100 0 0 100 foo bar )); +DATA(insert OID = 1032 ( aclitemout PGUID 11 f t f 1 f 23 "0" 100 0 0 100 foo bar )); +DATA(insert OID = 1035 ( aclinsert PGUID 11 f t f 2 f 1034 "1034 1033" 100 0 0 100 foo bar )); +DATA(insert OID = 1036 ( aclremove PGUID 11 f t f 2 f 1034 "1034 1033" 100 0 0 100 foo bar )); +DATA(insert OID = 1037 ( aclcontains PGUID 11 f t f 2 f 16 "1034 1033" 100 0 0 100 foo bar )); +DATA(insert OID = 1038 ( seteval PGUID 11 f t f 1 f 23 "26" 100 0 0 100 foo bar )); +#define SetEvalRegProcedure 1038 + +DATA(insert OID = 1044 ( bpcharin PGUID 11 f t f 3 f 1042 "0" 100 0 0 100 foo bar )); +DATA(insert OID = 1045 ( bpcharout PGUID 11 f t f 1 f 23 "0" 100 0 0 100 foo bar )); +DATA(insert OID = 1046 ( varcharin PGUID 11 f t f 3 f 1043 "0" 100 0 0 100 foo bar )); +DATA(insert OID = 1047 ( varcharout PGUID 11 f t f 1 f 23 "0" 100 0 0 100 foo bar )); +DATA(insert OID = 1048 ( bpchareq PGUID 11 f t f 2 f 16 "1042 1042" 100 0 0 100 foo bar )); +DATA(insert OID = 1049 ( bpcharlt PGUID 11 f t f 2 f 16 "1042 1042" 100 0 0 100 foo bar )); +DATA(insert OID = 1050 ( bpcharle PGUID 11 f t f 2 f 16 "1042 1042" 100 0 0 100 foo bar )); +DATA(insert OID = 1051 ( bpchargt PGUID 11 f t f 2 f 16 "1042 1042" 100 0 0 100 foo bar )); +DATA(insert OID = 1052 ( bpcharge PGUID 11 f t f 2 f 16 "1042 1042" 100 0 0 100 foo bar )); +DATA(insert OID = 1053 ( bpcharne PGUID 11 f t f 2 f 16 "1042 1042" 100 0 0 100 foo bar )); +DATA(insert OID = 1070 ( varchareq PGUID 11 f t f 2 f 16 "1043 1043" 100 0 0 100 foo bar )); +DATA(insert OID = 1071 ( varcharlt PGUID 11 f t f 2 f 16 "1043 1043" 100 0 0 100 foo bar )); +DATA(insert OID = 1072 ( varcharle PGUID 11 f t f 2 f 16 "1043 1043" 100 0 0 100 foo bar )); +DATA(insert OID = 1073 ( varchargt PGUID 11 f t f 2 f 16 "1043 1043" 100 0 0 100 foo bar )); +DATA(insert OID = 1074 ( varcharge PGUID 11 f t f 2 f 16 "1043 1043" 100 0 0 100 foo bar )); +DATA(insert OID = 1075 ( varcharne PGUID 11 f t f 2 f 16 "1043 1043" 100 0 0 100 foo bar )); +DATA(insert OID = 1078 ( bpcharcmp PGUID 11 f t f 2 f 23 "1042 1042" 100 0 0 100 foo bar )); +DATA(insert OID = 1079 ( varcharcmp PGUID 11 f t f 2 f 23 "1043 1043" 100 0 0 100 foo bar )); +DATA(insert OID = 1080 ( hashbpchar PGUID 11 f t f 1 f 23 "1042" 100 0 0 100 foo bar )); +DATA(insert OID = 1081 ( hashvarchar PGUID 11 f t f 1 f 23 "1043" 100 0 0 100 foo bar )); + +DATA(insert OID = 1084 ( date_in PGUID 11 f t f 1 f 1082 "0" 100 0 0 100 foo bar )); +DATA(insert OID = 1085 ( date_out PGUID 11 f t f 1 f 23 "0" 100 0 0 100 foo bar )); +DATA(insert OID = 1086 ( date_eq PGUID 11 f t f 2 f 16 "1082 1082" 100 0 0 100 foo bar )); +DATA(insert OID = 1087 ( date_lt PGUID 11 f t f 2 f 16 "1082 1082" 100 0 0 100 foo bar )); +DATA(insert OID = 1088 ( date_le PGUID 11 f t f 2 f 16 "1082 1082" 100 0 0 100 foo bar )); +DATA(insert OID = 1089 ( date_gt PGUID 11 f t f 2 f 16 "1082 1082" 100 0 0 100 foo bar )); +DATA(insert OID = 1090 ( date_ge PGUID 11 f t f 2 f 16 "1082 1082" 100 0 0 100 foo bar )); +DATA(insert OID = 1091 ( date_ne PGUID 11 f t f 2 f 16 "1082 1082" 100 0 0 100 foo bar )); +DATA(insert OID = 1092 ( date_cmp PGUID 11 f t f 2 f 23 "1082 1082" 100 0 0 100 foo bar )); + +DATA(insert OID = 1099 ( time_in PGUID 11 f t f 1 f 1083 "0" 100 0 0 100 foo bar )); + +/* OIDS 1100 - 1199 */ +DATA(insert OID = 1100 ( time_out PGUID 11 f t f 1 f 23 "0" 100 0 0 100 foo bar )); +DATA(insert OID = 1101 ( time_eq PGUID 11 f t f 2 f 16 "1083 1083" 100 0 0 100 foo bar )); +DATA(insert OID = 1102 ( time_lt PGUID 11 f t f 2 f 16 "1083 1083" 100 0 0 100 foo bar )); +DATA(insert OID = 1103 ( time_le PGUID 11 f t f 2 f 16 "1083 1083" 100 0 0 100 foo bar )); +DATA(insert OID = 1104 ( time_gt PGUID 11 f t f 2 f 16 "1083 1083" 100 0 0 100 foo bar )); +DATA(insert OID = 1105 ( time_ge PGUID 11 f t f 2 f 16 "1083 1083" 100 0 0 100 foo bar )); +DATA(insert OID = 1106 ( time_ne PGUID 11 f t f 2 f 16 "1083 1083" 100 0 0 100 foo bar )); +DATA(insert OID = 1107 ( time_cmp PGUID 11 f t f 2 f 23 "1083 1083" 100 0 0 100 foo bar )); +DATA(insert OID = 1200 ( int42reltime PGUID 11 f t f 1 f 703 "21" 100 0 0 100 foo bar )); + +DATA(insert OID = 1230 ( char2icregexeq PGUID 11 f t f 2 f 16 "409 25" 100 0 0 100 foo bar )); +DATA(insert OID = 1231 ( char2icregexne PGUID 11 f t f 2 f 16 "409 25" 100 0 0 100 foo bar )); +DATA(insert OID = 1232 ( char4icregexeq PGUID 11 f t f 2 f 16 "410 25" 100 0 0 100 foo bar )); +DATA(insert OID = 1233 ( char4icregexne PGUID 11 f t f 2 f 16 "410 25" 100 0 0 100 foo bar )); +DATA(insert OID = 1234 ( char8icregexeq PGUID 11 f t f 2 f 16 "411 25" 100 0 0 100 foo bar )); +DATA(insert OID = 1235 ( char8icregexne PGUID 11 f t f 2 f 16 "411 25" 100 0 0 100 foo bar )); +DATA(insert OID = 1236 ( char16icregexeq PGUID 11 f t f 2 f 16 "20 25" 100 0 0 100 foo bar )); +DATA(insert OID = 1237 ( char16icregexne PGUID 11 f t f 2 f 16 "20 25" 100 0 0 100 foo bar )); +DATA(insert OID = 1238 ( texticregexeq PGUID 11 f t f 2 f 16 "25 25" 100 0 1 0 foo bar )); +DATA(insert OID = 1239 ( texticregexne PGUID 11 f t f 2 f 16 "25 25" 100 0 1 0 foo bar )); +DATA(insert OID = 1240 ( nameicregexeq PGUID 11 f t f 2 f 16 "19 25" 100 0 0 100 foo bar )); +DATA(insert OID = 1241 ( nameicregexne PGUID 11 f t f 2 f 16 "19 25" 100 0 0 100 foo bar )); + + +#include "nodes/pg_list.h" + +/* + * prototypes for functions pg_proc.c + */ +extern Oid ProcedureCreate(char* procedureName, + bool returnsSet, + char *returnTypeName, + char *languageName, + char *prosrc, + char *probin, + bool canCache, + bool trusted, + int32 byte_pct, + int32 perbyte_cpu, + int32 percall_cpu, + int32 outin_ratio, + List *argList, + CommandDest dest); + + +#endif /* PG_PROC_H */ diff --git a/src/include/catalog/pg_rewrite.h b/src/include/catalog/pg_rewrite.h new file mode 100644 index 0000000000..3d0c4260ec --- /dev/null +++ b/src/include/catalog/pg_rewrite.h @@ -0,0 +1,64 @@ +/*------------------------------------------------------------------------- + * + * pg_rewrite.h-- + * definition of the system "rewrite-rule" relation (pg_rewrite) + * along with the relation's initial contents. + * + * + * Copyright (c) 1994, Regents of the University of California + * + * $Id: pg_rewrite.h,v 1.1 1996/08/28 01:57:11 scrappy Exp $ + * + * NOTES + * the genbki.sh script reads this file and generates .bki + * information from the DATA() statements. + * + *------------------------------------------------------------------------- + */ +#ifndef PG_REWRITE_H +#define PG_REWRITE_H + +/* ---------------- + * postgres.h contains the system type definintions and the + * CATALOG(), BOOTSTRAP and DATA() sugar words so this file + * can be read by both genbki.sh and the C compiler. + * ---------------- + */ +#include "postgres.h" + +/* ---------------- + * pg_rewrite definition. cpp turns this into + * typedef struct FormData_pg_rewrite + * ---------------- + */ +CATALOG(pg_rewrite) { + NameData rulename; + char ev_type; + Oid ev_class; + int2 ev_attr; + bool is_instead; + text ev_qual; /* VARLENA */ + text action; /* VARLENA */ +} FormData_pg_rewrite; + +/* ---------------- + * Form_pg_rewrite corresponds to a pointer to a tuple with + * the format of pg_rewrite relation. + * ---------------- + */ +typedef FormData_pg_rewrite *Form_pg_rewrite; + +/* ---------------- + * compiler constants for pg_rewrite + * ---------------- + */ +#define Natts_pg_rewrite 7 +#define Anum_pg_rewrite_rulename 1 +#define Anum_pg_rewrite_ev_type 2 +#define Anum_pg_rewrite_ev_class 3 +#define Anum_pg_rewrite_ev_attr 4 +#define Anum_pg_rewrite_is_instead 5 +#define Anum_pg_rewrite_ev_qual 6 +#define Anum_pg_rewrite_action 7 + +#endif /* PG_REWRITE_H */ diff --git a/src/include/catalog/pg_server.h b/src/include/catalog/pg_server.h new file mode 100644 index 0000000000..1306ce070a --- /dev/null +++ b/src/include/catalog/pg_server.h @@ -0,0 +1,56 @@ +/*------------------------------------------------------------------------- + * + * pg_server.h-- + * definition of the system "server" relation (pg_server) + * along with the relation's initial contents. + * + * + * Copyright (c) 1994, Regents of the University of California + * + * $Id: pg_server.h,v 1.1 1996/08/28 01:57:12 scrappy Exp $ + * + * NOTES + * the genbki.sh script reads this file and generates .bki + * information from the DATA() statements. + * + *------------------------------------------------------------------------- + */ +#ifndef PG_SERVER_H +#define PG_SERVER_H + +/* ---------------- + * postgres.h contains the system type definintions and the + * CATALOG(), BOOTSTRAP and DATA() sugar words so this file + * can be read by both genbki.sh and the C compiler. + * ---------------- + */ +#include "postgres.h" + +/* ---------------- + * pg_server definition. cpp turns this into + * typedef struct FormData_pg_server + * ---------------- + */ +CATALOG(pg_server) BOOTSTRAP { + NameData sername; + int2 serpid; + int2 serport; +} FormData_pg_server; + +/* ---------------- + * Form_pg_server corresponds to a pointer to a tuple with + * the format of pg_server relation. + * ---------------- + */ +typedef FormData_pg_server *Form_pg_server; + +/* ---------------- + * compiler constants for pg_server + * ---------------- + */ +#define Natts_pg_server 3 +#define Anum_pg_server_sername 1 +#define Anum_pg_server_serpid 2 +#define Anum_pg_server_serport 3 + +#endif /* PG_SERVER_H */ diff --git a/src/include/catalog/pg_statistic.h b/src/include/catalog/pg_statistic.h new file mode 100644 index 0000000000..65ca1d009b --- /dev/null +++ b/src/include/catalog/pg_statistic.h @@ -0,0 +1,60 @@ +/*------------------------------------------------------------------------- + * + * pg_statistic.h-- + * definition of the system "statistic" relation (pg_statistic) + * along with the relation's initial contents. + * + * + * Copyright (c) 1994, Regents of the University of California + * + * $Id: pg_statistic.h,v 1.1 1996/08/28 01:57:14 scrappy Exp $ + * + * NOTES + * the genbki.sh script reads this file and generates .bki + * information from the DATA() statements. + * + *------------------------------------------------------------------------- + */ +#ifndef PG_STATISTIC_H +#define PG_STATISTIC_H + +/* ---------------- + * postgres.h contains the system type definintions and the + * CATALOG(), BOOTSTRAP and DATA() sugar words so this file + * can be read by both genbki.sh and the C compiler. + * ---------------- + */ +#include "postgres.h" + +/* ---------------- + * pg_statistic definition. cpp turns this into + * typedef struct FormData_pg_statistic + * ---------------- + */ +CATALOG(pg_statistic) { + Oid starelid; + int2 staattnum; + Oid staop; + text stalokey; /* VARIABLE LENGTH FIELD */ + text stahikey; /* VARIABLE LENGTH FIELD */ +} FormData_pg_statistic; + +/* ---------------- + * Form_pg_statistic corresponds to a pointer to a tuple with + * the format of pg_statistic relation. + * ---------------- + */ +typedef FormData_pg_statistic *Form_pg_statistic; + +/* ---------------- + * compiler constants for pg_statistic + * ---------------- + */ +#define Natts_pg_statistic 5 +#define Anum_pg_statistic_starelid 1 +#define Anum_pg_statistic_staattnum 2 +#define Anum_pg_statistic_staop 3 +#define Anum_pg_statistic_stalokey 4 +#define Anum_pg_statistic_stahikey 5 + +#endif /* PG_STATISTIC_H */ diff --git a/src/include/catalog/pg_time.h b/src/include/catalog/pg_time.h new file mode 100644 index 0000000000..59729a2d96 --- /dev/null +++ b/src/include/catalog/pg_time.h @@ -0,0 +1,41 @@ +/*------------------------------------------------------------------------- + * + * pg_time.h-- + * the system commit-time relation "pg_time" is not a "heap" relation. + * it is automatically created by the transam/ code and the + * information here is all bogus and is just here to make the + * relcache code happy. + * + * + * Copyright (c) 1994, Regents of the University of California + * + * $Id: pg_time.h,v 1.1 1996/08/28 01:57:17 scrappy Exp $ + * + * NOTES + * The structures and macros used by the transam/ code + * to access pg_time should some day go here -cim 6/18/90 + * + *------------------------------------------------------------------------- + */ +#ifndef PG_TIME_H +#define PG_TIME_H + +/* ---------------- + * postgres.h contains the system type definintions and the + * CATALOG(), BOOTSTRAP and DATA() sugar words so this file + * can be read by both genbki.sh and the C compiler. + * ---------------- + */ +#include "postgres.h" + +CATALOG(pg_time) BOOTSTRAP { + Oid timefoo; +} FormData_pg_time; + +typedef FormData_pg_time *Form_pg_time; + +#define Natts_pg_time 1 +#define Anum_pg_time_timefoo 1 + + +#endif /* PG_TIME_H */ diff --git a/src/include/catalog/pg_type.h b/src/include/catalog/pg_type.h new file mode 100644 index 0000000000..0ac0128766 --- /dev/null +++ b/src/include/catalog/pg_type.h @@ -0,0 +1,310 @@ +/*------------------------------------------------------------------------- + * + * pg_type.h-- + * definition of the system "type" relation (pg_type) + * along with the relation's initial contents. + * + * + * Copyright (c) 1994, Regents of the University of California + * + * $Id: pg_type.h,v 1.1 1996/08/28 01:57:18 scrappy Exp $ + * + * NOTES + * the genbki.sh script reads this file and generates .bki + * information from the DATA() statements. + * + *------------------------------------------------------------------------- + */ +#ifndef PG_TYPE_H +#define PG_TYPE_H + +/* ---------------- + * postgres.h contains the system type definintions and the + * CATALOG(), BOOTSTRAP and DATA() sugar words so this file + * can be read by both genbki.sh and the C compiler. + * ---------------- + */ +#include "postgres.h" +#include "utils/rel.h" /* for Relation */ + +/* ---------------- + * pg_type definition. cpp turns this into + * typedef struct FormData_pg_type + * + * Some of the values in a pg_type instance are copied into + * pg_attribute intances. Some parts of Postgres use the pg_type copy, + * while others use the pg_attribute copy, so they must match. + * See struct FormData_pg_attribute for details. + * ---------------- + */ +CATALOG(pg_type) BOOTSTRAP { + NameData typname; + Oid typowner; + int2 typlen; + /* typlen is the number of bytes we use to represent a value of + this type, e.g. 4 for an int4. But for a variable length + attribute, typlen is -1. + */ + int2 typprtlen; + bool typbyval; + /* typbyval determines whether internal Postgres routines pass a value + of this type by value or by reference. Postgres uses a 4 byte + area for passing class data, so if the value is not 1, 2, + or 4 bytes long, Postgres does not have the option of passing by + value and ignores typbyval. + + (I don't understand why this attribute exists. The above description + may be an oversimplification. Also, there appear to be bugs in which + Postgres doesn't ignore typbyval when it should, but I'm + afraid to change them until I see proof of damage. -BRYANH 96.08). + */ + char typtype; + bool typisdefined; + char typdelim; + Oid typrelid; + Oid typelem; + regproc typinput; + regproc typoutput; + regproc typreceive; + regproc typsend; + char typalign; + /* typalign is the alignment required when storing a value of this + type. It applies to storage on disk as well as most representations + of the value inside Postgres. When multiple values are stored + consecutively, such as in the representation of a complete tuple + on disk, padding is inserted before a datum of this type so that it + begins on the specified boundary. The alignment reference is the + beginning of the first datum in the sequence. + + 'c' = 1 byte alignment. + 's' = 2 byte alignment. + 'i' = 4 byte alignment. + 'd' = 8 byte alignment. + + (This might actually be flexible depending on machine architecture, + but I doubt it - BRYANH 96.08). + */ + text typdefault; /* VARIABLE LENGTH FIELD */ +} TypeTupleFormData; + +/* ---------------- + * Form_pg_type corresponds to a pointer to a tuple with + * the format of pg_type relation. + * ---------------- + */ +typedef TypeTupleFormData *TypeTupleForm; + +/* ---------------- + * compiler constants for pg_type + * ---------------- + */ +#define Natts_pg_type 16 +#define Anum_pg_type_typname 1 +#define Anum_pg_type_typowner 2 +#define Anum_pg_type_typlen 3 +#define Anum_pg_type_typprtlen 4 +#define Anum_pg_type_typbyval 5 +#define Anum_pg_type_typtype 6 +#define Anum_pg_type_typisdefined 7 +#define Anum_pg_type_typdelim 8 +#define Anum_pg_type_typrelid 9 +#define Anum_pg_type_typelem 10 +#define Anum_pg_type_typinput 11 +#define Anum_pg_type_typoutput 12 +#define Anum_pg_type_typreceive 13 +#define Anum_pg_type_typsend 14 +#define Anum_pg_type_typalign 15 +#define Anum_pg_type_typdefault 16 + +/* ---------------- + * initial contents of pg_type + * ---------------- + */ + +/* keep the following ordered by OID so that later changes can be made easier*/ + +/* Make sure the typlen, typbyval, and typalign values here match the initial + values for attlen, attbyval, and attalign in both places in pg_attribute.h + for every instance. +*/ + +/* OIDS 1 - 99 */ +DATA(insert OID = 16 ( bool PGUID 1 1 t b t \054 0 0 boolin boolout boolin boolout c _null_ )); + +#define BOOLOID 16 + +DATA(insert OID = 17 ( bytea PGUID -1 -1 f b t \054 0 18 byteain byteaout byteain byteaout i _null_ )); +DATA(insert OID = 18 ( char PGUID 1 1 t b t \054 0 0 charin charout charin charout c _null_ )); + +DATA(insert OID = 19 ( name PGUID NAMEDATALEN NAMEDATALEN f b t \054 0 18 namein nameout namein nameout i _null_ )); +DATA(insert OID = 20 ( char16 PGUID 16 16 f b t \054 0 18 char16in char16out char16in char16out i _null_ )); +/*DATA(insert OID = 20 ( dt PGUID 4 10 t b t \054 0 0 dtin dtout dtin dtout i _null_ )); */ +DATA(insert OID = 21 ( int2 PGUID 2 5 t b t \054 0 0 int2in int2out int2in int2out s _null_ )); + +#define INT2OID 21 + +DATA(insert OID = 22 ( int28 PGUID 16 50 f b t \054 0 21 int28in int28out int28in int28out i _null_ )); + +/* + * XXX -- the implementation of int28's in postgres is a hack, and will + * go away someday. until that happens, there is a case (in the + * catalog cache management code) where we need to step gingerly + * over piles of int28's on the sidewalk. in order to do so, we + * need the OID of the int28 tuple from pg_type. + */ + +#define INT28OID 22 + + +DATA(insert OID = 23 ( int4 PGUID 4 10 t b t \054 0 0 int4in int4out int4in int4out i _null_ )); + +#define INT4OID 23 + +DATA(insert OID = 24 ( regproc PGUID 4 16 t b t \054 0 0 regprocin regprocout regprocin regprocout i _null_ )); +DATA(insert OID = 25 ( text PGUID -1 -1 f b t \054 0 18 textin textout textin textout i _null_ )); +DATA(insert OID = 26 ( oid PGUID 4 10 t b t \054 0 0 int4in int4out int4in int4out i _null_ )); + +#define OIDOID 26 + +DATA(insert OID = 27 ( tid PGUID 6 19 f b t \054 0 0 tidin tidout tidin tidout i _null_ )); +DATA(insert OID = 28 ( xid PGUID 4 12 t b t \054 0 0 xidin xidout xidin xidout i _null_ )); +DATA(insert OID = 29 ( cid PGUID 2 3 t b t \054 0 0 cidin cidout cidin cidout s _null_ )); +DATA(insert OID = 30 ( oid8 PGUID 32 89 f b t \054 0 26 oid8in oid8out oid8in oid8out i _null_ )); +DATA(insert OID = 32 ( SET PGUID -1 -1 f r t \054 0 -1 textin textout textin textout i _null_ )); + +DATA(insert OID = 71 ( pg_type PGUID 1 1 t b t \054 71 0 foo bar foo bar c _null_)); +DATA(insert OID = 75 ( pg_attribute PGUID 1 1 t b t \054 75 0 foo bar foo bar c _null_)); +DATA(insert OID = 76 ( pg_demon PGUID 1 1 t b t \054 76 0 foo bar foo bar c _null_)); +DATA(insert OID = 80 ( pg_magic PGUID 1 1 t b t \054 80 0 foo bar foo bar c _null_)); +DATA(insert OID = 81 ( pg_proc PGUID 1 1 t b t \054 81 0 foo bar foo bar c _null_)); +DATA(insert OID = 82 ( pg_server PGUID 1 1 t b t \054 82 0 foo bar foo bar c _null_)); +DATA(insert OID = 83 ( pg_class PGUID 1 1 t b t \054 83 0 foo bar foo bar c _null_)); +DATA(insert OID = 86 ( pg_user PGUID 1 1 t b t \054 86 0 foo bar foo bar c _null_)); +DATA(insert OID = 87 ( pg_group PGUID 1 1 t b t \054 87 0 foo bar foo bar c _null_)); +DATA(insert OID = 88 ( pg_database PGUID 1 1 t b t \054 88 0 foo bar foo bar c _null_)); +DATA(insert OID = 89 ( pg_defaults PGUID 1 1 t b t \054 89 0 foo bar foo bar c _null_)); +DATA(insert OID = 90 ( pg_variable PGUID 1 1 t b t \054 90 0 foo bar foo bar c _null_)); +DATA(insert OID = 99 ( pg_log PGUID 1 1 t b t \054 99 0 foo bar foo bar c _null_)); + +/* OIDS 100 - 199 */ + +DATA(insert OID = 100 ( pg_time PGUID 1 1 t b t \054 100 0 foo bar foo bar c _null_)); +DATA(insert OID = 101 ( pg_time PGUID 1 1 t b t \054 101 0 foo bar foo bar c _null_)); + +/* OIDS 200 - 299 */ + +DATA(insert OID = 210 ( smgr PGUID 2 12 t b t \054 0 -1 smgrin smgrout smgrin smgrout s _null_ )); + +/* OIDS 300 - 399 */ + +/* OIDS 400 - 499 */ +DATA(insert OID = 409 ( char2 PGUID 2 2 t b t \054 0 18 char2in char2out char2in char2out s _null_ )); +DATA(insert OID = 410 ( char4 PGUID 4 4 t b t \054 0 18 char4in char4out char4in char4out i _null_ )); +DATA(insert OID = 411 ( char8 PGUID 8 8 f b t \054 0 18 char8in char8out char8in char8out i _null_ )); + +/* OIDS 500 - 599 */ + +/* OIDS 600 - 699 */ +DATA(insert OID = 600 ( point PGUID 16 24 f b t \054 0 701 point_in point_out point_in point_out d _null_ )); +DATA(insert OID = 601 ( lseg PGUID 32 48 f b t \054 0 600 lseg_in lseg_out lseg_in lseg_out d _null_ )); +DATA(insert OID = 602 ( path PGUID -1 -1 f b t \054 0 600 path_in path_out path_in path_out d _null_ )); +DATA(insert OID = 603 ( box PGUID 32 100 f b t \073 0 600 box_in box_out box_in box_out d _null_ )); +DATA(insert OID = 604 ( polygon PGUID -1 -1 f b t \054 0 -1 poly_in poly_out poly_in poly_out d _null_ )); +DATA(insert OID = 605 ( filename PGUID 256 -1 f b t \054 0 18 filename_in filename_out filename_in filename_out i _null_ )); + +/* OIDS 700 - 799 */ + +#define FLOAT4OID 700 + +DATA(insert OID = 700 ( float4 PGUID 4 12 f b t \054 0 0 float4in float4out float4in float4out i _null_ )); + + +#define FLOAT8OID 701 + +DATA(insert OID = 701 ( float8 PGUID 8 24 f b t \054 0 0 float8in float8out float8in float8out d _null_ )); +DATA(insert OID = 702 ( abstime PGUID 4 20 t b t \054 0 0 nabstimein nabstimeout nabstimein nabstimeout i _null_ )); +DATA(insert OID = 703 ( reltime PGUID 4 20 t b t \054 0 0 reltimein reltimeout reltimein reltimeout i _null_ )); +DATA(insert OID = 704 ( tinterval PGUID 12 47 f b t \054 0 0 tintervalin tintervalout tintervalin tintervalout i _null_ )); +DATA(insert OID = 705 ( unknown PGUID -1 -1 f b t \054 0 18 textin textout textin textout i _null_ )); + +#define UNKNOWNOID 705 + +/* OIDS 800 - 899 */ +DATA(insert OID = 810 ( oidint2 PGUID 6 20 f b t \054 0 0 oidint2in oidint2out oidint2in oidint2out i _null_ )); + +/* OIDS 900 - 999 */ +DATA(insert OID = 910 ( oidint4 PGUID 8 20 f b t \054 0 0 oidint4in oidint4out oidint4in oidint4out i _null_ )); +DATA(insert OID = 911 ( oidname PGUID OIDNAMELEN OIDNAMELEN f b t \054 0 0 oidnamein oidnameout oidnamein oidnameout i _null_ )); + +/* OIDS 1000 - 1099 */ +DATA(insert OID = 1000 ( _bool PGUID -1 -1 f b t \054 0 16 array_in array_out array_in array_out i _null_ )); +DATA(insert OID = 1001 ( _bytea PGUID -1 -1 f b t \054 0 17 array_in array_out array_in array_out i _null_ )); +DATA(insert OID = 1002 ( _char PGUID -1 -1 f b t \054 0 18 array_in array_out array_in array_out i _null_ )); +DATA(insert OID = 1003 ( _name PGUID -1 -1 f b t \054 0 19 array_in array_out array_in array_out i _null_ )); +DATA(insert OID = 1004 ( _char16 PGUID -1 -1 f b t \054 0 20 array_in array_out array_in array_out i _null_ )); +DATA(insert OID = 1005 ( _int2 PGUID -1 -1 f b t \054 0 21 array_in array_out array_in array_out i _null_ )); +DATA(insert OID = 1006 ( _int28 PGUID -1 -1 f b t \054 0 22 array_in array_out array_in array_out i _null_ )); +DATA(insert OID = 1007 ( _int4 PGUID -1 -1 f b t \054 0 23 array_in array_out array_in array_out i _null_ )); +DATA(insert OID = 1008 ( _regproc PGUID -1 -1 f b t \054 0 24 array_in array_out array_in array_out i _null_ )); +DATA(insert OID = 1009 ( _text PGUID -1 -1 f b t \054 0 25 array_in array_out array_in array_out i _null_ )); +DATA(insert OID = 1028 ( _oid PGUID -1 -1 f b t \054 0 26 array_in array_out array_in array_out i _null_ )); +DATA(insert OID = 1010 ( _tid PGUID -1 -1 f b t \054 0 27 array_in array_out array_in array_out i _null_ )); +DATA(insert OID = 1011 ( _xid PGUID -1 -1 f b t \054 0 28 array_in array_out array_in array_out i _null_ )); +DATA(insert OID = 1012 ( _cid PGUID -1 -1 f b t \054 0 29 array_in array_out array_in array_out i _null_ )); +DATA(insert OID = 1013 ( _oid8 PGUID -1 -1 f b t \054 0 30 array_in array_out array_in array_out i _null_ )); +/*DATA(insert OID = 1014 ( _lock PGUID -1 -1 f b t \054 0 31 array_in array_out array_in array_out i _null_ ));*/ +DATA(insert OID = 1015 ( _stub PGUID -1 -1 f b t \054 0 33 array_in array_out array_in array_out i _null_ )); +DATA(insert OID = 1016 ( _ref PGUID -1 -1 f b t \054 0 591 array_in array_out array_in array_out i _null_ )); +DATA(insert OID = 1017 ( _point PGUID -1 -1 f b t \054 0 600 array_in array_out array_in array_out d _null_ )); +DATA(insert OID = 1018 ( _lseg PGUID -1 -1 f b t \054 0 601 array_in array_out array_in array_out d _null_ )); +DATA(insert OID = 1019 ( _path PGUID -1 -1 f b t \054 0 602 array_in array_out array_in array_out d _null_ )); +DATA(insert OID = 1020 ( _box PGUID -1 -1 f b t \073 0 603 array_in array_out array_in array_out d _null_ )); +DATA(insert OID = 1021 ( _float4 PGUID -1 -1 f b t \054 0 700 array_in array_out array_in array_out i _null_ )); +DATA(insert OID = 1022 ( _float8 PGUID -1 -1 f b t \054 0 701 array_in array_out array_in array_out d _null_ )); +DATA(insert OID = 1023 ( _abstime PGUID -1 -1 f b t \054 0 702 array_in array_out array_in array_out i _null_ )); +DATA(insert OID = 1024 ( _reltime PGUID -1 -1 f b t \054 0 703 array_in array_out array_in array_out i _null_ )); +DATA(insert OID = 1025 ( _tinterval PGUID -1 -1 f b t \054 0 704 array_in array_out array_in array_out i _null_ )); +DATA(insert OID = 1026 ( _filename PGUID -1 -1 f b t \054 0 605 array_in array_out array_in array_out i _null_ )); +DATA(insert OID = 1027 ( _polygon PGUID -1 -1 f b t \054 0 604 array_in array_out array_in array_out d _null_ )); +/* Note: the size of an aclitem needs to match sizeof(AclItem) in acl.h */ +DATA(insert OID = 1033 ( aclitem PGUID 8 -1 f b t \054 0 0 aclitemin aclitemout aclitemin aclitemout i _null_ )); +DATA(insert OID = 1034 ( _aclitem PGUID -1 -1 f b t \054 0 1033 array_in array_out array_in array_out i _null_ )); + +DATA(insert OID = 1039 ( _char2 PGUID -1 -1 f b t \054 0 409 array_in array_out array_in array_out i _null_ )); +DATA(insert OID = 1040 ( _char4 PGUID -1 -1 f b t \054 0 410 array_in array_out array_in array_out i _null_ )); +DATA(insert OID = 1041 ( _char8 PGUID -1 -1 f b t \054 0 411 array_in array_out array_in array_out i _null_ )); + +#define BPCHAROID 1042 +DATA(insert OID = 1042 ( bpchar PGUID -1 -1 f b t \054 0 18 bpcharin bpcharout bpcharin bpcharout i _null_ )); +#define VARCHAROID 1043 +DATA(insert OID = 1043 ( varchar PGUID -1 -1 f b t \054 0 18 varcharin varcharout varcharin varcharout i _null_ )); + +DATA(insert OID = 1082 ( date PGUID 4 10 t b t \054 0 0 date_in date_out date_in date_out i _null_ )); +DATA(insert OID = 1083 ( time PGUID 8 16 f b t \054 0 0 time_in time_out time_in time_out i _null_ )); +DATA(insert OID = 1182 ( _date PGUID -1 -1 f b t \054 0 1082 array_in array_out array_in array_out i _null_ )); +DATA(insert OID = 1183 ( _time PGUID -1 -1 f b t \054 0 1083 array_in array_out array_in array_out d _null_ )); +/* + * prototypes for functions in pg_type.c + */ +extern Oid TypeGet(char *typeName, bool *defined); +extern Oid TypeShellMakeWithOpenRelation(Relation pg_type_desc, + char *typeName); +extern Oid TypeShellMake(char *typeName); +extern Oid TypeCreate(char *typeName, + Oid relationOid, + int16 internalSize, + int16 externalSize, + char typeType, + char typDelim, + char *inputProcedure, + char *outputProcedure, + char *sendProcedure, + char *receiveProcedure, + char *elementTypeName, + char *defaultTypeValue, + bool passedByValue, char alignment); +extern void TypeRename(char *oldTypeName, char *newTypeName); +extern char *makeArrayTypeName(char *typeName); + + +#endif /* PG_TYPE_H */ diff --git a/src/include/catalog/pg_user.h b/src/include/catalog/pg_user.h new file mode 100644 index 0000000000..468d91e527 --- /dev/null +++ b/src/include/catalog/pg_user.h @@ -0,0 +1,99 @@ +/*------------------------------------------------------------------------- + * + * pg_user.h-- + * definition of the system "user" relation (pg_user) + * along with the relation's initial contents. + * + * + * Copyright (c) 1994, Regents of the University of California + * + * $Id: pg_user.h,v 1.1 1996/08/28 01:57:20 scrappy Exp $ + * + * NOTES + * the genbki.sh script reads this file and generates .bki + * information from the DATA() statements. + * + *------------------------------------------------------------------------- + */ +#ifndef PG_USER_H +#define PG_USER_H + +/* ---------------- + * postgres.h contains the system type definintions and the + * CATALOG(), BOOTSTRAP and DATA() sugar words so this file + * can be read by both genbki.sh and the C compiler. + * ---------------- + */ +#include "postgres.h" + +/* ---------------- + * pg_user definition. cpp turns this into + * typedef struct FormData_pg_user + * ---------------- + */ +CATALOG(pg_user) BOOTSTRAP { + NameData usename; + int4 usesysid; + bool usecreatedb; + bool usetrace; + bool usesuper; + bool usecatupd; +} FormData_pg_user; + +/* ---------------- + * Form_pg_user corresponds to a pointer to a tuple with + * the format of pg_user relation. + * ---------------- + */ +typedef FormData_pg_user *Form_pg_user; + +/* ---------------- + * compiler constants for pg_user + * ---------------- + */ +#define Natts_pg_user 6 +#define Anum_pg_user_usename 1 +#define Anum_pg_user_usesysid 2 +#define Anum_pg_user_usecreatedb 3 +#define Anum_pg_user_usetrace 4 +#define Anum_pg_user_usesuper 5 +#define Anum_pg_user_usecatupd 6 + +/* ---------------- + * initial contents of pg_user + * ---------------- + */ +DATA(insert OID = 0 ( postgres PGUID t t t t )); + +BKI_BEGIN +#ifdef ALLOW_PG_GROUP +BKI_END + +DATA(insert OID = 0 ( mike 799 t t t t )); +DATA(insert OID = 0 ( mao 1806 t t t t )); +DATA(insert OID = 0 ( hellers 1089 t t t t )); +DATA(insert OID = 0 ( joey 5209 t t t t )); +DATA(insert OID = 0 ( jolly 5443 t t t t )); +DATA(insert OID = 0 ( sunita 6559 t t t t )); +DATA(insert OID = 0 ( paxson 3029 t t t t )); +DATA(insert OID = 0 ( marc 2435 t t t t )); +DATA(insert OID = 0 ( jiangwu 6124 t t t t )); +DATA(insert OID = 0 ( aoki 2360 t t t t )); +DATA(insert OID = 0 ( avi 31080 t t t t )); +DATA(insert OID = 0 ( kristin 1123 t t t t )); +DATA(insert OID = 0 ( andrew 5229 t t t t )); +DATA(insert OID = 0 ( nobuko 5493 t t t t )); +DATA(insert OID = 0 ( hartzell 6676 t t t t )); +DATA(insert OID = 0 ( devine 6724 t t t t )); +DATA(insert OID = 0 ( boris 6396 t t t t )); +DATA(insert OID = 0 ( sklower 354 t t t t )); +DATA(insert OID = 0 ( marcel 31113 t t t t )); +DATA(insert OID = 0 ( ginger 3692 t t t t )); +DATA(insert OID = 0 ( woodruff 31026 t t t t )); +DATA(insert OID = 0 ( searcher 8261 t t t t )); + +BKI_BEGIN +#endif /* ALLOW_PG_GROUP */ +BKI_END + +#endif /* PG_USER_H */ diff --git a/src/include/catalog/pg_variable.h b/src/include/catalog/pg_variable.h new file mode 100644 index 0000000000..db1b393bf9 --- /dev/null +++ b/src/include/catalog/pg_variable.h @@ -0,0 +1,40 @@ +/*------------------------------------------------------------------------- + * + * pg_variable.h-- + * the system variable relation "pg_variable" is not a "heap" relation. + * it is automatically created by the transam/ code and the + * information here is all bogus and is just here to make the + * relcache code happy. + * + * + * Copyright (c) 1994, Regents of the University of California + * + * $Id: pg_variable.h,v 1.1 1996/08/28 01:57:21 scrappy Exp $ + * + * NOTES + * The structures and macros used by the transam/ code + * to access pg_variable should someday go here -cim 6/18/90 + * + *------------------------------------------------------------------------- + */ +#ifndef PG_VARIABLE_H +#define PG_VARIABLE_H + +/* ---------------- + * postgres.h contains the system type definintions and the + * CATALOG(), BOOTSTRAP and DATA() sugar words so this file + * can be read by both genbki.sh and the C compiler. + * ---------------- + */ +#include "postgres.h" + +CATALOG(pg_variable) BOOTSTRAP { + Oid varfoo; +} FormData_pg_variable; + +typedef FormData_pg_variable *Form_pg_variable; + +#define Natts_pg_variable 1 +#define Anum_pg_variable_varfoo 1 + +#endif /* PG_VARIABLE_H */ diff --git a/src/include/catalog/pg_version.h b/src/include/catalog/pg_version.h new file mode 100644 index 0000000000..8b0df91dee --- /dev/null +++ b/src/include/catalog/pg_version.h @@ -0,0 +1,58 @@ +/*------------------------------------------------------------------------- + * + * pg_version.h-- + * definition of the system "version" relation (pg_version) + * along with the relation's initial contents. + * + * + * Copyright (c) 1994, Regents of the University of California + * + * $Id: pg_version.h,v 1.1 1996/08/28 01:57:23 scrappy Exp $ + * + * NOTES + * the genbki.sh script reads this file and generates .bki + * information from the DATA() statements. + * + *------------------------------------------------------------------------- + */ +#ifndef PG_VERSION_H +#define PG_VERSION_H + +/* ---------------- + * postgres.h contains the system type definintions and the + * CATALOG(), BOOTSTRAP and DATA() sugar words so this file + * can be read by both genbki.sh and the C compiler. + * ---------------- + */ +#include "postgres.h" +#include "utils/nabstime.h" + +/* ---------------- + * pg_version definition. cpp turns this into + * typedef struct FormData_pg_version + * ---------------- + */ +CATALOG(pg_version) { + Oid verrelid; + Oid verbaseid; + int4 vertime; /* really should be some abstime */ +} FormData_pg_version; + +/* ---------------- + * Form_pg_version corresponds to a pointer to a tuple with + * the format of pg_version relation. + * ---------------- + */ +typedef FormData_pg_version *VersionTupleForm; + +/* ---------------- + * compiler constants for pg_version + * ---------------- + */ +#define Natts_pg_version 3 +#define Anum_pg_version_verrelid 1 +#define Anum_pg_version_verbaseid 2 +#define Anum_pg_version_vertime 3 + + +#endif /* PG_VERSION_H */ diff --git a/src/include/nodes/execnodes.h b/src/include/nodes/execnodes.h new file mode 100644 index 0000000000..60ee4b4a9f --- /dev/null +++ b/src/include/nodes/execnodes.h @@ -0,0 +1,689 @@ +/*------------------------------------------------------------------------- + * + * execnodes.h-- + * definitions for executor state nodes + * + * + * Copyright (c) 1994, Regents of the University of California + * + * $Id: execnodes.h,v 1.1 1996/08/28 01:57:30 scrappy Exp $ + * + *------------------------------------------------------------------------- + */ +#ifndef EXECNODES_H +#define EXECNODES_H + +#include "postgres.h" + +#include "nodes/nodes.h" +#include "nodes/primnodes.h" +#include "nodes/pg_list.h" + +#include "nodes/memnodes.h" + +#include "storage/item.h" +#include "access/sdir.h" +#include "access/htup.h" +#include "access/tupdesc.h" +#include "access/funcindex.h" +#include "utils/rel.h" +#include "access/relscan.h" +#include "executor/hashjoin.h" +#include "executor/tuptable.h" + +/* ---------------- + * IndexInfo information + * + * this class holds the information saying what attributes + * are the key attributes for this index. -cim 10/15/89 + * + * NumKeyAttributes number of key attributes for this index + * KeyAttributeNumbers array of attribute numbers used as keys + * Predicate partial-index predicate for this index + * ---------------- + */ +typedef struct IndexInfo { + NodeTag type; + int ii_NumKeyAttributes; + AttrNumber *ii_KeyAttributeNumbers; + FuncIndexInfoPtr ii_FuncIndexInfo; + Node *ii_Predicate; +} IndexInfo; + +/* ---------------- + * RelationInfo information + * + * whenever we update an existing relation, we have to + * update indices on the relation. The RelationInfo class + * is used to hold all the information on result relations, + * including indices.. -cim 10/15/89 + * + * RangeTableIndex result relation's range table index + * RelationDesc relation descriptor for result relation + * NumIndices number indices existing on result relation + * IndexRelationDescs array of relation descriptors for indices + * IndexRelationInfo array of key/attr info for indices + * ---------------- + */ +typedef struct RelationInfo { + NodeTag type; + Index ri_RangeTableIndex; + Relation ri_RelationDesc; + int ri_NumIndices; + RelationPtr ri_IndexRelationDescs; + IndexInfo **ri_IndexRelationInfo; +} RelationInfo; + +/* ---------------- + * ExprContext + * + * This class holds the "current context" information + * needed to evaluate expressions for doing tuple qualifications + * and tuple projections. For example, if an expression refers + * to an attribute in the current inner tuple then we need to know + * what the current inner tuple is and so we look at the expression + * context. + * ---------------- + */ +typedef struct ExprContext { + NodeTag type; + TupleTableSlot *ecxt_scantuple; + TupleTableSlot *ecxt_innertuple; + TupleTableSlot *ecxt_outertuple; + Relation ecxt_relation; + Index ecxt_relid; + ParamListInfo ecxt_param_list_info; + List *ecxt_range_table; + Datum *ecxt_values; /* precomputed values for aggreg */ + char *ecxt_nulls; /* null flags for aggreg values */ +} ExprContext; + +/* ---------------- + * ProjectionInfo node information + * + * This is all the information needed to preform projections + * on a tuple. Nodes which need to do projections create one + * of these. In theory, when a node wants to preform a projection + * it should just update this information as necessary and then + * call ExecProject(). -cim 6/3/91 + * + * targetlist target list for projection + * len length of target list + * tupValue array of pointers to projection results + * exprContext expression context for ExecTargetList + * slot slot to place projection result in + * ---------------- + */ +typedef struct ProjectionInfo { + NodeTag type; + List *pi_targetlist; + int pi_len; + Datum *pi_tupValue; + ExprContext *pi_exprContext; + TupleTableSlot *pi_slot; +} ProjectionInfo; + +/* ---------------- + * JunkFilter + * + * this class is used to store information regarding junk attributes. + * A junk attribute is an attribute in a tuple that is needed only for + * storing intermediate information in the executor, and does not belong + * in the tuple proper. For example, when we do a delete or replace + * query, the planner adds an entry to the targetlist so that the tuples + * returned to ExecutePlan() contain an extra attribute: the t_ctid of + * the tuple to be deleted/replaced. This is needed for amdelete() and + * amreplace(). In doing a delete this does not make much of a + * difference, but in doing a replace we have to make sure we disgard + * all the junk in a tuple before calling amreplace(). Otherwise the + * inserted tuple will not have the correct schema. This solves a + * problem with hash-join and merge-sort replace plans. -cim 10/10/90 + * + * targetList: the original target list (including junk attributes). + * length: the length of 'targetList'. + * tupType: the tuple descriptor for the "original" tuple + * (including the junk attributes). + * cleanTargetList: the "clean" target list (junk attributes removed). + * cleanLength: the length of 'cleanTargetList' + * cleanTupTyp: the tuple descriptor of the "clean" tuple (with + * junk attributes removed). + * cleanMap: A map with the correspondance between the non junk + * attributes of the "original" tuple and the + * attributes of the "clean" tuple. + * ---------------- + */ +typedef struct JunkFilter { + NodeTag type; + List *jf_targetList; + int jf_length; + TupleDesc jf_tupType; + List *jf_cleanTargetList; + int jf_cleanLength; + TupleDesc jf_cleanTupType; + AttrNumber *jf_cleanMap; +} JunkFilter; + +/* ---------------- + * EState information + * + * direction direction of the scan + * + * range_table array of scan relation information + * + * result_relation_information for update queries + * + * into_relation_descriptor relation being retrieved "into" + * + * param_list_info information needed to transform + * Param nodes into Const nodes + * + * BaseId during InitPlan(), each node is + * given a number. this is the next + * number to be assigned. + * + * tupleTable this is a pointer to an array + * of pointers to tuples used by + * the executor at any given moment. + * + * junkFilter contains information used to + * extract junk attributes from a tuple. + * (see JunkFilter above) + * + * refcount local buffer refcounts used in + * an ExecMain cycle. this is introduced + * to avoid ExecStart's unpinning each + * other's buffers when called recursively + * ---------------- + */ +typedef struct EState { + NodeTag type; + ScanDirection es_direction; + List *es_range_table; + RelationInfo *es_result_relation_info; + Relation es_into_relation_descriptor; + ParamListInfo es_param_list_info; + int es_BaseId; + TupleTable es_tupleTable; + JunkFilter *es_junkFilter; + int *es_refcount; +} EState; + +/* ---------------- + * Executor Type information needed by plannodes.h + * + *| Note: the bogus classes CommonState and CommonScanState exist only + *| because our inheritance system only allows single inheritance + *| and we have to have unique slot names. Hence two or more + *| classes which want to have a common slot must ALL inherit + *| the slot from some other class. (This is a big hack to + *| allow our classes to share slot names..) + *| + *| Example: + *| the class Result and the class NestLoop nodes both want + *| a slot called "OuterTuple" so they both have to inherit + *| it from some other class. In this case they inherit + *| it from CommonState. "CommonState" and "CommonScanState" are + *| the best names I could come up with for this sort of + *| stuff. + *| + *| As a result, many classes have extra slots which they + *| don't use. These slots are denoted (unused) in the + *| comment preceeding the class definition. If you + *| comes up with a better idea of a way of doing things + *| along these lines, then feel free to make your idea + *| known to me.. -cim 10/15/89 + * ---------------- + */ + +/* ---------------------------------------------------------------- + * Common Executor State Information + * ---------------------------------------------------------------- + */ + +/* BaseNode removed -- base_id moved into CommonState - jolly */ + +/* ---------------- + * CommonState information + * + *| this is a bogus class used to hold slots so other + *| nodes can inherit them... + * + * OuterTupleSlot pointer to slot containing current "outer" tuple + * ResultTupleSlot pointer to slot in tuple table for projected tuple + * ExprContext node's current expression context + * ProjInfo info this node uses to form tuple projections + * NumScanAttributes size of ScanAttributes array + * ScanAttributes attribute numbers of interest in this tuple + * + * ---------------- + */ +typedef struct CommonState { + NodeTag type; /* its first field is NodeTag */ + int cs_base_id; + TupleTableSlot *cs_OuterTupleSlot; + TupleTableSlot *cs_ResultTupleSlot; + ExprContext *cs_ExprContext; + ProjectionInfo *cs_ProjInfo; + bool cs_TupFromTlist; +} CommonState; + + +/* ---------------------------------------------------------------- + * Control Node State Information + * ---------------------------------------------------------------- + */ + +/* ---------------- + * ResultState information + * + * done flag which tells us to quit when we + * have already returned a constant tuple. + * + * CommonState information + * + * OuterTupleSlot pointer to slot containing current "outer" tuple + * ResultTupleSlot pointer to slot in tuple table for projected tuple + * ExprContext node's current expression context + * ProjInfo info this node uses to form tuple projections + * NumScanAttributes size of ScanAttributes array + * ScanAttributes attribute numbers of interest in this tuple + * ---------------- + */ +typedef struct ResultState { + CommonState cstate; /* its first field is NodeTag */ + int rs_done; +} ResultState; + +/* ---------------- + * AppendState information + * + * append nodes have this field "unionplans" which is this + * list of plans to execute in sequence.. these variables + * keep track of things.. + * + * whichplan which plan is being executed + * nplans how many plans are in the list + * initialized array of ExecInitNode() results + * rtentries range table for the current plan + * result_relation_info_list array of each subplan's result relation info + * junkFilter_list array of each subplan's junk filter + * + * CommonState information + * + * OuterTupleSlot pointer to slot containing current "outer" tuple + * ResultTupleSlot pointer to slot in tuple table for projected tuple + * ExprContext node's current expression context + * ProjInfo info this node uses to form tuple projections + * NumScanAttributes size of ScanAttributes array + * ScanAttributes attribute numbers of interest in this tuple + * ---------------- + */ +typedef struct AppendState { + CommonState cstate; /* its first field is NodeTag */ + int as_whichplan; + int as_nplans; + bool *as_initialized; + List *as_rtentries; + List *as_result_relation_info_list; + List *as_junkFilter_list; +} AppendState; + +/* ---------------------------------------------------------------- + * Scan State Information + * ---------------------------------------------------------------- + */ + +/* ---------------- + * CommonScanState information + * + * CommonScanState is a class like CommonState, but is used more + * by the nodes like SeqScan and Sort which want to + * keep track of an underlying relation. + * + * currentRelation relation being scanned + * currentScanDesc current scan descriptor for scan + * ScanTupleSlot pointer to slot in tuple table holding scan tuple + * + * CommonState information + * + * OuterTupleSlot pointer to slot containing current "outer" tuple + * ResultTupleSlot pointer to slot in tuple table for projected tuple + * ExprContext node's current expression context + * ProjInfo info this node uses to form tuple projections + * NumScanAttributes size of ScanAttributes array + * ScanAttributes attribute numbers of interest in this tuple + * ---------------- + */ +typedef struct CommonScanState { + CommonState cstate; /* its first field is NodeTag */ + Relation css_currentRelation; + HeapScanDesc css_currentScanDesc; + TupleTableSlot *css_ScanTupleSlot; +} CommonScanState; + +/* ---------------- + * IndexScanState information + * + *| index scans don't use CommonScanState because + *| the underlying AM abstractions for heap scans and + *| index scans are too different.. It would be nice + *| if the current abstraction was more useful but ... -cim 10/15/89 + * + * IndexPtr current index in use + * NumIndices number of indices in this scan + * ScanKeys Skey structures to scan index rels + * NumScanKeys array of no of keys in each Skey struct + * RuntimeKeyInfo array of array of flags for Skeys evaled at runtime + * RelationDescs ptr to array of relation descriptors + * ScanDescs ptr to array of scan descriptors + * + * CommonState information + * + * OuterTupleSlot pointer to slot containing current "outer" tuple + * ResultTupleSlot pointer to slot in tuple table for projected tuple + * ExprContext node's current expression context + * ProjInfo info this node uses to form tuple projections + * NumScanAttributes size of ScanAttributes array + * ScanAttributes attribute numbers of interest in this tuple + * ---------------- + */ +typedef struct IndexScanState { + CommonState cstate; /* its first field is NodeTag */ + int iss_NumIndices; + int iss_IndexPtr; + ScanKey *iss_ScanKeys; + int *iss_NumScanKeys; + Pointer iss_RuntimeKeyInfo; + RelationPtr iss_RelationDescs; + IndexScanDescPtr iss_ScanDescs; +} IndexScanState; + + +/* ---------------------------------------------------------------- + * Join State Information + * ---------------------------------------------------------------- + */ + +/* ---------------- + * JoinState information + * + * CommonState information + * + * OuterTupleSlot pointer to slot containing current "outer" tuple + * ResultTupleSlot pointer to slot in tuple table for projected tuple + * ExprContext node's current expression context + * ProjInfo info this node uses to form tuple projections + * NumScanAttributes size of ScanAttributes array + * ScanAttributes attribute numbers of interest in this tuple + * ---------------- + */ +typedef CommonState JoinState; + +/* ---------------- + * NestLoopState information + * + * PortalFlag Set to enable portals to work. + * + * JoinState information + * + * CommonState information + * + * OuterTupleSlot pointer to slot containing current "outer" tuple + * ResultTupleSlot pointer to slot in tuple table for projected tuple + * ExprContext node's current expression context + * ProjInfo info this node uses to form tuple projections + * NumScanAttributes size of ScanAttributes array + * ScanAttributes attribute numbers of interest in this tuple + * ---------------- + */ +typedef struct NestLoopState { + JoinState jstate; /* its first field is NodeTag */ + bool nl_PortalFlag; +} NestLoopState; + +/* ---------------- + * MergeJoinState information + * + * OSortopI outerKey1 sortOp innerKey1 ... + * ISortopO innerkey1 sortOp outerkey1 ... + * JoinState current "state" of join. see executor.h + * MarkedTupleSlot pointer to slot in tuple table for marked tuple + * + * JoinState information + * + * CommonState information + * + * OuterTupleSlot pointer to slot containing current "outer" tuple + * ResultTupleSlot pointer to slot in tuple table for projected tuple + * ExprContext node's current expression context + * ProjInfo info this node uses to form tuple projections + * NumScanAttributes size of ScanAttributes array + * ScanAttributes attribute numbers of interest in this tuple + * ---------------- + */ +typedef struct MergeJoinState { + JoinState jstate; /* its first field is NodeTag */ + List *mj_OSortopI; + List *mj_ISortopO; + int mj_JoinState; + TupleTableSlot *mj_MarkedTupleSlot; +} MergeJoinState; + +/* ---------------- + * HashJoinState information + * + * hj_HashTable address of the hash table for the hashjoin + * hj_HashTableShmId shared memory id of hash table + * hj_CurBucket the current hash bucket that we are searching + * for matches of the current outer tuple + * hj_CurTuple the current matching inner tuple in the + * current hash bucket + * hj_CurOTuple the current matching inner tuple in the + * current hash overflow chain + * hj_InnerHashKey the inner hash key in the hashjoin condition + * hj_OuterBatches file descriptors for outer batches + * hj_InnerBatches file descriptors for inner batches + * hj_OuterReadPos current read position of outer batch + * hj_OuterReadBlk current read block of outer batch + * hj_OuterTupleSlot tuple slot for outer tuples + * hj_HashTupleSlot tuple slot for hashed tuples + * + * + * + * JoinState information + * + * CommonState information + * + * OuterTupleSlot pointer to slot containing current "outer" tuple + * ResultTupleSlot pointer to slot in tuple table for projected tuple + * ExprContext node's current expression context + * ProjInfo info this node uses to form tuple projections + * NumScanAttributes size of ScanAttributes array + * ScanAttributes attribute numbers of interest in this tuple + * ---------------- + */ +typedef struct HashJoinState { + JoinState jstate; /* its first field is NodeTag */ + HashJoinTable hj_HashTable; + IpcMemoryId hj_HashTableShmId; + HashBucket hj_CurBucket; + HeapTuple hj_CurTuple; + OverflowTuple hj_CurOTuple; + Var *hj_InnerHashKey; + File *hj_OuterBatches; + File *hj_InnerBatches; + char *hj_OuterReadPos; + int hj_OuterReadBlk; + TupleTableSlot *hj_OuterTupleSlot; + TupleTableSlot *hj_HashTupleSlot; +} HashJoinState; + + +/* ---------------------------------------------------------------- + * Materialization State Information + * ---------------------------------------------------------------- + */ + +/* ---------------- + * MaterialState information + * + * materialize nodes are used to materialize the results + * of a subplan into a temporary relation. + * + * Flag indicated whether subplan has been materialized + * TempRelation temporary relation containing result of executing + * the subplan. + * + * CommonScanState information + * + * currentRelation relation descriptor of sorted relation + * currentScanDesc current scan descriptor for scan + * ScanTupleSlot pointer to slot in tuple table holding scan tuple + * + * CommonState information + * + * OuterTupleSlot pointer to slot containing current "outer" tuple + * ResultTupleSlot pointer to slot in tuple table for projected tuple + * ExprContext node's current expression context + * ProjInfo info this node uses to form tuple projections + * NumScanAttributes size of ScanAttributes array + * ScanAttributes attribute numbers of interest in this tuple + * ---------------- + */ +typedef struct MaterialState { + CommonScanState csstate; /* its first field is NodeTag */ + bool mat_Flag; + Relation mat_TempRelation; +} MaterialState; + +/* --------------------- + * AggregateState information + * + * done indicated whether aggregate has been materialized + * ------------------------- + */ +typedef struct AggState { + CommonScanState csstate; /* its first field is NodeTag */ + bool agg_done; +} AggState; + +/* --------------------- + * GroupState information + * + * ------------------------- + */ +typedef struct GroupState { + CommonScanState csstate; /* its first field is NodeTag */ + bool grp_useLastTuple; /* last tuple not processed yet */ + bool grp_done; + TupleTableSlot *grp_lastSlot; +} GroupState; + +/* ---------------- + * SortState information + * + *| sort nodes are really just a kind of a scan since + *| we implement sorts by retrieveing the entire subplan + *| into a temp relation, sorting the temp relation into + *| another sorted relation, and then preforming a simple + *| unqualified sequential scan on the sorted relation.. + *| -cim 10/15/89 + * + * Flag indicated whether relation has been sorted + * Keys scan key structures used to keep info on sort keys + * TempRelation temporary relation containing result of executing + * the subplan. + * + * CommonScanState information + * + * currentRelation relation descriptor of sorted relation + * currentScanDesc current scan descriptor for scan + * ScanTupleSlot pointer to slot in tuple table holding scan tuple + * + * CommonState information + * + * OuterTupleSlot pointer to slot containing current "outer" tuple + * ResultTupleSlot pointer to slot in tuple table for projected tuple + * ExprContext node's current expression context + * ProjInfo info this node uses to form tuple projections + * NumScanAttributes size of ScanAttributes array + * ScanAttributes attribute numbers of interest in this tuple + * ---------------- + */ +typedef struct SortState { + CommonScanState csstate; /* its first field is NodeTag */ + bool sort_Flag; + ScanKey sort_Keys; + Relation sort_TempRelation; +} SortState; + +/* ---------------- + * UniqueState information + * + * Unique nodes are used "on top of" sort nodes to discard + * duplicate tuples returned from the sort phase. Basically + * all it does is compare the current tuple from the subplan + * with the previously fetched tuple stored in OuterTuple and + * if the two are identical, then we just fetch another tuple + * from the sort and try again. + * + * CommonState information + * + * OuterTupleSlot pointer to slot containing current "outer" tuple + * ResultTupleSlot pointer to slot in tuple table for projected tuple + * ExprContext node's current expression context + * ProjInfo info this node uses to form tuple projections + * NumScanAttributes size of ScanAttributes array + * ScanAttributes attribute numbers of interest in this tuple + * ---------------- + */ +typedef CommonState UniqueState; + + +/* ---------------- + * HashState information + * + * hashBatches file descriptors for the batches + * + * CommonState information + * + * OuterTupleSlot pointer to slot containing current "outer" tuple + * ResultTupleSlot pointer to slot in tuple table for projected tuple + * ExprContext node's current expression context + * ProjInfo info this node uses to form tuple projections + * NumScanAttributes size of ScanAttributes array + * ScanAttributes attribute numbers of interest in this tuple + * ---------------- + */ +typedef struct HashState { + CommonState cstate; /* its first field is NodeTag */ + File *hashBatches; +} HashState; + +/* ----------------------- + * TeeState information + * leftPlace : next item in the queue unseen by the left parent + * rightPlace : next item in the queue unseen by the right parent + * lastPlace : last item in the queue + * bufferRelname : name of the relation used as the buffer queue + * bufferRel : the relation used as the buffer queue + * mcxt : for now, tee's have their own memory context + * may be cleaned up later if portals are cleaned up + * + * initially, a Tee starts with [left/right]Place variables set to -1. + * on cleanup, queue is free'd when both leftPlace and rightPlace = -1 + * ------------------------- +*/ +typedef struct TeeState { + CommonState cstate; /* its first field is NodeTag */ + int tee_leftPlace; + int tee_rightPlace; + int tee_lastPlace; + char *tee_bufferRelname; + Relation tee_bufferRel; + MemoryContext tee_mcxt; + HeapScanDesc tee_leftScanDesc; + HeapScanDesc tee_rightScanDesc; +} TeeState; + +#endif /* EXECNODES_H */ diff --git a/src/include/nodes/makefuncs.h b/src/include/nodes/makefuncs.h new file mode 100644 index 0000000000..1460cb9811 --- /dev/null +++ b/src/include/nodes/makefuncs.h @@ -0,0 +1,48 @@ +/*------------------------------------------------------------------------- + * + * makefuncs.h-- + * prototypes for the creator functions (for primitive nodes) + * + * + * Copyright (c) 1994, Regents of the University of California + * + * $Id: makefuncs.h,v 1.1 1996/08/28 01:57:33 scrappy Exp $ + * + *------------------------------------------------------------------------- + */ +#ifndef MAKEFUNC_H +#define MAKEFUNC_H + +#include "access/attnum.h" +#include "catalog/pg_operator.h" +#include "utils/fcache.h" +#include "nodes/primnodes.h" + +extern Oper *makeOper(Oid opno, + Oid opid, + Oid opresulttype, + int opsize, + FunctionCachePtr op_fcache); + +extern Var *makeVar(Index varno, + AttrNumber varattno, + Oid vartype, + Index varnoold, + AttrNumber varoattno); + +extern Resdom *makeResdom(AttrNumber resno, + Oid restype, + int reslen, + char *resname, + Index reskey, + Oid reskeyop, + int resjunk); + +extern Const *makeConst(Oid consttype, + Size constlen, + Datum constvalue, + bool constisnull, + bool constbyval, + bool constisset); + +#endif /* MAKEFUNC_H */ diff --git a/src/include/nodes/memnodes.h b/src/include/nodes/memnodes.h new file mode 100644 index 0000000000..2fe3b85d6a --- /dev/null +++ b/src/include/nodes/memnodes.h @@ -0,0 +1,101 @@ +/*------------------------------------------------------------------------- + * + * memnodes.h-- + * POSTGRES memory context node definitions. + * + * + * Copyright (c) 1994, Regents of the University of California + * + * $Id: memnodes.h,v 1.1 1996/08/28 01:57:34 scrappy Exp $ + * + * XXX the typedefs in this file are different from the other ???nodes.h; + * they are pointers to structures instead of the structures themselves. + * If you're wondering, this is plain laziness. I don't want to touch + * the memory context code which should be revamped altogether some day. + * - ay 10/94 + *------------------------------------------------------------------------- + */ +#ifndef MEMNODES_H +#define MEMNODES_H + +#include "c.h" + +#include "utils/memutils.h" +#include "lib/fstack.h" + +#include "nodes/nodes.h" + +/* + * MemoryContext -- + * A logical context in which memory allocations occur. + * + * The types of memory contexts can be thought of as members of the + * following inheritance hierarchy with properties summarized below. + * + * Node + * | + * MemoryContext___ + * / \ + * GlobalMemory PortalMemoryContext + * / \ + * PortalVariableMemory PortalHeapMemory + * + * Flushed at Flushed at Checkpoints + * Transaction Portal + * Commit Close + * + * GlobalMemory n n n + * PortalVariableMemory n y n + * PortalHeapMemory y y y + */ + +typedef struct MemoryContextMethodsData { + Pointer (*alloc)(); + void (*free_p)(); /* need to use free as a #define, + so can't use free */ + Pointer (*realloc)(); + char* (*getName)(); + void (*dump)(); +} *MemoryContextMethods; + +typedef struct MemoryContext { + NodeTag type; + MemoryContextMethods method; +} *MemoryContext; + +/* think about doing this right some time but we'll have explicit fields + for now -ay 10/94 */ +typedef struct GlobalMemory { + NodeTag type; + MemoryContextMethods method; + AllocSetData setData; + char *name; + OrderedElemData elemData; +} *GlobalMemory; + +typedef MemoryContext *PortalMemoryContext; + +typedef struct PortalVariableMemory { + NodeTag type; + MemoryContextMethods method; + AllocSetData setData; +} *PortalVariableMemory; + +typedef struct PortalHeapMemory { + NodeTag type; + MemoryContextMethods method; + Pointer block; + FixedStackData stackData; +} *PortalHeapMemory; + +/* + * MemoryContextIsValid -- + * True iff memory context is valid. + */ +#define MemoryContextIsValid(context) \ + (IsA(context,MemoryContext) || IsA(context,GlobalMemory) || \ + IsA(context,PortalVariableMemory) || IsA(context,PortalHeapMemory)) + +#endif /* MEMNODES_H */ + + diff --git a/src/include/nodes/nodeFuncs.h b/src/include/nodes/nodeFuncs.h new file mode 100644 index 0000000000..40bde8ae16 --- /dev/null +++ b/src/include/nodes/nodeFuncs.h @@ -0,0 +1,23 @@ +/*------------------------------------------------------------------------- + * + * nodeFuncs.h-- + * + * + * + * Copyright (c) 1994, Regents of the University of California + * + * $Id: nodeFuncs.h,v 1.1 1996/08/28 01:57:35 scrappy Exp $ + * + *------------------------------------------------------------------------- + */ +#ifndef NODEFUNCS_H +#define NODEFUNCS_H + +extern bool single_node(Node *node); +extern bool var_is_outer(Var *var); +extern bool var_is_inner(Var *var); +extern bool var_is_rel(Var *var); +extern Oper *replace_opid(Oper *oper); +extern bool non_null(Expr *c); + +#endif /* NODEFUNCS_H */ diff --git a/src/include/nodes/nodes.h b/src/include/nodes/nodes.h new file mode 100644 index 0000000000..d22b2ee0c9 --- /dev/null +++ b/src/include/nodes/nodes.h @@ -0,0 +1,299 @@ +/*------------------------------------------------------------------------- + * + * nodes.h-- + * Definitions for tagged nodes. + * + * + * Copyright (c) 1994, Regents of the University of California + * + * $Id: nodes.h,v 1.1 1996/08/28 01:57:37 scrappy Exp $ + * + *------------------------------------------------------------------------- + */ +#ifndef NODES_H +#define NODES_H + +#include "c.h" + +/* + * The first field of every node is NodeTag. Each node created (with makeNode) + * will have one of the following tags as the value of its first field. + * + * Note that the number of the node tags are not contiguous. We left holes + * here so that we can add more tags without changing the existing enum's. + */ +typedef enum NodeTag { + T_Invalid = 0, + + /*--------------------- + * TAGS FOR PLAN NODES (plannodes.h) + *--------------------- + */ + T_Plan = 10, + T_Existential, + T_Result, + T_Append, + T_Scan, + T_SeqScan, + T_IndexScan, + T_Join, + T_NestLoop, + T_MergeJoin, + T_HashJoin, + T_Temp, + T_Material, + T_Sort, + T_Agg, + T_Unique, + T_Hash, + T_Choose, + T_Tee, + T_Group, + + /*--------------------- + * TAGS FOR PRIMITIVE NODES (primnodes.h) + *--------------------- + */ + T_Resdom = 100, + T_Fjoin, + T_Expr, + T_Var, + T_Oper, + T_Const, + T_Param, + T_Aggreg, + T_Func, + T_Array, + T_ArrayRef, + + /*--------------------- + * TAGS FOR INNER PLAN NODES (relation.h) + *--------------------- + */ + T_Rel = 200, + T_Path, + T_IndexPath, + T_JoinPath, + T_MergePath, + T_HashPath, + T_OrderKey, + T_JoinKey, + T_MergeOrder, + T_CInfo, + T_JoinMethod, + T_HInfo, + T_MInfo, + T_JInfo, + T_Iter, + T_Stream, + + /*--------------------- + * TAGS FOR EXECUTOR NODES (execnodes.h) + *--------------------- + */ + T_IndexInfo = 300, + T_RelationInfo, + T_TupleCount, + T_TupleTableSlot, + T_ExprContext, + T_ProjectionInfo, + T_JunkFilter, + T_EState, + T_BaseNode, + T_CommonState, + T_ResultState, + T_AppendState, + T_CommonScanState, + T_ScanState, + T_IndexScanState, + T_JoinState, + T_NestLoopState, + T_MergeJoinState, + T_HashJoinState, + T_MaterialState, + T_AggState, + T_GroupState, + T_SortState, + T_UniqueState, + T_HashState, + T_TeeState, + + /*--------------------- + * TAGS FOR MEMORY NODES (memnodes.h) + *--------------------- + */ + T_MemoryContext = 400, + T_GlobalMemory, + T_PortalMemoryContext, + T_PortalVariableMemory, + T_PortalHeapMemory, + + /*--------------------- + * TAGS FOR VALUE NODES (pg_list.h) + *--------------------- + */ + T_Value = 500, + T_List, + T_Integer, + T_Float, + T_String, + T_Null, + + /*--------------------- + * TAGS FOR PARSE TREE NODES (parsenode.h) + *--------------------- + */ + T_Query = 600, + T_AppendStmt, + T_DeleteStmt, + T_ReplaceStmt, + T_CursorStmt, + T_RetrieveStmt, + T_AddAttrStmt, + T_AggregateStmt, + T_ChangeACLStmt, + T_ClosePortalStmt, + T_ClusterStmt, + T_CopyStmt, + T_CreateStmt, + T_VersionStmt, + T_DefineStmt, + T_DestroyStmt, + T_ExtendStmt, + T_FetchStmt, + T_IndexStmt, + T_MoveStmt, + T_ProcedureStmt, + T_PurgeStmt, + T_RecipeStmt, + T_RemoveFuncStmt, + T_RemoveOperStmt, + T_RemoveStmt, + T_RenameStmt, + T_RuleStmt, + T_NotifyStmt, + T_ListenStmt, + T_TransactionStmt, + T_ViewStmt, + T_LoadStmt, + T_CreatedbStmt, + T_DestroydbStmt, + T_VacuumStmt, + T_ExplainStmt, + + T_A_Expr = 700, + T_Attr, + T_A_Const, + T_ParamNo, + T_Ident, + T_FuncCall, + T_A_Indices, + T_ResTarget, + T_ParamString, + T_TimeRange, + T_RelExpr, + T_SortBy, + T_RangeVar, + T_TypeName, + T_IndexElem, + T_ColumnDef, + T_DefElem, + T_TargetEntry, + T_RangeTblEntry, + T_SortClause, + T_GroupClause +} NodeTag; + +/* + * The first field of a node of any type is gauranteed to be the NodeTag. + * Hence the type of any node can be gotten by casting it to Node. Declaring + * a variable to be of Node * (instead of void *) can also facilitate + * debugging. + */ +typedef struct Node { + NodeTag type; +} Node; + +#define nodeTag(_node_) ((Node*)_node_)->type + +#define makeNode(_node_) (_node_*)newNode(sizeof(_node_),T_##_node_) +#define NodeSetTag(n, t) ((Node *)n)->type = t + +#define IsA(_node_,_tag_) (nodeTag(_node_) == T_##_tag_) + +/* ---------------------------------------------------------------- + * IsA functions (no inheritence any more) + * ---------------------------------------------------------------- + */ +#define IsA_JoinPath(jp) \ + (nodeTag(jp)==T_JoinPath || nodeTag(jp)==T_MergePath || \ + nodeTag(jp)==T_HashPath) + +#define IsA_Join(j) \ + (nodeTag(j)==T_Join || nodeTag(j)==T_NestLoop || \ + nodeTag(j)==T_MergeJoin || nodeTag(j)==T_HashJoin) + +#define IsA_Temp(t) \ + (nodeTag(t)==T_Temp || nodeTag(t)==T_Material || nodeTag(t)==T_Sort || \ + nodeTag(t)==T_Unique) + +/* ---------------------------------------------------------------- + * extern declarations follow + * ---------------------------------------------------------------- + */ + +/* + * nodes/nodes.c + */ +extern Node *newNode(Size size, NodeTag tag); + +/* + * nodes/{outfuncs.c,print.c} + */ +#define nodeDisplay print + +extern char *nodeToString(void *obj); +extern void print(void *obj); + +/* + * nodes/{readfuncs.c,read.c} + */ +extern void *stringToNode(char *str); + +/* + * nodes/copyfuncs.c + */ +extern void *copyObject(void *obj); + +/* + * nodes/equalfuncs.c + */ +extern bool equal(void *a, void *b); + + +/* ---------------- + * I don't know why this is here. Most likely a hack.. + * -cim 6/3/90 + * ---------------- + */ +typedef float Cost; + +/* + * CmdType - + * enums for type of operation to aid debugging + * + * ??? could have put this in parsenodes.h but many files not in the + * optimizer also need this... + */ +typedef enum CmdType { + CMD_UNKNOWN, + CMD_SELECT, /* select stmt (formerly retrieve) */ + CMD_UPDATE, /* update stmt (formerly replace) */ + CMD_INSERT, /* insert stmt (formerly append) */ + CMD_DELETE, + CMD_NOTIFY, + CMD_UTILITY /* cmds like create, destroy, copy, vacuum, etc. */ +} CmdType; + + +#endif /* NODES_H */ diff --git a/src/include/nodes/params.h b/src/include/nodes/params.h new file mode 100644 index 0000000000..023d15bd41 --- /dev/null +++ b/src/include/nodes/params.h @@ -0,0 +1,90 @@ +/*------------------------------------------------------------------------- + * + * params.h-- + * Declarations/definitions of stuff needed to handle parameterized plans. + * + * + * Copyright (c) 1994, Regents of the University of California + * + * $Id: params.h,v 1.1 1996/08/28 01:57:39 scrappy Exp $ + * + *------------------------------------------------------------------------- + */ +#ifndef PARAMS_H +#define PARAMS_H + +#include "postgres.h" +#include "access/attnum.h" + +/* ---------------------------------------------------------------- + * + * The following are the possible values for the 'paramkind' + * field of a Param node. + * + * PARAM_NAMED: The parameter has a name, i.e. something + * like `$.salary' or `$.foobar'. + * In this case field `paramname' must be a valid Name. + * and field `paramid' must be == 0. + * + * PARAM_NUM: The parameter has only a numeric identifier, + * i.e. something like `$1', `$2' etc. + * The number is contained in the `parmid' field. + * + * PARAM_NEW: Used in PRS2 rule, similar to PARAM_NAMED. + * The `paramname' & `paramid' refer to the "NEW" tuple + * `paramname' is the attribute name and `paramid' its + * attribute number. + * + * PARAM_OLD: Same as PARAM_NEW, but in this case we refer to + * the "OLD" tuple. + */ + +#define PARAM_NAMED 11 +#define PARAM_NUM 12 +#define PARAM_NEW 13 +#define PARAM_OLD 14 +#define PARAM_INVALID 100 + + +/* ---------------------------------------------------------------- + * ParamListInfo + * + * Information needed in order for the executor to handle + * parameterized plans (you know, $.salary, $.name etc. stuff...). + * + * ParamListInfoData contains information needed when substituting a + * Param node with a Const node. + * + * kind : the kind of parameter. + * name : the parameter name (valid if kind == PARAM_NAMED, + * PARAM_NEW or PARAM_OLD) + * id : the parameter id (valid if kind == PARAM_NUM) + * or the attrno (if kind == PARAM_NEW or PARAM_OLD) + * type : PG_TYPE OID of the value + * length : length in bytes of the value + * isnull : true if & only if the value is null (if true then + * the fields 'length' and 'value' are undefined). + * value : the value that has to be substituted in the place + * of the parameter. + * + * ParamListInfo is to be used as an array of ParamListInfoData + * records. An 'InvalidName' in the name field of such a record + * indicates that this is the last record in the array. + * + * ---------------------------------------------------------------- + */ + +typedef struct ParamListInfoData { + int kind; + char *name; + AttrNumber id; + Oid type; + Size length; + bool isnull; + bool byval; + Datum value; +} ParamListInfoData; + +typedef ParamListInfoData *ParamListInfo; + +#endif /* PARAMS_H */ diff --git a/src/include/nodes/parsenodes.h b/src/include/nodes/parsenodes.h new file mode 100644 index 0000000000..fa9c61b3bd --- /dev/null +++ b/src/include/nodes/parsenodes.h @@ -0,0 +1,736 @@ +/*------------------------------------------------------------------------- + * + * parsenodes.h-- + * definitions for parse tree nodes + * + * + * Copyright (c) 1994, Regents of the University of California + * + * $Id: parsenodes.h,v 1.1 1996/08/28 01:57:40 scrappy Exp $ + * + *------------------------------------------------------------------------- + */ +#ifndef PARSENODES_H +#define PARSENODES_H + +#include "nodes/nodes.h" +#include "nodes/pg_list.h" +#include "nodes/primnodes.h" +#include "utils/tqual.h" + +/***************************************************************************** + * Query Tree + *****************************************************************************/ + +/* + * Query - + * all statments are turned into a Query tree (via transformStmt) + * for further processing by the optimizer + * utility statements (i.e. non-optimizable statements) + * have the *utilityStmt field set. + * + * we need the isPortal flag because portal names can be null too; can + * get rid of it if we support CURSOR as a commandType. + * + */ +typedef struct Query { + NodeTag type; + + CmdType commandType; /* select|insert|update|delete|utility */ + + Node *utilityStmt; /* non-null if this is a non-optimizable + statement */ + + int resultRelation; /* target relation (index to rtable) */ + char *into; /* portal (cursor) name */ + bool isPortal; /* is this a retrieve into portal? */ + bool isBinary; /* binary portal? */ + + char *uniqueFlag; /* NULL, '*', or Unique attribute name */ + List *sortClause; /* a list of SortClause's */ + + List *rtable; /* list of range table entries */ + List *targetList; /* target list (of TargetEntry) */ + Node *qual; /* qualifications */ + + List *groupClause; /* list of columns to specified in GROUP BY */ + Node *havingQual; /* qualification of each group */ + + int qry_numAgg; /* number of aggregates in the target list */ + Aggreg **qry_aggs; /* the aggregates */ + + /* internal to planner */ + List *base_relation_list_; /* base relation list */ + List *join_relation_list_; /* list of relations generated by joins */ + bool query_is_archival_; /* archival query flag */ +} Query; + + +/***************************************************************************** + * Other Statements (no optimizations required) + * + * Some of them require a little bit of transformation (which is also + * done by transformStmt). The whole structure is then passed on to + * ProcessUtility (by-passing the optimization step) as the utilityStmt + * field in Query. + *****************************************************************************/ + +/* ---------------------- + * Add Column Statement + * ---------------------- + */ +typedef struct AddAttrStmt { + NodeTag type; + char *relname; /* the relation to add attr */ + bool inh; /* add recursively to children? */ + struct ColumnDef *colDef; /* the attribute definition */ +} AddAttrStmt; + +/* ---------------------- + * Change ACL Statement + * ---------------------- + */ +typedef struct ChangeACLStmt { + NodeTag type; + struct AclItem *aclitem; + unsigned modechg; + List *relNames; +} ChangeACLStmt; + +/* ---------------------- + * Close Portal Statement + * ---------------------- + */ +typedef struct ClosePortalStmt { + NodeTag type; + char *portalname; /* name of the portal (cursor) */ +} ClosePortalStmt; + +/* ---------------------- + * Copy Statement + * ---------------------- + */ +typedef struct CopyStmt { + NodeTag type; + bool binary; /* is a binary copy? */ + char *relname; /* the relation to copy */ + bool oids; /* copy oid's? */ + int direction; /* TO or FROM */ + char *filename; /* if NULL, use stdin/stdout */ + char *delimiter; /* delimiter character, \t by default*/ +} CopyStmt; + +/* ---------------------- + * Create Table Statement + * ---------------------- + */ +typedef enum ArchType { + ARCH_NONE, ARCH_LIGHT, ARCH_HEAVY /* archive mode */ +} ArchType; + +typedef struct CreateStmt { + NodeTag type; + char *relname; /* the relation to create */ + List *tableElts; /* column definitions + list of ColumnDef */ + List *inhRelnames; /* relations to inherit from + list of Value (string) */ + ArchType archiveType; /* archive mode (ARCH_NONE if none */ + int location; /* smgrid (-1 if none) */ + int archiveLoc; /* smgrid (-1 if none) */ +} CreateStmt; + +/* ---------------------- + * Create Version Statement + * ---------------------- + */ +typedef struct VersionStmt { + NodeTag type; + char *relname; /* the new relation */ + int direction; /* FORWARD | BACKWARD */ + char *fromRelname; /* relation to create a version */ + char *date; /* date of the snapshot */ +} VersionStmt; + +/* ---------------------- + * Create {Operator|Type|Aggregate} Statement + * ---------------------- + */ +typedef struct DefineStmt { + NodeTag type; + int defType; /* OPERATOR|P_TYPE|AGGREGATE*/ + char *defname; + List *definition; /* a list of DefElem */ +} DefineStmt; + +/* ---------------------- + * Drop Table Statement + * ---------------------- + */ +typedef struct DestroyStmt { + NodeTag type; + List *relNames; /* relations to be dropped */ +} DestroyStmt; + +/* ---------------------- + * Extend Index Statement + * ---------------------- + */ +typedef struct ExtendStmt { + NodeTag type; + char *idxname; /* name of the index */ + Node *whereClause; /* qualifications */ + List *rangetable; /* range table, filled in + by transformStmt() */ +} ExtendStmt; + +/* ---------------------- + * Begin Recipe Statement + * ---------------------- + */ +typedef struct RecipeStmt { + NodeTag type; + char *recipeName; /* name of the recipe*/ +} RecipeStmt; + +/* ---------------------- + * Fetch Statement + * ---------------------- + */ +typedef struct FetchStmt { + NodeTag type; + int direction; /* FORWARD or BACKWARD */ + int howMany; /* amount to fetch ("ALL" --> 0) */ + char *portalname; /* name of portal (cursor) */ +} FetchStmt; + +/* ---------------------- + * Create Index Statement + * ---------------------- + */ +typedef struct IndexStmt { + NodeTag type; + char *idxname; /* name of the index */ + char *relname; /* name of relation to index on */ + char *accessMethod; /* name of acess methood (eg. btree) */ + List *indexParams; /* a list of IndexElem */ + List *withClause; /* a list of ParamString */ + Node *whereClause; /* qualifications */ + List *rangetable; /* range table, filled in + by transformStmt() */ + bool *lossy; /* is index lossy? */ +} IndexStmt; + +/* ---------------------- + * Move Statement (Not implemented) + * ---------------------- + */ +typedef struct MoveStmt { + NodeTag type; + int direction; /* FORWARD or BACKWARD */ + bool to; + int where; + char *portalname; +} MoveStmt; + +/* ---------------------- + * Create Function Statement + * ---------------------- + */ +typedef struct ProcedureStmt { + NodeTag type; + char *funcname; /* name of function to create */ + List *defArgs; /* list of definitions + a list of strings (as Value *) */ + Node *returnType; /* the return type (as a string or + a TypeName (ie.setof) */ + List *withClause; /* a list of ParamString */ + char *as; /* the SQL statement or filename */ + char *language; /* C or SQL */ +} ProcedureStmt; + +/* ---------------------- + * Purge Statement + * ---------------------- + */ +typedef struct PurgeStmt { + NodeTag type; + char *relname; /* relation to purge */ + char *beforeDate; /* purge before this date */ + char *afterDate; /* purge after this date */ +} PurgeStmt; + +/* ---------------------- + * Drop Function Statement + * ---------------------- + */ +typedef struct RemoveFuncStmt { + NodeTag type; + char *funcname; /* function to drop */ + List *args; /* types of the arguments */ +} RemoveFuncStmt; + +/* ---------------------- + * Drop Operator Statement + * ---------------------- + */ +typedef struct RemoveOperStmt { + NodeTag type; + char *opname; /* operator to drop */ + List *args; /* types of the arguments */ +} RemoveOperStmt; + +/* ---------------------- + * Drop {Aggregate|Type|Index|Rule|View} Statement + * ---------------------- + */ +typedef struct RemoveStmt { + NodeTag type; + int removeType; /* AGGREGATE|P_TYPE|INDEX|RULE|VIEW */ + char *name; /* name to drop */ +} RemoveStmt; + +/* ---------------------- + * Alter Table Statement + * ---------------------- + */ +typedef struct RenameStmt { + NodeTag type; + char *relname; /* relation to be altered */ + bool inh; /* recursively alter children? */ + char *column; /* if NULL, rename the relation name + to the new name. Otherwise, rename + this column name. */ + char *newname; /* the new name */ +} RenameStmt; + +/* ---------------------- + * Create Rule Statement + * ---------------------- + */ +typedef struct RuleStmt { + NodeTag type; + char *rulename; /* name of the rule */ + Node *whereClause; /* qualifications */ + CmdType event; /* RETRIEVE */ + struct Attr *object; /* object affected */ + bool instead; /* is a 'do instead'? */ + List *actions; /* the action statements */ +} RuleStmt; + +/* ---------------------- + * Notify Statement + * ---------------------- + */ +typedef struct NotifyStmt { + NodeTag type; + char *relname; /* relation to notify */ +} NotifyStmt; + +/* ---------------------- + * Listen Statement + * ---------------------- + */ +typedef struct ListenStmt { + NodeTag type; + char *relname; /* relation to listen on */ +} ListenStmt; + +/* ---------------------- + * {Begin|Abort|End} Transaction Statement + * ---------------------- + */ +typedef struct TransactionStmt { + NodeTag type; + int command; /* BEGIN|END|ABORT */ +} TransactionStmt; + +/* ---------------------- + * Create View Statement + * ---------------------- + */ +typedef struct ViewStmt { + NodeTag type; + char *viewname; /* name of the view */ + Query *query; /* the SQL statement */ +} ViewStmt; + +/* ---------------------- + * Load Statement + * ---------------------- + */ +typedef struct LoadStmt { + NodeTag type; + char *filename; /* file to load */ +} LoadStmt; + +/* ---------------------- + * Createdb Statement + * ---------------------- + */ +typedef struct CreatedbStmt { + NodeTag type; + char *dbname; /* database to create */ +} CreatedbStmt; + +/* ---------------------- + * Destroydb Statement + * ---------------------- + */ +typedef struct DestroydbStmt { + NodeTag type; + char *dbname; /* database to drop */ +} DestroydbStmt; + +/* ---------------------- + * Cluster Statement (support pbrown's cluster index implementation) + * ---------------------- + */ +typedef struct ClusterStmt { + NodeTag type; + char *relname; /* relation being indexed */ + char *indexname; /* original index defined */ +} ClusterStmt; + +/* ---------------------- + * Vacuum Statement + * ---------------------- + */ +typedef struct VacuumStmt { + NodeTag type; + char *vacrel; /* table to vacuum */ +} VacuumStmt; + +/* ---------------------- + * Explain Statement + * ---------------------- + */ +typedef struct ExplainStmt { + NodeTag type; + Query *query; /* the query */ + List *options; +} ExplainStmt; + + +/***************************************************************************** + * Optimizable Statements + *****************************************************************************/ + +/* ---------------------- + * Insert Statement + * ---------------------- + */ +typedef struct AppendStmt { + NodeTag type; + char *relname; /* relation to insert into */ + List *cols; /* names of the columns */ + List *exprs; /* the expressions (same order as + the columns) */ + List *fromClause; /* the from clause */ + Node *whereClause; /* qualifications */ +} AppendStmt; + +/* ---------------------- + * Delete Statement + * ---------------------- + */ +typedef struct DeleteStmt { + NodeTag type; + char *relname; /* relation to delete from */ + Node *whereClause; /* qualifications */ +} DeleteStmt; + +/* ---------------------- + * Update Statement + * ---------------------- + */ +typedef struct ReplaceStmt { + NodeTag type; + char *relname; /* relation to update */ + List *targetList; /* the target list (of ResTarget) */ + Node *whereClause; /* qualifications */ + List *fromClause; /* the from clause */ +} ReplaceStmt; + +/* ---------------------- + * Create Cursor Statement + * ---------------------- + */ +typedef struct CursorStmt { + NodeTag type; + char *portalname; /* the portal (cursor) to create */ + bool binary; /* a binary (internal) portal? */ + char *unique; /* NULL, "*", or unique attribute name */ + List *targetList; /* the target list (of ResTarget) */ + List *fromClause; /* the from clause */ + Node *whereClause; /* qualifications */ + List *groupClause; /* group by clause */ + List *orderClause; /* sort clause (a list of SortBy's) */ +} CursorStmt; + +/* ---------------------- + * Select Statement + * ---------------------- + */ +typedef struct RetrieveStmt { + NodeTag type; + char *unique; /* NULL, '*', or unique attribute name */ + char *into; /* name of table (for select into + table) */ + List *targetList; /* the target list (of ResTarget) */ + List *fromClause; /* the from clause */ + Node *whereClause; /* qualifications */ + List *groupClause; /* group by clause */ + Node *havingClause; /* having conditional-expression */ + List *orderClause; /* sort clause (a list of SortBy's) */ +} RetrieveStmt; + + +/**************************************************************************** + * Supporting data structures for Parse Trees + ****************************************************************************/ + +/* + * TypeName - specifies a type in definitions + */ +typedef struct TypeName { + NodeTag type; + char *name; /* name of the type */ + bool setof; /* is a set? */ + List *arrayBounds; /* array bounds */ + int typlen; /* length for char() and varchar() */ +} TypeName; + +/* + * ParamNo - specifies a parameter reference + */ +typedef struct ParamNo { + NodeTag type; + int number; /* the number of the parameter */ + TypeName *typename; /* the typecast */ +} ParamNo; + +/* + * A_Expr - binary expressions + */ +typedef struct A_Expr { + NodeTag type; + int oper; /* type of operation + {OP,OR,AND,NOT,ISNULL,NOTNULL} */ + char *opname; /* name of operator/function */ + Node *lexpr; /* left argument */ + Node *rexpr; /* right argument */ +} A_Expr; + +/* + * Attr - + * specifies an Attribute (ie. a Column); could have nested dots or + * array references. + * + */ +typedef struct Attr { + NodeTag type; + char *relname; /* name of relation (can be "*") */ + ParamNo *paramNo; /* or a parameter */ + List *attrs; /* attributes (possibly nested); + list of Values (strings) */ + List *indirection; /* array refs (list of A_Indices') */ +} Attr; + +/* + * A_Const - a constant expression + */ +typedef struct A_Const { + NodeTag type; + Value val; /* the value (with the tag) */ + TypeName *typename; /* typecast */ +} A_Const; + +/* + * ColumnDef - column definition (used in various creates) + */ +typedef struct ColumnDef { + NodeTag type; + char *colname; /* name of column */ + TypeName *typename; /* type of column */ +} ColumnDef; + +/* + * Ident - + * an identifier (could be an attribute or a relation name). Depending + * on the context at transformStmt time, the identifier is treated as + * either a relation name (in which case, isRel will be set) or an + * attribute (in which case, it will be transformed into an Attr). + */ +typedef struct Ident { + NodeTag type; + char *name; /* its name */ + List *indirection; /* array references */ + bool isRel; /* is a relation - filled in by + transformExpr() */ +} Ident; + +/* + * FuncCall - a function/aggregate invocation + */ +typedef struct FuncCall { + NodeTag type; + char *funcname; /* name of function */ + List *args; /* the arguments (list of exprs) */ +} FuncCall; + +/* + * A_Indices - array reference or bounds ([lidx:uidx] or [uidx]) + */ +typedef struct A_Indices { + NodeTag type; + Node *lidx; /* could be NULL */ + Node *uidx; +} A_Indices; + +/* + * ResTarget - + * result target (used in target list of pre-transformed Parse trees) + */ +typedef struct ResTarget { + NodeTag type; + char *name; /* name of the result column */ + List *indirection; /* array references */ + Node *val; /* the value of the result + (A_Expr or Attr) */ +} ResTarget; + +/* + * ParamString - used in with clauses + */ +typedef struct ParamString { + NodeTag type; + char *name; + char *val; +} ParamString; + +/* + * TimeRange - specifies a time range + */ +typedef struct TimeRange { + NodeTag type; + char *startDate; + char *endDate; /* snapshot if NULL */ +} TimeRange; + +/* + * RelExpr - relation expressions + */ +typedef struct RelExpr { + NodeTag type; + char *relname; /* the relation name */ + bool inh; /* inheritance query */ + TimeRange *timeRange; /* the time range */ +} RelExpr; + +/* + * Sortby - for order by clause + */ +typedef struct SortBy { + NodeTag type; + char *range; + char *name; /* name of column to sort on */ + char *useOp; /* operator to use */ +} SortBy; + +/* + * RangeVar - range variable, used in from clauses + */ +typedef struct RangeVar { + NodeTag type; + RelExpr *relExpr; /* the relation expression */ + char *name; /* the name to be referenced + (optional) */ +} RangeVar; + +/* + * IndexElem - index parameters (used in create index) + */ +typedef struct IndexElem { + NodeTag type; + char *name; /* name of index */ + List *args; /* if not NULL, function index */ + char *class; + TypeName *tname; /* type of index's keys (optional) */ +} IndexElem; + +/* + * DefElem - + * a definition (used in definition lists in the form of defname = arg) + */ +typedef struct DefElem { + NodeTag type; + char *defname; + Node *arg; /* a (Value *) or a (TypeName *) */ +} DefElem; + + +/**************************************************************************** + * Nodes for a Query tree + ****************************************************************************/ + +/* + * TargetEntry - + * a target entry (used in the transformed target list) + * + * one of resdom or fjoin is not NULL. a target list is + * (( expr) ( expr) ...) + */ +typedef struct TargetEntry { + NodeTag type; + Resdom *resdom; /* fjoin overload this to be a list??*/ + Fjoin *fjoin; + Node *expr; /* can be a list too */ +} TargetEntry; + +/* + * RangeTblEntry - + * used in range tables. Some of the following are only used in one of + * the parsing, optimizing, execution stages. + * + * inFromCl marks those range variables that are listed in the from clause. + * In SQL, the targetlist can only refer to range variables listed in the + * from clause but POSTQUEL allows you to refer to tables not specified, in + * which case a range table entry will be generated. We use POSTQUEL + * semantics which is more powerful. However, we need SQL semantics in + * some cases (eg. when expanding a '*') + */ +typedef struct RangeTblEntry { + NodeTag type; + char *relname; /* real name of the relation */ + TimeRange *timeRange; /* time range */ + char *refname; /* the reference name (specified in + the from clause) */ + Oid relid; + bool inh; /* inheritance? */ + bool archive; /* filled in by plan_archive */ + bool inFromCl; /* comes from From Clause */ + TimeQual timeQual; /* filled in by pg_plan */ +} RangeTblEntry; + +/* + * SortClause - + * used in the sort clause for retrieves and cursors + */ +typedef struct SortClause { + NodeTag type; + Resdom *resdom; /* attributes in tlist to be sorted */ + Oid opoid; /* sort operators */ +} SortClause; + +/* + * GroupClause - + * used in the GROUP BY clause + */ +typedef struct GroupClause { + NodeTag type; + Var *grpAttr; /* attributes to group on */ + Oid grpOpoid; /* the sort operator to use */ +} GroupClause; + +#endif /* PARSENODES_H */ diff --git a/src/include/nodes/pg_list.h b/src/include/nodes/pg_list.h new file mode 100644 index 0000000000..6612fbf953 --- /dev/null +++ b/src/include/nodes/pg_list.h @@ -0,0 +1,112 @@ +/*------------------------------------------------------------------------- + * + * pg_list.h-- + * POSTGRES generic list package + * + * + * Copyright (c) 1994, Regents of the University of California + * + * $Id: pg_list.h,v 1.1 1996/08/28 01:57:42 scrappy Exp $ + * + *------------------------------------------------------------------------- + */ +#ifndef PG_LIST_H +#define PG_LIST_H + +#include +#include "c.h" +#include "nodes/nodes.h" + +/* ---------------------------------------------------------------- + * node definitions + * ---------------------------------------------------------------- + */ + +/*---------------------- + * Value node + *---------------------- + */ +typedef struct Value { + NodeTag type; /* tag appropriately (eg. T_String) */ + union ValUnion { + char *str; /* string */ + long ival; + double dval; + } val; +} Value; + +#define intVal(v) (((Value *)v)->val.ival) +#define floatVal(v) (((Value *)v)->val.dval) +#define strVal(v) (((Value *)v)->val.str) + + +/*---------------------- + * List node + *---------------------- + */ +typedef struct List { + NodeTag type; + void *elem; + struct List *next; +} List; + +#define NIL ((List *) NULL) + +/* ---------------- + * accessor macros + * ---------------- + */ +#define lfirst(l) ((l)->elem) +#define lnext(l) ((l)->next) +#define lsecond(l) (lfirst(lnext(l))) + +/* + * foreach - + * a convenience macro which loops through the list + */ +#define foreach(_elt_,_list_) \ + for(_elt_=_list_; _elt_!=NIL;_elt_=lnext(_elt_)) + + +/* + * function prototypes in nodes/list.c + */ +extern int length(List *list); +extern List *append(List *list1, List *list2); +extern List *nconc(List *list1, List *list2); +extern List *lcons(void *datum, List *list); +extern bool member(void *foo, List *bar); +extern Value *makeInteger(long i); +extern Value *makeFloat(double d); +extern Value *makeString(char *str); +extern List *makeList(void *elem, ...); +extern List *lappend(List *list, void *obj); +extern List *lremove(void *elem, List *list); +extern void freeList(List *list); + +extern void *nth(int n, List *l); +extern void set_nth(List *l, int n, void *elem); + +/* hack for now */ +#define lconsi(i,l) lcons((void*)(int)i,l) +#define lfirsti(l) ((int)lfirst(l)) +#define lappendi(l,i) lappend(l,(void*)i) +extern bool intMember(int, List *); +extern List *intAppend(List *list1, List *list2); + +extern List *nreverse(List *); +extern List *set_difference(List *, List *); +extern List *set_differencei(List *, List *); +extern List *LispRemove(void *, List *); +extern List *intLispRemove(int, List *); +extern List *LispUnion(List *foo, List *bar); +extern List *LispUnioni(List *foo, List *bar); +extern bool same(List *foo, List *bar); + +/* should be in nodes.h but needs List */ +extern bool equali(List *a, List *b); + +/* in copyfuncs.c */ +extern List *listCopy(List *); + +#endif /* PG_LIST_H */ diff --git a/src/include/nodes/plannodes.h b/src/include/nodes/plannodes.h new file mode 100644 index 0000000000..cdbd5de127 --- /dev/null +++ b/src/include/nodes/plannodes.h @@ -0,0 +1,330 @@ +/*------------------------------------------------------------------------- + * + * plannodes.h-- + * definitions for query plan nodes + * + * + * Copyright (c) 1994, Regents of the University of California + * + * $Id: plannodes.h,v 1.1 1996/08/28 01:57:44 scrappy Exp $ + * + *------------------------------------------------------------------------- + */ +#ifndef PLANNODES_H +#define PLANNODES_H + +#include "postgres.h" + +#include "nodes/nodes.h" +#include "nodes/pg_list.h" +#include "nodes/primnodes.h" + +/* ---------------------------------------------------------------- + * Executor State types are used in the plannode structures + * so we have to include their definitions too. + * + * Node Type node information used by executor + * + * control nodes + * + * Existential ExistentialState exstate; + * Result ResultState resstate; + * Append AppendState unionstate; + * + * scan nodes + * + * Scan *** CommonScanState scanstate; + * IndexScan IndexScanState indxstate; + * + * (*** nodes which inherit Scan also inherit scanstate) + * + * join nodes + * + * NestLoop NestLoopState nlstate; + * MergeJoin MergeJoinState mergestate; + * HashJoin HashJoinState hashjoinstate; + * + * materialize nodes + * + * Material MaterialState matstate; + * Sort SortState sortstate; + * Unique UniqueState uniquestate; + * Hash HashState hashstate; + * + * ---------------------------------------------------------------- + */ +#include "nodes/execnodes.h" /* XXX move executor types elsewhere */ + + +/* ---------------------------------------------------------------- + * node definitions + * ---------------------------------------------------------------- + */ + +/* ---------------- + * Plan node + * ---------------- + */ + +typedef struct Plan { + NodeTag type; + Cost cost; + int plan_size; + int plan_width; + int plan_tupperpage; + EState *state; /* at execution time, state's of individual + nodes point to one EState for the + whole top-level plan */ + List *targetlist; + List *qual; /* Node* or List* ?? */ + struct Plan *lefttree; + struct Plan *righttree; +} Plan; + +/* ---------------- + * these are are defined to avoid confusion problems with "left" + * and "right" and "inner" and "outer". The convention is that + * the "left" plan is the "outer" plan and the "right" plan is + * the inner plan, but these make the code more readable. + * ---------------- + */ +#define innerPlan(node) (((Plan *)(node))->righttree) +#define outerPlan(node) (((Plan *)(node))->lefttree) + + +/* + * =============== + * Top-level nodes + * =============== + */ + +/* all plan nodes "derive" from the Plan structure by having the + Plan structure as the first field. This ensures that everything works + when nodes are cast to Plan's. (node pointers are frequently cast to Plan* + when passed around generically in the executor */ + + +/* ---------------- + * existential node + * ---------------- + */ +typedef Plan Existential; + +/* ---------------- + * result node - + * returns tuples from outer plan that satisfy the qualifications + * ---------------- + */ +typedef struct Result { + Plan plan; + Node *resconstantqual; + ResultState *resstate; +} Result; + +/* ---------------- + * append node + * ---------------- + */ +typedef struct Append { + Plan plan; + List *unionplans; + Index unionrelid; + List *unionrtentries; + AppendState *unionstate; +} Append; + +/* + * ========== + * Scan nodes + * ========== + */ +typedef struct Scan { + Plan plan; + Index scanrelid; /* relid is index into the range table */ + CommonScanState *scanstate; +} Scan; + +/* ---------------- + * sequential scan node + * ---------------- + */ +typedef Scan SeqScan; + +/* ---------------- + * index scan node + * ---------------- + */ +typedef struct IndexScan { + Scan scan; + List *indxid; + List *indxqual; + IndexScanState *indxstate; +} IndexScan; + +/* + * ========== + * Join nodes + * ========== + */ + +/* ---------------- + * Join node + * ---------------- + */ +typedef Plan Join; + +/* ---------------- + * nest loop join node + * ---------------- + */ +typedef struct NestLoop { + Join join; + NestLoopState *nlstate; +} NestLoop; + +/* ---------------- + * merge join node + * ---------------- + */ +typedef struct MergeJoin { + Join join; + List *mergeclauses; + Oid mergesortop; + Oid *mergerightorder; /* inner sort operator */ + Oid *mergeleftorder; /* outer sort operator */ + MergeJoinState *mergestate; +} MergeJoin; + +/* ---------------- + * hash join (probe) node + * ---------------- + */ +typedef struct HashJoin { + Join join; + List *hashclauses; + Oid hashjoinop; + HashJoinState *hashjoinstate; + HashJoinTable hashjointable; + IpcMemoryKey hashjointablekey; + int hashjointablesize; + bool hashdone; +} HashJoin; + +/* --------------- + * aggregate node + * --------------- + */ +typedef struct Agg { + Plan plan; + int numAgg; + Aggreg **aggs; + AggState *aggstate; +} Agg; + +/* --------------- + * group node - + * use for queries with GROUP BY specified. + * + * If tuplePerGroup is true, one tuple (with group columns only) is + * returned for each group and NULL is returned when there are no more + * groups. Otherwise, all the tuples of a group are returned with a + * NULL returned at the end of each group. (see nodeGroup.c for details) + * --------------- + */ +typedef struct Group { + Plan plan; + bool tuplePerGroup; /* what tuples to return (see above) */ + int numCols; /* number of group columns */ + AttrNumber *grpColIdx; /* index into the target list */ + GroupState *grpstate; +} Group; + +/* + * ========== + * Temp nodes + * ========== + */ +typedef struct Temp { + Plan plan; + Oid tempid; + int keycount; +} Temp; + +/* ---------------- + * materialization node + * ---------------- + */ +typedef struct Material { + Plan plan; /* temp node flattened out */ + Oid tempid; + int keycount; + MaterialState *matstate; +} Material; + +/* ---------------- + * sort node + * ---------------- + */ +typedef struct Sort { + Plan plan; /* temp node flattened out */ + Oid tempid; + int keycount; + SortState *sortstate; +} Sort; + +/* ---------------- + * unique node + * ---------------- + */ +typedef struct Unique { + Plan plan; /* temp node flattened out */ + Oid tempid; + int keycount; + char *uniqueAttr; /* NULL if all attrs, + or unique attribute name */ + AttrNumber uniqueAttrNum; /* attribute number of attribute + to select distinct on */ + UniqueState *uniquestate; +} Unique; + +/* ---------------- + * hash build node + * ---------------- + */ +typedef struct Hash { + Plan plan; + Var *hashkey; + HashState *hashstate; + HashJoinTable hashtable; + IpcMemoryKey hashtablekey; + int hashtablesize; +} Hash; + +/* --------------------- + * choose node + * --------------------- + */ +typedef struct Choose { + Plan plan; + List *chooseplanlist; +} Choose; + +/* ------------------- + * Tee node information + * + * leftParent : the left parent of this node + * rightParent: the right parent of this node + * ------------------- +*/ +typedef struct Tee { + Plan plan; + Plan* leftParent; + Plan* rightParent; + TeeState *teestate; + char *teeTableName; /* the name of the table to materialize + the tee into */ + List *rtentries; /* the range table for the plan below the Tee + may be different than the parent plans */ +} Tee; + +#endif /* PLANNODES_H */ diff --git a/src/include/nodes/primnodes.h b/src/include/nodes/primnodes.h new file mode 100644 index 0000000000..0e667a05af --- /dev/null +++ b/src/include/nodes/primnodes.h @@ -0,0 +1,318 @@ +/*------------------------------------------------------------------------- + * + * primnodes.h-- + * Definitions for parse tree/query tree ("primitive") nodes. + * + * + * Copyright (c) 1994, Regents of the University of California + * + * $Id: primnodes.h,v 1.1 1996/08/28 01:57:46 scrappy Exp $ + * + *------------------------------------------------------------------------- + */ +#ifndef PRIMNODES_H +#define PRIMNODES_H + +#include "postgres.h" + +#include "access/attnum.h" +#include "storage/buf.h" +#include "utils/rel.h" +#include "utils/fcache.h" +#include "nodes/params.h" + +#include "nodes/nodes.h" +#include "nodes/pg_list.h" + +/* ---------------------------------------------------------------- + * node definitions + * ---------------------------------------------------------------- + */ + +/* ---------------- + * Resdom (Result Domain) + * resno - attribute number + * restype - type of the resdom + * reslen - length (in bytes) of the result + * resname - name of the resdom (could be NULL) + * reskey - order of key in a sort (for those > 0) + * reskeyop - sort operator Oid + * resjunk - set to nonzero to eliminate the attribute + * from final target list e.g., ctid for replace + * and delete + * + * ---------------- + */ +typedef struct Resdom { + NodeTag type; + AttrNumber resno; + Oid restype; + int reslen; + char *resname; + Index reskey; + Oid reskeyop; + int resjunk; +} Resdom; + +/* ------------- + * Fjoin + * initialized - true if the Fjoin has already been initialized for + * the current target list evaluation + * nNodes - The number of Iter nodes returning sets that the + * node will flatten + * outerList - 1 or more Iter nodes + * inner - exactly one Iter node. We eval every node in the + * outerList once then eval the inner node to completion + * pair the outerList result vector with each inner + * result to form the full result. When the inner has + * been exhausted, we get the next outer result vector + * and reset the inner. + * results - The complete (flattened) result vector + * alwaysNull - a null vector to indicate sets with a cardinality of + * 0, we treat them as the set {NULL}. + */ +typedef struct Fjoin { + NodeTag type; + bool fj_initialized; + int fj_nNodes; + List *fj_innerNode; + DatumPtr fj_results; + BoolPtr fj_alwaysDone; +} Fjoin; + +/* ---------------- + * Expr + * typeOid - oid of the type of this expression + * opType - type of this expression + * oper - the Oper node if it is an OPER_EXPR or the + * Func node if it is a FUNC_EXPR + * args - arguments to this expression + * ---------------- + */ +typedef enum OpType { + OP_EXPR, FUNC_EXPR, OR_EXPR, AND_EXPR, NOT_EXPR +} OpType; + +typedef struct Expr { + NodeTag type; + Oid typeOid; /* oid of the type of this expr */ + OpType opType; /* type of the op */ + Node *oper; /* could be Oper or Func */ + List *args; /* list of argument nodes */ +} Expr; + +/* ---------------- + * Var + * varno - index of this var's relation in the range table + * (could be INNER or OUTER) + * varattno - attribute number of this var + * vartype - pg_type tuple oid for the type of this var + * varnoold - keep varno around in case it got changed to INNER/ + * OUTER (see match_varid) + * varoattno - attribute number of this var + * [ '(varnoold varoattno) was varid -ay 2/95] + * ---------------- + */ +#define INNER 65000 +#define OUTER 65001 + +#define PRS2_CURRENT_VARNO 1 +#define PRS2_NEW_VARNO 2 + +typedef struct Var { + NodeTag type; + Index varno; + AttrNumber varattno; + Oid vartype; + Index varnoold; /* only used by optimizer */ + AttrNumber varoattno; /* only used by optimizer */ +} Var; + +/* ---------------- + * Oper + * opno - PG_OPERATOR OID of the operator + * opid - PG_PROC OID for the operator + * opresulttype - PG_TYPE OID of the operator's return value + * opsize - size of return result (cached by executor) + * op_fcache - XXX comment me. + * + * ---- + * NOTE: in the good old days 'opno' used to be both (or either, or + * neither) the pg_operator oid, and/or the pg_proc oid depending + * on the postgres module in question (parser->pg_operator, + * executor->pg_proc, planner->both), the mood of the programmer, + * and the phase of the moon (rumors that it was also depending on the day + * of the week are probably false). To make things even more postgres-like + * (i.e. a mess) some comments were referring to 'opno' using the name + * 'opid'. Anyway, now we have two separate fields, and of course that + * immediately removes all bugs from the code... [ sp :-) ]. + * ---------------- + */ +typedef struct Oper { + NodeTag type; + Oid opno; + Oid opid; + Oid opresulttype; + int opsize; + FunctionCachePtr op_fcache; +} Oper; + + +/* ---------------- + * Const + * consttype - PG_TYPE OID of the constant's value + * constlen - length in bytes of the constant's value + * constvalue - the constant's value + * constisnull - whether the constant is null + * (if true, the other fields are undefined) + * constbyval - whether the information in constvalue + * if passed by value. If true, then all the information + * is stored in the datum. If false, then the datum + * contains a pointer to the information. + * constisset - whether the const represents a set. The const + * value corresponding will be the query that defines + * the set. + * ---------------- + */ +typedef struct Const { + NodeTag type; + Oid consttype; + Size constlen; + Datum constvalue; + bool constisnull; + bool constbyval; + bool constisset; +} Const; + +/* ---------------- + * Param + * paramkind - specifies the kind of parameter. The possible values + * for this field are specified in "params.h", and they are: + * + * PARAM_NAMED: The parameter has a name, i.e. something + * like `$.salary' or `$.foobar'. + * In this case field `paramname' must be a valid Name. + * + * PARAM_NUM: The parameter has only a numeric identifier, + * i.e. something like `$1', `$2' etc. + * The number is contained in the `paramid' field. + * + * PARAM_NEW: Used in PRS2 rule, similar to PARAM_NAMED. + * The `paramname' and `paramid' refer to the "NEW" tuple + * The `pramname' is the attribute name and `paramid' + * is the attribute number. + * + * PARAM_OLD: Same as PARAM_NEW, but in this case we refer to + * the "OLD" tuple. + * + * paramid - numeric identifier for literal-constant parameters ("$1") + * paramname - attribute name for tuple-substitution parameters ("$.foo") + * paramtype - PG_TYPE OID of the parameter's value + * param_tlist - allows for projection in a param node. + * ---------------- + */ +typedef struct Param { + NodeTag type; + int paramkind; + AttrNumber paramid; + char *paramname; + Oid paramtype; + List *param_tlist; +} Param; + + +/* ---------------- + * Func + * funcid - PG_FUNCTION OID of the function + * functype - PG_TYPE OID of the function's return value + * funcisindex - the function can be evaluated by scanning an index + * (set during query optimization) + * funcsize - size of return result (cached by executor) + * func_fcache - runtime state while running this function. Where + * we are in the execution of the function if it + * returns more than one value, etc. + * See utils/fcache.h + * func_tlist - projection of functions returning tuples + * func_planlist - result of planning this func, if it's a PQ func + * ---------------- + */ +typedef struct Func { + NodeTag type; + Oid funcid; + Oid functype; + bool funcisindex; + int funcsize; + FunctionCachePtr func_fcache; + List *func_tlist; + List *func_planlist; +} Func; + +/* ---------------- + * Aggreg + * aggname - name of the aggregate + * basetype - base type Oid of the aggregate + * aggtype - type Oid of final result of the aggregate + * query - XXX comment me + * target - XXX comment me + * ---------------- + */ +typedef struct Aggreg { + NodeTag type; + char *aggname; + Oid basetype; /* base type of the aggregate */ + Oid aggtype; /* type of final result */ + Node *target; /* attribute to aggreg on */ + int aggno; /* index to ecxt_values */ +} Aggreg; + +/* ---------------- + * Array + * arrayelemtype - base type of the array's elements (homogenous!) + * arrayelemlength - length of that type + * arrayelembyval - can you pass this element by value? + * arrayndim - number of dimensions of the array + * arraylow - base for array indexing + * arrayhigh - limit for array indexing + * arraylen - + * ---------------- + * + * memo from mao: the array support we inherited from 3.1 is just + * wrong. when time exists, we should redesign this stuff to get + * around a bunch of unfortunate implementation decisions made there. + */ +typedef struct Array { + NodeTag type; + Oid arrayelemtype; + int arrayelemlength; + bool arrayelembyval; + int arrayndim; + IntArray arraylow; + IntArray arrayhigh; + int arraylen; +} Array; + +/* ---------------- + * ArrayRef: + * refelemtype - type of the element referenced here + * refelemlength - length of that type + * refelembyval - can you pass this element type by value? + * refupperindexpr - expressions that evaluate to upper array index + * reflowerexpr- the expressions that evaluate to a lower array index + * refexpr - the expression that evaluates to an array + * refassignexpr- the expression that evaluates to the new value + * to be assigned to the array in case of replace. + * ---------------- + */ +typedef struct ArrayRef { + NodeTag type; + int refattrlength; + int refelemlength; + Oid refelemtype; + bool refelembyval; + List *refupperindexpr; + List *reflowerindexpr; + Node *refexpr; + Node *refassgnexpr; +} ArrayRef; + +#endif /* PRIMNODES_H */ diff --git a/src/include/nodes/readfuncs.h b/src/include/nodes/readfuncs.h new file mode 100644 index 0000000000..bdc7f5a4db --- /dev/null +++ b/src/include/nodes/readfuncs.h @@ -0,0 +1,27 @@ +/*------------------------------------------------------------------------- + * + * readfuncs.h-- + * header file for read.c and readfuncs.c. These functions are internal + * to the stringToNode interface and should not be used by anyone else. + * + * Copyright (c) 1994, Regents of the University of California + * + * $Id: readfuncs.h,v 1.1 1996/08/28 01:57:47 scrappy Exp $ + * + *------------------------------------------------------------------------- + */ +#ifndef READFUNCS_H +#define READFUNCS_H + +/* + * prototypes for functions in read.c (the lisp token parser) + */ +extern char *lsptok(char *string, int *length); +extern void *nodeRead(bool read_car_only); + +/* + * prototypes for functions in readfuncs.c + */ +extern Node *parsePlanString(); + +#endif /* READFUNCS_H */ diff --git a/src/include/nodes/relation.h b/src/include/nodes/relation.h new file mode 100644 index 0000000000..2961e1f7d9 --- /dev/null +++ b/src/include/nodes/relation.h @@ -0,0 +1,279 @@ +/*------------------------------------------------------------------------- + * + * relation.h-- + * Definitions for internal planner nodes. + * + * + * Copyright (c) 1994, Regents of the University of California + * + * $Id: relation.h,v 1.1 1996/08/28 01:57:49 scrappy Exp $ + * + *------------------------------------------------------------------------- + */ +#ifndef RELATION_H +#define RELATION_H + +#include "c.h" +#include "nodes/pg_list.h" +#include "nodes/primnodes.h" +#include "nodes/parsenodes.h" +#include "nodes/nodes.h" + +/* + * Relid + * List of relation identifiers (indexes into the rangetable). + */ + +typedef List *Relid; + +/* + * Rel + * Per-base-relation information + * + * Parts of this data structure are specific to various scan and join + * mechanisms. It didn't seem worth creating new node types for them. + * + * relids - List of relation indentifiers + * indexed - true if the relation has secondary indices + * pages - number of pages in the relation + * tuples - number of tuples in the relation + * size - number of tuples in the relation after restrictions clauses + * have been applied + * width - number of bytes per tuple in the relation after the + * appropriate projections have been done + * targetlist - List of TargetList nodes + * pathlist - List of Path nodes, one for each possible method of + * generating the relation + * unorderedpath - a Path node generating this relation whose resulting + * tuples are unordered (this isn't necessarily a + * sequential scan path, e.g., scanning with a hash index + * leaves the tuples unordered) + * cheapestpath - least expensive Path (regardless of final order) + * pruneable - flag to let the planner know whether it can prune the plan + * space of this Rel or not. -- JMH, 11/11/92 + * + * * If the relation is a (secondary) index it will have the following + * three fields: + * + * classlist - List of PG_AMOPCLASS OIDs for the index + * indexkeys - List of base-relation attribute numbers that are index keys + * ordering - List of PG_OPERATOR OIDs which order the indexscan result + * relam - the OID of the pg_am of the index + * + * * The presence of the remaining fields depends on the restrictions + * and joins which the relation participates in: + * + * clauseinfo - List of ClauseInfo nodes, containing info about each + * qualification clause in which this relation participates + * joininfo - List of JoinInfo nodes, containing info about each join + * clause in which this relation participates + * innerjoin - List of Path nodes that represent indices that may be used + * as inner paths of nestloop joins + * + * NB. the last element of the arrays classlist, indexkeys and ordering + * is always 0. 2/95 - ay + */ + +typedef struct Rel { + NodeTag type; + + /* all relations: */ + Relid relids; + + /* catalog statistics information */ + bool indexed; + int pages; + int tuples; + int size; + int width; + + /* materialization information */ + List *targetlist; + List *pathlist; + struct Path *unorderedpath; + struct Path *cheapestpath; + bool pruneable; + + /* used solely by indices: */ + Oid *classlist; /* classes of AM operators */ + int *indexkeys; /* keys over which we're indexing */ + Oid relam; /* OID of the access method (in pg_am) */ + + Oid indproc; + List *indpred; + + /* used by various scans and joins: */ + Oid *ordering; /* OID of operators in sort order */ + List *clauseinfo; /* restriction clauses */ + List *joininfo; /* join clauses */ + List *innerjoin; + List *superrels; +} Rel; + +extern Var *get_expr(TargetEntry *foo); + +typedef struct MergeOrder { + NodeTag type; + Oid join_operator; + Oid left_operator; + Oid right_operator; + Oid left_type; + Oid right_type; +} MergeOrder; + +typedef enum OrderType { + MERGE_ORDER, SORTOP_ORDER +} OrderType; + +typedef struct PathOrder { + OrderType ordtype; + union { + Oid *sortop; + MergeOrder *merge; + } ord; +} PathOrder; + +typedef struct Path { + NodeTag type; + + Rel *parent; + Cost path_cost; + + NodeTag pathtype; + + PathOrder p_ordering; + + List *keys; + Cost outerjoincost; + Relid joinid; + List *locclauseinfo; +} Path; + +typedef struct IndexPath { + Path path; + List *indexid; + List *indexqual; +} IndexPath; + +typedef struct JoinPath { + Path path; + List *pathclauseinfo; + Path *outerjoinpath; + Path *innerjoinpath; +} JoinPath; + +typedef struct MergePath { + JoinPath jpath; + List *path_mergeclauses; + List *outersortkeys; + List *innersortkeys; +} MergePath; + +typedef struct HashPath { + JoinPath jpath; + List *path_hashclauses; + List *outerhashkeys; + List *innerhashkeys; +} HashPath; + +/****** + * Keys + ******/ + +typedef struct OrderKey { + NodeTag type; + int attribute_number; + Index array_index; +} OrderKey; + +typedef struct JoinKey { + NodeTag type; + Var *outer; + Var *inner; +} JoinKey; + +/******* + * clause info + *******/ + +typedef struct CInfo { + NodeTag type; + Expr *clause; /* should be an OP clause */ + Cost selectivity; + bool notclause; + List *indexids; + + /* mergesort only */ + MergeOrder *mergesortorder; + + /* hashjoin only */ + Oid hashjoinoperator; + Relid cinfojoinid; +} CInfo; + +typedef struct JoinMethod { + NodeTag type; + List *jmkeys; + List *clauses; +} JoinMethod; + +typedef struct HInfo { + JoinMethod jmethod; + Oid hashop; +} HInfo; + +typedef struct MInfo { + JoinMethod jmethod; + MergeOrder *m_ordering; +} MInfo; + +typedef struct JInfo { + NodeTag type; + List *otherrels; + List *jinfoclauseinfo; + bool mergesortable; + bool hashjoinable; + bool inactive; +} JInfo; + +typedef struct Iter { + NodeTag type; + Node *iterexpr; + Oid itertype; /* type of the iter expr (use for type + checking) */ +} Iter; + +/* +** Stream: +** A stream represents a root-to-leaf path in a plan tree (i.e. a tree of +** JoinPaths and Paths). The stream includes pointers to all Path nodes, +** as well as to any clauses that reside above Path nodes. This structure +** is used to make Path nodes and clauses look similar, so that Predicate +** Migration can run. +** +** pathptr -- pointer to the current path node +** cinfo -- if NULL, this stream node referes to the path node. +** Otherwise this is a pointer to the current clause. +** clausetype -- whether cinfo is in locclauseinfo or pathclauseinfo in the +** path node +** upstream -- linked list pointer upwards +** downstream -- ditto, downwards +** groupup -- whether or not this node is in a group with the node upstream +** groupcost -- total cost of the group that node is in +** groupsel -- total selectivity of the group that node is in +*/ +typedef struct Stream *StreamPtr; + +typedef struct Stream { + NodeTag type; + Path *pathptr; + CInfo *cinfo; + int *clausetype; + struct Stream *upstream; + struct Stream *downstream; + bool groupup; + Cost groupcost; + Cost groupsel; +} Stream; + +#endif /* RELATION_H */ diff --git a/src/include/storage/backendid.h b/src/include/storage/backendid.h new file mode 100644 index 0000000000..f12dc42470 --- /dev/null +++ b/src/include/storage/backendid.h @@ -0,0 +1,32 @@ +/*------------------------------------------------------------------------- + * + * backendid.h-- + * POSTGRES backend id communication definitions + * + * + * Copyright (c) 1994, Regents of the University of California + * + * $Id: backendid.h,v 1.1 1996/08/28 01:57:54 scrappy Exp $ + * + *------------------------------------------------------------------------- + */ +#ifndef BACKENDID_H +#define BACKENDID_H + +/* ---------------- + * pulled out of sinval.h to temporarily reduce #include nesting. + * -cim 8/17/90 + * ---------------- + */ +typedef int16 BackendId; /* unique currently active backend identifier */ + +#define InvalidBackendId (-1) + +typedef int32 BackendTag; /* unique backend identifier */ + +#define InvalidBackendTag (-1) + +extern BackendId MyBackendId; /* backend id of this backend */ +extern BackendTag MyBackendTag; /* backend tag of this backend */ + +#endif /* BACKENDID_H */ diff --git a/src/include/storage/block.h b/src/include/storage/block.h new file mode 100644 index 0000000000..0098ca4529 --- /dev/null +++ b/src/include/storage/block.h @@ -0,0 +1,114 @@ +/*------------------------------------------------------------------------- + * + * block.h-- + * POSTGRES disk block definitions. + * + * + * Copyright (c) 1994, Regents of the University of California + * + * $Id: block.h,v 1.1 1996/08/28 01:57:55 scrappy Exp $ + * + *------------------------------------------------------------------------- + */ +#ifndef BLOCK_H +#define BLOCK_H + +#include "c.h" + +/* + * BlockNumber: + * + * each data file (heap or index) is divided into postgres disk blocks + * (which may be thought of as the unit of i/o -- a postgres buffer + * contains exactly one disk block). the blocks are numbered + * sequentially, 0 to 0xFFFFFFFE. + * + * InvalidBlockNumber is the same thing as P_NEW in buf.h. + * + * the access methods, the buffer manager and the storage manager are + * more or less the only pieces of code that should be accessing disk + * blocks directly. + */ +typedef uint32 BlockNumber; + +#define InvalidBlockNumber ((BlockNumber) 0xFFFFFFFF) + +/* + * BlockId: + * + * this is a storage type for BlockNumber. in other words, this type + * is used for on-disk structures (e.g., in HeapTupleData) whereas + * BlockNumber is the type on which calculations are performed (e.g., + * in access method code). + * + * there doesn't appear to be any reason to have separate types except + * for the fact that BlockIds can be SHORTALIGN'd (and therefore any + * structures that contains them, such as ItemPointerData, can also be + * SHORTALIGN'd). this is an important consideration for reducing the + * space requirements of the line pointer (ItemIdData) array on each + * page and the header of each heap or index tuple, so it doesn't seem + * wise to change this without good reason. + */ +typedef struct BlockIdData { + uint16 bi_hi; + uint16 bi_lo; +} BlockIdData; + +typedef BlockIdData *BlockId; /* block identifier */ + +/* ---------------- + * support macros + * ---------------- + */ + +/* + * BlockNumberIsValid -- + * True iff blockNumber is valid. + */ +#define BlockNumberIsValid(blockNumber) \ + ((bool) ((int32) (blockNumber) != InvalidBlockNumber)) + +/* + * BlockIdIsValid -- + * True iff the block identifier is valid. + */ +#define BlockIdIsValid(blockId) \ + ((bool) PointerIsValid(blockId)) + +/* + * BlockIdSet -- + * Sets a block identifier to the specified value. + */ +#define BlockIdSet(blockId, blockNumber) \ + Assert(PointerIsValid(blockId)); \ + (blockId)->bi_hi = (blockNumber) >> 16; \ + (blockId)->bi_lo = (blockNumber) & 0xffff + +/* + * BlockIdCopy -- + * Copy a block identifier. + */ +#define BlockIdCopy(toBlockId, fromBlockId) \ + Assert(PointerIsValid(toBlockId)); \ + Assert(PointerIsValid(fromBlockId)); \ + (toBlockId)->bi_hi = (fromBlockId)->bi_hi; \ + (toBlockId)->bi_lo = (fromBlockId)->bi_lo + +/* + * BlockIdEquals -- + * Check for block number equality. + */ +#define BlockIdEquals(blockId1, blockId2) \ + ((blockId1)->bi_hi == (blockId2)->bi_hi && \ + (blockId1)->bi_lo == (blockId2)->bi_lo) + +/* + * BlockIdGetBlockNumber -- + * Retrieve the block number from a block identifier. + */ +#define BlockIdGetBlockNumber(blockId) \ + (AssertMacro(BlockIdIsValid(blockId)) ? \ + (BlockNumber) (((blockId)->bi_hi << 16) | ((uint16) (blockId)->bi_lo)) : \ + (BlockNumber) InvalidBlockNumber) + +#endif /* BLOCK_H */ diff --git a/src/include/storage/buf.h b/src/include/storage/buf.h new file mode 100644 index 0000000000..439cb58ec9 --- /dev/null +++ b/src/include/storage/buf.h @@ -0,0 +1,47 @@ +/*------------------------------------------------------------------------- + * + * buf.h-- + * Basic buffer manager data types. + * + * + * Copyright (c) 1994, Regents of the University of California + * + * $Id: buf.h,v 1.1 1996/08/28 01:57:57 scrappy Exp $ + * + *------------------------------------------------------------------------- + */ +#ifndef BUF_H +#define BUF_H + +#define InvalidBuffer (0) +#define UnknownBuffer (-99999) + +typedef long Buffer; + +/* + * BufferIsInvalid -- + * True iff the buffer is invalid. + */ +#define BufferIsInvalid(buffer) ((buffer) == InvalidBuffer) + +/* + * BufferIsUnknown -- + * True iff the buffer is unknown. + */ +#define BufferIsUnknown(buffer) ((buffer) == UnknownBuffer) + +/* + * BufferIsLocal -- + * True iff the buffer is local (not visible to other servers). + */ +#define BufferIsLocal(buffer) ((buffer) < 0) + +/* + * If NO_BUFFERISVALID is defined, all error checking using BufferIsValid() + * are suppressed. Decision-making using BufferIsValid is not affected. + * This should be set only if one is sure there will be no errors. + * - plai 9/10/90 + */ +#undef NO_BUFFERISVALID + +#endif /* BUF_H */ diff --git a/src/include/storage/buf_internals.h b/src/include/storage/buf_internals.h new file mode 100644 index 0000000000..b5fce3993d --- /dev/null +++ b/src/include/storage/buf_internals.h @@ -0,0 +1,244 @@ +/*------------------------------------------------------------------------- + * + * buf_internals.h-- + * Internal definitions. + * + * + * Copyright (c) 1994, Regents of the University of California + * + * $Id: buf_internals.h,v 1.1 1996/08/28 01:58:00 scrappy Exp $ + * + * NOTE + * If BUFFERPAGE0 is defined, then 0 will be used as a + * valid buffer page number. + * + *------------------------------------------------------------------------- + */ +#ifndef BUFMGR_INTERNALS_H +#define BUFMGR_INTERNALS_H + +#include "postgres.h" +#include "storage/buf.h" +#include "storage/ipc.h" +#include "storage/shmem.h" +#include "miscadmin.h" +#include "storage/lmgr.h" +#include "utils/rel.h" +#include "utils/relcache.h" + +/* Buf Mgr constants */ +/* in bufmgr.c */ +extern int NBuffers; +extern int Data_Descriptors; +extern int Free_List_Descriptor; +extern int Lookup_List_Descriptor; +extern int Num_Descriptors; + +/* + * Flags for buffer descriptors + */ +#define BM_DIRTY (1 << 0) +#define BM_PRIVATE (1 << 1) +#define BM_VALID (1 << 2) +#define BM_DELETED (1 << 3) +#define BM_FREE (1 << 4) +#define BM_IO_IN_PROGRESS (1 << 5) +#define BM_IO_ERROR (1 << 6) + +typedef bits16 BufFlags; + +typedef struct sbufdesc BufferDesc; +typedef struct sbufdesc BufferHdr; +typedef struct buftag BufferTag; +/* long * so alignment will be correct */ +typedef long **BufferBlock; + +struct buftag{ + LRelId relId; + BlockNumber blockNum; /* blknum relative to begin of reln */ +}; + +#define CLEAR_BUFFERTAG(a)\ + (a)->relId.dbId = InvalidOid; \ + (a)->relId.relId = InvalidOid; \ + (a)->blockNum = InvalidBlockNumber + +#define INIT_BUFFERTAG(a,xx_reln,xx_blockNum) \ +{ \ + (a)->blockNum = xx_blockNum;\ + (a)->relId = RelationGetLRelId(xx_reln); \ +} + +#define COPY_BUFFERTAG(a,b)\ +{ \ + (a)->blockNum = (b)->blockNum;\ + LRelIdAssign(*(a),*(b));\ +} + +#define EQUAL_BUFFERTAG(a,b) \ + (((a)->blockNum == (b)->blockNum) &&\ + (OID_Equal((a)->relId.relId,(b)->relId.relId))) + + +#define BAD_BUFFER_ID(bid) ((bid<1) || (bid>(NBuffers))) +#define INVALID_DESCRIPTOR (-3) + +/* + * bletch hack -- anyplace that we declare space for relation or + * database names, we just use '16', not a symbolic constant, to + * specify their lengths. BM_NAMESIZE is the length of these names, + * and is used in the buffer manager code. somebody with lots of + * spare time should do this for all the other modules, too. + */ +#define BM_NAMESIZE 16 + +/* + * struct sbufdesc -- shared buffer cache metadata for a single + * shared buffer descriptor. + * + * We keep the name of the database and relation in which this + * buffer appears in order to avoid a catalog lookup on cache + * flush if we don't have the reldesc in the cache. It is also + * possible that the relation to which this buffer belongs is + * not visible to all backends at the time that it gets flushed. + * Dbname, relname, dbid, and relid are enough to determine where + * to put the buffer, for all storage managers. + */ + +struct sbufdesc { + Buffer freeNext; /* link for freelist chain */ + Buffer freePrev; + SHMEM_OFFSET data; /* pointer to data in buf pool */ + + /* tag and id must be together for table lookup to work */ + BufferTag tag; /* file/block identifier */ + int buf_id; /* maps global desc to local desc */ + + BufFlags flags; /* described below */ + int16 bufsmgr; /* storage manager id for buffer */ + unsigned refcount; /* # of times buffer is pinned */ + + char sb_dbname[NAMEDATALEN+1]; /* name of db in which buf belongs */ + char sb_relname[NAMEDATALEN+1]; /* name of reln */ +#ifdef HAS_TEST_AND_SET + /* can afford a dedicated lock if test-and-set locks are available */ + slock_t io_in_progress_lock; +#endif /* HAS_TEST_AND_SET */ + + /* + * I padded this structure to a power of 2 (128 bytes on a MIPS) because + * BufferDescriptorGetBuffer is called a billion times and it does an + * C pointer subtraction (i.e., "x - y" -> array index of x relative + * to y, which is calculated using division by struct size). Integer + * ".div" hits you for 35 cycles, as opposed to a 1-cycle "sra" ... + * this hack cut 10% off of the time to create the Wisconsin database! + * It eats up more shared memory, of course, but we're (allegedly) + * going to make some of these types bigger soon anyway... -pma 1/2/93 + */ + +/* NO spinlock */ + +#if defined(PORTNAME_ultrix4) + char sb_pad[60]; /* no slock_t */ +#endif /* mips */ + +/* HAS_TEST_AND_SET -- platform dependent size */ + +#if defined(PORTNAME_aix) + char sb_pad[44]; /* typedef unsigned int slock_t; */ +#endif /* aix */ +#if defined(PORTNAME_alpha) + char sb_pad[40]; /* typedef msemaphore slock_t; */ +#endif /* alpha */ +#if defined(PORTNAME_hpux) + char sb_pad[44]; /* typedef struct { int sem[4]; } slock_t; */ +#endif /* hpux */ +#if defined(PORTNAME_irix5) + char sb_pad[44]; /* typedef abilock_t slock_t; */ +#endif /* irix5 */ +#if defined(PORTNAME_next) + char sb_pad[56]; /* typedef struct mutex slock_t; */ +#endif /* next */ + +/* HAS_TEST_AND_SET -- default 1 byte spinlock */ + +#if defined(PORTNAME_BSD44_derived) || \ + defined(PORTNAME_bsdi) || \ + defined(PORTNAME_bsdi_2_1) || \ + defined(PORTNAME_i386_solaris) || \ + defined(PORTNAME_linux) || \ + defined(PORTNAME_sparc) || \ + defined(PORTNAME_sparc_solaris) + char sb_pad[56]; /* has slock_t */ +#endif /* 1 byte slock_t */ +}; + +/* + * mao tracing buffer allocation + */ + +/*#define BMTRACE*/ +#ifdef BMTRACE + +typedef struct _bmtrace { + int bmt_pid; + long bmt_buf; + long bmt_dbid; + long bmt_relid; + int bmt_blkno; + int bmt_op; + +#define BMT_NOTUSED 0 +#define BMT_ALLOCFND 1 +#define BMT_ALLOCNOTFND 2 +#define BMT_DEALLOC 3 + +} bmtrace; + +#endif /* BMTRACE */ + + +/* + * Bufmgr Interface: + */ + +/* Internal routines: only called by buf.c */ + +/*freelist.c*/ +extern void AddBufferToFreelist(BufferDesc *bf); +extern void PinBuffer(BufferDesc *buf); +extern void PinBuffer_Debug(char *file, int line, BufferDesc *buf); +extern void UnpinBuffer(BufferDesc *buf); +extern void UnpinBuffer_Debug(char *file, int line, BufferDesc *buf); +extern BufferDesc *GetFreeBuffer(void); +extern void InitFreeList(bool init); +extern void DBG_FreeListCheck(int nfree); + +/* buf_table.c */ +extern void InitBufTable(void); +extern BufferDesc *BufTableLookup(BufferTag *tagPtr); +extern bool BufTableDelete(BufferDesc *buf); +extern bool BufTableInsert(BufferDesc *buf); +extern void DBG_LookupListCheck(int nlookup); + +/* bufmgr.c */ +extern BufferDesc *BufferDescriptors; +extern BufferBlock BufferBlocks; +extern long *PrivateRefCount; +extern long *LastRefCount; +extern SPINLOCK BufMgrLock; + +/* localbuf.c */ +extern long *LocalRefCount; +extern BufferDesc *LocalBufferDescriptors; +extern int NLocBuffer; + +extern BufferDesc *LocalBufferAlloc(Relation reln, BlockNumber blockNum, + bool *foundPtr); +extern int WriteLocalBuffer(Buffer buffer, bool release); +extern int FlushLocalBuffer(Buffer buffer); +extern void InitLocalBuffer(); +extern void LocalBufferSync(); +extern void ResetLocalBufferPool(); + +#endif /* BUFMGR_INTERNALS_H */ diff --git a/src/include/storage/bufmgr.h b/src/include/storage/bufmgr.h new file mode 100644 index 0000000000..274f59d986 --- /dev/null +++ b/src/include/storage/bufmgr.h @@ -0,0 +1,112 @@ +/*------------------------------------------------------------------------- + * + * bufmgr.h-- + * POSTGRES buffer manager definitions. + * + * + * Copyright (c) 1994, Regents of the University of California + * + * $Id: bufmgr.h,v 1.1 1996/08/28 01:58:01 scrappy Exp $ + * + *------------------------------------------------------------------------- + */ +#ifndef BUFMGR_H +#define BUFMGR_H + +#include "c.h" + +#include "machine.h" /* for BLCKSZ */ +#include "utils/rel.h" + +#include "storage/buf_internals.h" /* UGLY! -- ay */ + +/* + * the maximum size of a disk block for any possible installation. + * + * in theory this could be anything, but in practice this is actually + * limited to 2^13 bytes because we have limited ItemIdData.lp_off and + * ItemIdData.lp_len to 13 bits (see itemid.h). + */ +#define MAXBLCKSZ 8192 + +typedef void *Block; + + +/* special pageno for bget */ +#define P_NEW InvalidBlockNumber /* grow the file to get a new page */ + +typedef bits16 BufferLock; + +/********************************************************************** + + the rest is function defns in the bufmgr that are externally callable + + **********************************************************************/ + +/* + * These routines are beaten on quite heavily, hence the macroization. + * See buf_internals.h for a related comment. + */ +#define BufferDescriptorGetBuffer(bdesc) ((bdesc)->buf_id + 1) + +/* + * BufferIsPinned -- + * True iff the buffer is pinned (and therefore valid) + * + * Note: + * Smenatics are identical to BufferIsValid + * XXX - need to remove either one eventually. + */ +#define BufferIsPinned BufferIsValid + + +extern int ShowPinTrace; + +/* + * prototypes for functions in bufmgr.c + */ +extern Buffer RelationGetBufferWithBuffer(Relation relation, + BlockNumber blockNumber, Buffer buffer); +extern Buffer ReadBuffer(Relation reln, BlockNumber blockNum); +extern Buffer ReadBuffer_Debug(char *file, int line, Relation reln, + BlockNumber blockNum); +extern int WriteBuffer(Buffer buffer); +extern void WriteBuffer_Debug(char *file, int line, Buffer buffer); +extern void DirtyBufferCopy(Oid dbid, Oid relid, BlockNumber blkno, + char *dest); +extern int WriteNoReleaseBuffer(Buffer buffer); +extern Buffer ReleaseAndReadBuffer(Buffer buffer, Relation relation, + BlockNumber blockNum); + +extern void InitBufferPool(IPCKey key); +extern void PrintBufferUsage(FILE *statfp); +extern void ResetBufferUsage(void); +extern void ResetBufferPool(void); +extern int BufferPoolCheckLeak(void); +extern void FlushBufferPool(int StableMainMemoryFlag); +extern bool BufferIsValid(Buffer bufnum); +extern BlockNumber BufferGetBlockNumber(Buffer buffer); +extern Relation BufferGetRelation(Buffer buffer); +extern BlockNumber RelationGetNumberOfBlocks(Relation relation); +extern Block BufferGetBlock(Buffer buffer); +extern void ReleaseTmpRelBuffers(Relation tempreldesc); +extern void DropBuffers(Oid dbid); +extern void PrintBufferDescs(void); +extern void PrintPinnedBufs(void); +extern int BufferShmemSize(void); +extern void BufferPoolBlowaway(void); +extern void IncrBufferRefCount(Buffer buffer); +extern int ReleaseBuffer(Buffer buffer); + +extern void IncrBufferRefCount_Debug(char *file, int line, Buffer buffer); +extern void ReleaseBuffer_Debug(char *file, int line, Buffer buffer); +extern int ReleaseAndReadBuffer_Debug(char *file, + int line, + Buffer buffer, + Relation relation, + BlockNumber blockNum); +extern void BufferRefCountReset(int *refcountsave); +extern void BufferRefCountRestore(int *refcountsave); + +#endif /* !defined(BufMgrIncluded) */ + diff --git a/src/include/storage/bufpage.h b/src/include/storage/bufpage.h new file mode 100644 index 0000000000..c00f07260b --- /dev/null +++ b/src/include/storage/bufpage.h @@ -0,0 +1,256 @@ +/*------------------------------------------------------------------------- + * + * bufpage.h-- + * Standard POSTGRES buffer page definitions. + * + * + * Copyright (c) 1994, Regents of the University of California + * + * $Id: bufpage.h,v 1.1 1996/08/28 01:58:03 scrappy Exp $ + * + *------------------------------------------------------------------------- + */ +#ifndef BUFPAGE_H +#define BUFPAGE_H + +#include "c.h" +#include "machine.h" /* for BLCKSZ */ + +#include "storage/buf.h" +#include "storage/item.h" +#include "storage/itemid.h" +#include "storage/itemptr.h" + +/* + * a postgres disk page is an abstraction layered on top of a postgres + * disk block (which is simply a unit of i/o, see block.h). + * + * specifically, while a disk block can be unformatted, a postgres + * disk page is always a slotted page of the form: + * + * +----------------+---------------------------------+ + * | PageHeaderData | linp0 linp1 linp2 ... | + * +-----------+----+---------------------------------+ + * | ... linpN | | + * +-----------+--------------------------------------+ + * | ^ pd_lower | + * | | + * | v pd_upper | + * +-------------+------------------------------------+ + * | | tupleN ... | + * +-------------+------------------+-----------------+ + * | ... tuple2 tuple1 tuple0 | "special space" | + * +--------------------------------+-----------------+ + * ^ pd_special + * + * a page is full when nothing can be added between pd_lower and + * pd_upper. + * + * all blocks written out by an access method must be disk pages. + * + * EXCEPTIONS: + * + * obviously, a page is not formatted before it is initialized with by + * a call to PageInit. + * + * the contents of the special pg_variable/pg_time/pg_log tables are + * raw disk blocks with special formats. these are the only "access + * methods" that need not write disk pages. + * + * NOTES: + * + * linp0..N form an ItemId array. ItemPointers point into this array + * rather than pointing directly to a tuple. + * + * tuple0..N are added "backwards" on the page. because a tuple's + * ItemPointer points to its ItemId entry rather than its actual + * byte-offset position, tuples can be physically shuffled on a page + * whenever the need arises. + * + * AM-generic per-page information is kept in the pd_opaque field of + * the PageHeaderData. (this is currently only the page size.) + * AM-specific per-page data is kept in the area marked "special + * space"; each AM has an "opaque" structure defined somewhere that is + * stored as the page trailer. an access method should always + * initialize its pages with PageInit and then set its own opaque + * fields. + */ +typedef Pointer Page; + +/* + * PageIsValid -- + * True iff page is valid. + */ +#define PageIsValid(page) PointerIsValid(page) + + +/* + * location (byte offset) within a page. + * + * note that this is actually limited to 2^13 because we have limited + * ItemIdData.lp_off and ItemIdData.lp_len to 13 bits (see itemid.h). + */ +typedef uint16 LocationIndex; + + +/* + * space management information generic to any page + * + * od_pagesize - size in bytes. + * in reality, we need at least 64B to fit the + * page header, opaque space and a minimal tuple; + * on the high end, we can only support pages up + * to 8KB because lp_off/lp_len are 13 bits. + */ +typedef struct OpaqueData { + uint16 od_pagesize; +} OpaqueData; + +typedef OpaqueData *Opaque; + + +/* + * disk page organization + */ +typedef struct PageHeaderData { + LocationIndex pd_lower; /* offset to start of free space */ + LocationIndex pd_upper; /* offset to end of free space */ + LocationIndex pd_special; /* offset to start of special space */ + OpaqueData pd_opaque; /* AM-generic information */ + ItemIdData pd_linp[1]; /* line pointers */ +} PageHeaderData; + +typedef PageHeaderData *PageHeader; + +typedef enum { + ShufflePageManagerMode, + OverwritePageManagerMode +} PageManagerMode; + +/* ---------------- + * misc support macros + * ---------------- + */ + +/* + * XXX this is wrong -- ignores padding/alignment, variable page size, + * AM-specific opaque space at the end of the page (as in btrees), ... + * however, it at least serves as an upper bound for heap pages. + */ +#define MAXTUPLEN (BLCKSZ - sizeof (PageHeaderData)) + +/* ---------------------------------------------------------------- + * page support macros + * ---------------------------------------------------------------- + */ +/* + * PageIsValid -- This is defined in page.h. + */ + +/* + * PageIsUsed -- + * True iff the page size is used. + * + * Note: + * Assumes page is valid. + */ +#define PageIsUsed(page) \ + (AssertMacro(PageIsValid(page)) ? \ + ((bool) (((PageHeader) (page))->pd_lower != 0)) : false) + +/* + * PageIsEmpty -- + * returns true iff no itemid has been allocated on the page + */ +#define PageIsEmpty(page) \ + (((PageHeader) (page))->pd_lower == \ + (sizeof(PageHeaderData) - sizeof(ItemIdData)) ? true : false) + +/* + * PageGetItemId -- + * Returns an item identifier of a page. + */ +#define PageGetItemId(page, offsetNumber) \ + ((ItemId) (&((PageHeader) (page))->pd_linp[(-1) + (offsetNumber)])) + +/* ---------------- + * macros to access opaque space + * ---------------- + */ + +/* + * PageSizeIsValid -- + * True iff the page size is valid. + * + * XXX currently all page sizes are "valid" but we only actually + * use BLCKSZ. + */ +#define PageSizeIsValid(pageSize) 1 + +/* + * PageGetPageSize -- + * Returns the page size of a page. + * + * this can only be called on a formatted page (unlike + * BufferGetPageSize, which can be called on an unformatted page). + * however, it can be called on a page for which there is no buffer. + */ +#define PageGetPageSize(page) \ + ((Size) ((PageHeader) (page))->pd_opaque.od_pagesize) + +/* + * PageSetPageSize -- + * Sets the page size of a page. + */ +#define PageSetPageSize(page, size) \ + ((PageHeader) (page))->pd_opaque.od_pagesize = (size) + +/* ---------------- + * page special data macros + * ---------------- + */ +/* + * PageGetSpecialSize -- + * Returns size of special space on a page. + * + * Note: + * Assumes page is locked. + */ +#define PageGetSpecialSize(page) \ + ((uint16) (PageGetPageSize(page) - ((PageHeader)page)->pd_special)) + +/* + * PageGetSpecialPointer -- + * Returns pointer to special space on a page. + * + * Note: + * Assumes page is locked. + */ +#define PageGetSpecialPointer(page) \ + (AssertMacro(PageIsValid(page)) ? \ + (char *) ((char *) (page) + ((PageHeader) (page))->pd_special) \ + : (char *) 0) + +/* ---------------------------------------------------------------- + * extern declarations + * ---------------------------------------------------------------- + */ + +extern Size BufferGetPageSize(Buffer buffer); +extern Page BufferGetPage(Buffer buffer); +extern void PageInit(Page page, Size pageSize, Size specialSize); +extern Item PageGetItem(Page page, ItemId itemId); +extern OffsetNumber PageAddItem(Page page, Item item, Size size, + OffsetNumber offsetNumber, ItemIdFlags flags); +extern Page PageGetTempPage(Page page, Size specialSize); +extern void PageRestoreTempPage(Page tempPage, Page oldPage); +extern OffsetNumber PageGetMaxOffsetNumber(Page page); +extern void PageRepairFragmentation(Page page); +extern Size PageGetFreeSpace(Page page); +extern void PageManagerModeSet(PageManagerMode mode); +extern void PageIndexTupleDelete(Page page, OffsetNumber offset); +extern void PageIndexTupleDeleteAdjustLinePointers(PageHeader phdr, + char *location, Size size); + + +#endif /* BUFPAGE_H */ diff --git a/src/include/storage/fd.h b/src/include/storage/fd.h new file mode 100644 index 0000000000..f065278e76 --- /dev/null +++ b/src/include/storage/fd.h @@ -0,0 +1,96 @@ +/*------------------------------------------------------------------------- + * + * fd.h-- + * Virtual file descriptor definitions. + * + * + * Copyright (c) 1994, Regents of the University of California + * + * $Id: fd.h,v 1.1 1996/08/28 01:58:04 scrappy Exp $ + * + *------------------------------------------------------------------------- + */ +/* + * calls: + * + * File {Close, Read, Write, Seek, Tell, Sync} + * {File Name Open, Allocate, Free} File + * + * These are NOT JUST RENAMINGS OF THE UNIX ROUTINES. + * use them for all file activity... + * + * fd = FilePathOpenFile("foo", O_RDONLY); + * File fd; + * + * use AllocateFile if you need a file descriptor in some other context. + * it will make sure that there is a file descriptor free + * + * use FreeFile to let the virtual file descriptor package know that + * there is now a free fd (when you are done with it) + * + * AllocateFile(); + * FreeFile(); + */ +#ifndef FD_H +#define FD_H + +/* + * FileOpen uses the standard UNIX open(2) flags. + */ +#include /* for O_ on most */ +#ifndef O_RDONLY +#include /* for O_ on the rest */ +#endif /* O_RDONLY */ + +/* + * FileSeek uses the standard UNIX lseek(2) flags. + */ +#ifndef WIN32 +#include /* for SEEK_ on most */ +#else +#ifndef SEEK_SET +#include /* for SEEK_ on the rest */ +#endif /* SEEK_SET */ +#endif /* WIN32 */ + +#include "c.h" +#include "storage/block.h" + +typedef char *FileName; + +typedef int File; + +/* originally in libpq-fs.h */ +struct pgstat { /* just the fields we need from stat structure */ + int st_ino; + int st_mode; + unsigned int st_size; + unsigned int st_sizehigh; /* high order bits */ +/* 2^64 == 1.8 x 10^20 bytes */ + int st_uid; + int st_atime_s; /* just the seconds */ + int st_mtime_s; /* since SysV and the new BSD both have */ + int st_ctime_s; /* usec fields.. */ +}; + +/* + * prototypes for functions in fd.c + */ +extern void FileInvalidate(File file); +extern File FileNameOpenFile(FileName fileName, int fileFlags, int fileMode); +extern File PathNameOpenFile(FileName fileName, int fileFlags, int fileMode); +extern void FileClose(File file); +extern void FileUnlink(File file); +extern int FileRead(File file, char *buffer, int amount); +extern int FileWrite(File file, char *buffer, int amount); +extern long FileSeek(File file, long offset, int whence); +extern long FileTell(File file); +extern int FileTruncate(File file, int offset); +extern int FileSync(File file); +extern int FileNameUnlink(char *filename); +extern void AllocateFile(void); +extern void FreeFile(void); +extern void closeAllVfds(void); +extern void closeOneVfd(void); + +#endif /* FD_H */ diff --git a/src/include/storage/ipc.h b/src/include/storage/ipc.h new file mode 100644 index 0000000000..f134d032ee --- /dev/null +++ b/src/include/storage/ipc.h @@ -0,0 +1,302 @@ +/*------------------------------------------------------------------------- + * + * ipc.h-- + * POSTGRES inter-process communication definitions. + * + * + * Copyright (c) 1994, Regents of the University of California + * + * $Id: ipc.h,v 1.1 1996/08/28 01:58:05 scrappy Exp $ + * + * NOTES + * This file is very architecture-specific. This stuff should actually + * be factored into the port/ directories. + * + *------------------------------------------------------------------------- + */ +#ifndef IPC_H +#define IPC_H + +#include +#ifndef _IPC_ +#define _IPC_ +#include +#endif + +#include "c.h" + +/* + * Many architectures have support for user-level spinlocks (i.e., an + * atomic test-and-set instruction). However, we have only written + * spinlock code for the architectures listed. + */ +#if defined(PORTNAME_aix) || \ + defined(PORTNAME_alpha) || \ + defined(PORTNAME_BSD44_derived) || \ + defined(PORTNAME_bsdi) || \ + defined(PORTNAME_bsdi_2_1) || \ + defined(PORTNAME_hpux) || \ + defined(PORTNAME_i386_solaris) || \ + defined(PORTNAME_irix5) || \ + defined(PORTNAME_linux) || \ + defined(PORTNAME_next) || \ + defined(PORTNAME_sparc) || \ + defined(PORTNAME_sparc_solaris) +#define HAS_TEST_AND_SET +#endif + +#if defined(HAS_TEST_AND_SET) + +#if defined(PORTNAME_aix) +/* + * The AIX C library has the cs(3) builtin for compare-and-set that + * operates on ints. + */ +typedef unsigned int slock_t; +#else /* aix */ + +#if defined(PORTNAME_alpha) +#include +typedef msemaphore slock_t; +#else /* alpha */ + +#if defined(PORTNAME_hpux) +/* + * The PA-RISC "semaphore" for the LDWCX instruction is 4 bytes aligned + * to a 16-byte boundary. + */ +typedef struct { int sem[4]; } slock_t; +#else /* hpux */ + +#if defined(PORTNAME_irix5) +#include +typedef abilock_t slock_t; +#else /* irix5 */ + +#if defined(PORTNAME_next) +/* + * Use Mach mutex routines since these are, in effect, test-and-set + * spinlocks. + */ +#undef NEVER /* definition in cthreads.h conflicts with parse.h */ +#include +typedef struct mutex slock_t; +#else /* next */ + +/* + * On all other architectures spinlocks are a single byte. + */ +typedef unsigned char slock_t; + +#endif /* next */ +#endif /* irix5 */ +#endif /* hpux */ +#endif /* alpha */ +#endif /* aix */ + +extern void S_LOCK(slock_t *lock); +extern void S_UNLOCK(slock_t *lock); +extern void S_INIT_LOCK(slock_t *lock); + +#if defined(PORTNAME_alpha) || \ + defined(PORTNAME_hpux) || \ + defined(PORTNAME_irix5) || \ + defined(PORTNAME_next) +extern int S_LOCK_FREE(slock_t *lock); +#else +#define S_LOCK_FREE(lock) ((*lock) == 0) +#endif + +#endif /* HAS_TEST_AND_SET */ + +/* + * On architectures for which we have not implemented spinlocks (or + * cannot do so), we use System V semaphores. We also use them for + * long locks. For some reason union semun is never defined in the + * System V header files so we must do it ourselves. + * + * bsdi_2_1 does not need this + */ +#if defined(sequent) || \ + defined(PORTNAME_aix) || \ + defined(PORTNAME_alpha) || \ + defined(PORTNAME_bsdi) || \ + defined(PORTNAME_hpux) || \ + defined(PORTNAME_i386_solaris) || \ + defined(PORTNAME_sparc_solaris) || \ + defined(PORTNAME_ultrix4) || \ + defined(PORTNAME_svr4) || \ + defined(WIN32) +union semun { + int val; + struct semid_ds *buf; + unsigned short *array; +}; +#endif + +typedef uint16 SystemPortAddress; + +/* semaphore definitions */ + +#define IPCProtection (0600) /* access/modify by user only */ + +#define IPC_NMAXSEM 25 /* maximum number of semaphores */ +#define IpcSemaphoreDefaultStartValue 255 +#define IpcSharedLock (-1) +#define IpcExclusiveLock (-255) + +#define IpcUnknownStatus (-1) +#define IpcInvalidArgument (-2) +#define IpcSemIdExist (-3) +#define IpcSemIdNotExist (-4) + +typedef uint32 IpcSemaphoreKey; /* semaphore key */ +typedef int IpcSemaphoreId; + +/* shared memory definitions */ + +#define IpcMemCreationFailed (-1) +#define IpcMemIdGetFailed (-2) +#define IpcMemAttachFailed 0 + +typedef uint32 IPCKey; +#define PrivateIPCKey IPC_PRIVATE +#define DefaultIPCKey 17317 + +typedef uint32 IpcMemoryKey; /* shared memory key */ +typedef int IpcMemoryId; + + +/* ipc.c */ +extern void exitpg(int code); +extern void quasi_exitpg(void); +extern on_exitpg(void (*function)(), caddr_t arg); + +extern IpcSemaphoreId IpcSemaphoreCreate(IpcSemaphoreKey semKey, + int semNum, int permission, int semStartValue, + int removeOnExit, int *status); +extern void IpcSemaphoreSet(int semId, int semno, int value); +extern void IpcSemaphoreKill(IpcSemaphoreKey key); +extern void IpcSemaphoreLock(IpcSemaphoreId semId, int sem, int lock); +extern void IpcSemaphoreUnlock(IpcSemaphoreId semId, int sem, int lock); +extern int IpcSemaphoreGetCount(IpcSemaphoreId semId, int sem); +extern int IpcSemaphoreGetValue(IpcSemaphoreId semId, int sem); +extern IpcMemoryId IpcMemoryCreate(IpcMemoryKey memKey, uint32 size, + int permission); +extern IpcMemoryId IpcMemoryIdGet(IpcMemoryKey memKey, uint32 size); +extern void IpcMemoryDetach(int status, char *shmaddr); +extern char *IpcMemoryAttach(IpcMemoryId memId); +extern void IpcMemoryKill(IpcMemoryKey memKey); +extern void CreateAndInitSLockMemory(IPCKey key); +extern void AttachSLockMemory(IPCKey key); + + +#ifdef HAS_TEST_AND_SET + +#define NSLOCKS 2048 +#define NOLOCK 0 +#define SHAREDLOCK 1 +#define EXCLUSIVELOCK 2 + +typedef enum _LockId_ { + BUFMGRLOCKID, + LOCKLOCKID, + OIDGENLOCKID, + SHMEMLOCKID, + BINDINGLOCKID, + LOCKMGRLOCKID, + SINVALLOCKID, + +#ifdef MAIN_MEMORY + MMCACHELOCKID, +#endif /* MAIN_MEMORY */ + + PROCSTRUCTLOCKID, + FIRSTFREELOCKID +} _LockId_; + +#define MAX_SPINS FIRSTFREELOCKID + +typedef struct slock { + slock_t locklock; + unsigned char flag; + short nshlocks; + slock_t shlock; + slock_t exlock; + slock_t comlock; + struct slock *next; +} SLock; + +extern void ExclusiveLock(int lockid); +extern void ExclusiveUnlock(int lockid); +extern bool LockIsFree(int lockid); +#else /* HAS_TEST_AND_SET */ + +typedef enum _LockId_ { + SHMEMLOCKID, + BINDINGLOCKID, + BUFMGRLOCKID, + LOCKMGRLOCKID, + SINVALLOCKID, + +#ifdef MAIN_MEMORY + MMCACHELOCKID, +#endif /* MAIN_MEMORY */ + + PROCSTRUCTLOCKID, + OIDGENLOCKID, + FIRSTFREELOCKID +} _LockId_; + +#define MAX_SPINS FIRSTFREELOCKID + +#endif /* HAS_TEST_AND_SET */ + +/* + * the following are originally in ipci.h but the prototypes have circular + * dependencies and most files include both ipci.h and ipc.h anyway, hence + * combined. + * + */ + +/* + * Note: + * These must not hash to DefaultIPCKey or PrivateIPCKey. + */ +#define SystemPortAddressGetIPCKey(address) \ + (28597 * (address) + 17491) + +/* + * these keys are originally numbered from 1 to 12 consecutively but not + * all are used. The unused ones are removed. - ay 4/95. + */ +#define IPCKeyGetBufferMemoryKey(key) \ + ((key == PrivateIPCKey) ? key : 1 + (key)) + +#define IPCKeyGetSIBufferMemoryBlock(key) \ + ((key == PrivateIPCKey) ? key : 7 + (key)) + +#define IPCKeyGetSLockSharedMemoryKey(key) \ + ((key == PrivateIPCKey) ? key : 10 + (key)) + +#define IPCKeyGetSpinLockSemaphoreKey(key) \ + ((key == PrivateIPCKey) ? key : 11 + (key)) +#define IPCKeyGetWaitIOSemaphoreKey(key) \ + ((key == PrivateIPCKey) ? key : 12 + (key)) + +/* -------------------------- + * NOTE: This macro must always give the highest numbered key as every backend + * process forked off by the postmaster will be trying to acquire a semaphore + * with a unique key value starting at key+14 and incrementing up. Each + * backend uses the current key value then increments it by one. + * -------------------------- + */ +#define IPCGetProcessSemaphoreInitKey(key) \ + ((key == PrivateIPCKey) ? key : 14 + (key)) + +/* ipci.c */ +extern IPCKey SystemPortAddressCreateIPCKey(SystemPortAddress address); +extern void CreateSharedMemoryAndSemaphores(IPCKey key); +extern void AttachSharedMemoryAndSemaphores(IPCKey key); + +#endif /* IPC_H */ diff --git a/src/include/storage/item.h b/src/include/storage/item.h new file mode 100644 index 0000000000..1e07b8a6d3 --- /dev/null +++ b/src/include/storage/item.h @@ -0,0 +1,20 @@ +/*------------------------------------------------------------------------- + * + * item.h-- + * POSTGRES disk item definitions. + * + * + * Copyright (c) 1994, Regents of the University of California + * + * $Id: item.h,v 1.1 1996/08/28 01:58:06 scrappy Exp $ + * + *------------------------------------------------------------------------- + */ +#ifndef ITEM_H +#define ITEM_H + +#include "c.h" + +typedef Pointer Item; + +#endif /* ITEM_H */ diff --git a/src/include/storage/itemid.h b/src/include/storage/itemid.h new file mode 100644 index 0000000000..7e4fc5e28d --- /dev/null +++ b/src/include/storage/itemid.h @@ -0,0 +1,75 @@ +/*------------------------------------------------------------------------- + * + * itemid.h-- + * Standard POSTGRES buffer page item identifier definitions. + * + * + * Copyright (c) 1994, Regents of the University of California + * + * $Id: itemid.h,v 1.1 1996/08/28 01:58:08 scrappy Exp $ + * + *------------------------------------------------------------------------- + */ +#ifndef ITEMID_H +#define ITEMID_H + +typedef uint16 ItemOffset; +typedef uint16 ItemLength; + +typedef bits16 ItemIdFlags; + + + +typedef struct ItemIdData { /* line pointers */ + unsigned lp_off:13, /* offset to find tup */ + /* can be reduced by 2 if necc. */ + lp_flags:6, /* flags on tuple */ + lp_len:13; /* length of tuple */ +} ItemIdData; + +typedef struct ItemIdData *ItemId; + +#ifndef LP_USED +#define LP_USED 0x01 /* this line pointer is being used */ +#endif + +/* ---------------- + * support macros + * ---------------- + */ +/* + * ItemIdGetLength + */ +#define ItemIdGetLength(itemId) \ + ((itemId)->lp_len) + +/* + * ItemIdGetOffset + */ +#define ItemIdGetOffset(itemId) \ + ((itemId)->lp_off) + +/* + * ItemIdGetFlags + */ +#define ItemIdGetFlags(itemId) \ + ((itemId)->lp_flags) + +/* + * ItemIdIsValid -- + * True iff disk item identifier is valid. + */ +#define ItemIdIsValid(itemId) PointerIsValid(itemId) + +/* + * ItemIdIsUsed -- + * True iff disk item identifier is in use. + * + * Note: + * Assumes disk item identifier is valid. + */ +#define ItemIdIsUsed(itemId) \ + (AssertMacro(ItemIdIsValid(itemId)) ? \ + (bool) (((itemId)->lp_flags & LP_USED) != 0) : false) + +#endif /* ITEMID_H */ diff --git a/src/include/storage/itempos.h b/src/include/storage/itempos.h new file mode 100644 index 0000000000..63599da882 --- /dev/null +++ b/src/include/storage/itempos.h @@ -0,0 +1,44 @@ +/*------------------------------------------------------------------------- + * + * itempos.h-- + * Standard POSTGRES buffer page long item subposition definitions. + * + * + * Copyright (c) 1994, Regents of the University of California + * + * $Id: itempos.h,v 1.1 1996/08/28 01:58:09 scrappy Exp $ + * + *------------------------------------------------------------------------- + */ +#ifndef ITEMPOS_H +#define ITEMPOS_H + +#include "c.h" +#include "storage/buf.h" +#include "storage/itemid.h" + +typedef struct ItemSubpositionData { + Buffer op_db; + ItemId op_lpp; + char *op_cp; /* XXX */ + uint32 op_len; +} ItemSubpositionData; + +typedef ItemSubpositionData *ItemSubposition; + +/* + * PNOBREAK(OBJP, LEN) + * struct objpos *OBJP; + * unsigned LEN; + */ +#define PNOBREAK(OBJP, LEN) ((OBJP)->op_len >= LEN) + +/* + * PSKIP(OBJP, LEN) + * struct objpos *OBJP; + * unsigned LEN; + */ +#define PSKIP(OBJP, LEN)\ + { (OBJP)->op_cp += (LEN); (OBJP)->op_len -= (LEN); } + +#endif /* ITEMPOS_H */ diff --git a/src/include/storage/itemptr.h b/src/include/storage/itemptr.h new file mode 100644 index 0000000000..7e443eadd5 --- /dev/null +++ b/src/include/storage/itemptr.h @@ -0,0 +1,115 @@ +/*------------------------------------------------------------------------- + * + * itemptr.h-- + * POSTGRES disk item pointer definitions. + * + * + * Copyright (c) 1994, Regents of the University of California + * + * $Id: itemptr.h,v 1.1 1996/08/28 01:58:11 scrappy Exp $ + * + *------------------------------------------------------------------------- + */ +#ifndef ITEMPTR_H +#define ITEMPTR_H + +#include "c.h" +#include "storage/block.h" +#include "storage/off.h" +#include "storage/itemid.h" + +/* + * ItemPointer: + * + * this is a pointer to an item on another disk page in the same file. + * blkid tells us which block, posid tells us which entry in the linp + * (ItemIdData) array we want. + */ +typedef struct ItemPointerData { + BlockIdData ip_blkid; + OffsetNumber ip_posid; +} ItemPointerData; + +typedef ItemPointerData *ItemPointer; + +/* ---------------- + * support macros + * ---------------- + */ + +/* + * ItemPointerIsValid -- + * True iff the disk item pointer is not NULL. + */ +#define ItemPointerIsValid(pointer) \ + ((bool) (PointerIsValid(pointer) && ((pointer)->ip_posid != 0))) + +/* + * ItemPointerGetBlockNumber -- + * Returns the block number of a disk item pointer. + */ +#define ItemPointerGetBlockNumber(pointer) \ + (AssertMacro(ItemPointerIsValid(pointer)) ? \ + BlockIdGetBlockNumber(&(pointer)->ip_blkid) : (BlockNumber) 0) + +/* + * ItemPointerGetOffsetNumber -- + * Returns the offset number of a disk item pointer. + */ +#define ItemPointerGetOffsetNumber(pointer) \ + (AssertMacro(ItemPointerIsValid(pointer)) ? \ + (pointer)->ip_posid : \ + InvalidOffsetNumber) + +/* + * ItemPointerSet -- + * Sets a disk item pointer to the specified block and offset. + */ +#define ItemPointerSet(pointer, blockNumber, offNum) \ + Assert(PointerIsValid(pointer)); \ + BlockIdSet(&((pointer)->ip_blkid), blockNumber); \ + (pointer)->ip_posid = offNum + +/* + * ItemPointerSetBlockNumber -- + * Sets a disk item pointer to the specified block. + */ +#define ItemPointerSetBlockNumber(pointer, blockNumber) \ + Assert(PointerIsValid(pointer)); \ + BlockIdSet(&((pointer)->ip_blkid), blockNumber) + +/* + * ItemPointerSetOffsetNumber -- + * Sets a disk item pointer to the specified offset. + */ +#define ItemPointerSetOffsetNumber(pointer, offsetNumber) \ + AssertMacro(PointerIsValid(pointer)); \ + (pointer)->ip_posid = (offsetNumber) + +/* + * ItemPointerCopy -- + * Copies the contents of one disk item pointer to another. + */ +#define ItemPointerCopy(fromPointer, toPointer) \ + Assert(PointerIsValid(toPointer)); \ + Assert(PointerIsValid(fromPointer)); \ + *(toPointer) = *(fromPointer) + +/* + * ItemPointerSetInvalid -- + * Sets a disk item pointer to be invalid. + */ +#define ItemPointerSetInvalid(pointer) \ + Assert(PointerIsValid(pointer)); \ + BlockIdSet(&((pointer)->ip_blkid), InvalidBlockNumber); \ + (pointer)->ip_posid = InvalidOffsetNumber + +/* ---------------- + * externs + * ---------------- + */ + +extern bool ItemPointerEquals(ItemPointer pointer1, ItemPointer pointer2); + +#endif /* ITEMPTR_H */ + diff --git a/src/include/storage/large_object.h b/src/include/storage/large_object.h new file mode 100644 index 0000000000..dc9d3561c1 --- /dev/null +++ b/src/include/storage/large_object.h @@ -0,0 +1,58 @@ +/*------------------------------------------------------------------------- + * + * large_object.h-- + * file of info for Postgres large objects. POSTGRES 4.2 supports + * zillions of large objects (internal, external, jaquith, inversion). + * Now we only support inversion. + * + * Copyright (c) 1994, Regents of the University of California + * + * $Id: large_object.h,v 1.1 1996/08/28 01:58:12 scrappy Exp $ + * + *------------------------------------------------------------------------- + */ +#ifndef LARGE_OBJECT_H +#define LARGE_OBJECT_H + +#include "c.h" +#include "utils/rel.h" +#include "access/relscan.h" + +/* + * This structure will eventually have lots more stuff associated with it. + */ +typedef struct LargeObjectDesc +{ + Relation heap_r; /* heap relation */ + Relation index_r; /* index relation on seqno attribute */ + IndexScanDesc iscan; /* index scan we're using */ + TupleDesc hdesc; /* heap relation tuple desc */ + TupleDesc idesc; /* index relation tuple desc */ + uint32 lowbyte; /* low byte on the current page */ + uint32 highbyte; /* high byte on the current page */ + uint32 offset; /* current seek pointer */ + ItemPointerData htid; /* tid of current heap tuple */ + +#define IFS_RDLOCK (1 << 0) +#define IFS_WRLOCK (1 << 1) +#define IFS_ATEOF (1 << 2) + + u_long flags; /* locking info, etc */ +} LargeObjectDesc; + +/* + * Function definitions... + */ + +/* inversion stuff in inv_api.c */ +extern LargeObjectDesc *inv_create(int flags); +extern LargeObjectDesc *inv_open(Oid lobjId, int flags); +extern void inv_close(LargeObjectDesc *obj_desc); +extern int inv_destroy(Oid lobjId); +extern int inv_stat(LargeObjectDesc *obj_desc, struct pgstat *stbuf); +extern int inv_seek(LargeObjectDesc *obj_desc, int offset, int whence); +extern int inv_tell(LargeObjectDesc *obj_desc); +extern int inv_read(LargeObjectDesc *obj_desc, char *buf, int nbytes); +extern int inv_write(LargeObjectDesc *obj_desc, char *buf, int nbytes); + +#endif /* LARGE_OBJECT_H */ diff --git a/src/include/storage/lmgr.h b/src/include/storage/lmgr.h new file mode 100644 index 0000000000..87f7143a0b --- /dev/null +++ b/src/include/storage/lmgr.h @@ -0,0 +1,84 @@ +/*------------------------------------------------------------------------- + * + * lmgr.h-- + * POSTGRES lock manager definitions. + * + * + * Copyright (c) 1994, Regents of the University of California + * + * $Id: lmgr.h,v 1.1 1996/08/28 01:58:13 scrappy Exp $ + * + *------------------------------------------------------------------------- + */ +#ifndef LMGR_H +#define LMGR_H + +#include "postgres.h" + +#include "storage/itemptr.h" +#include "storage/lock.h" +#include "utils/rel.h" + +/* + * This was moved from pladt.h for the new lock manager. Want to obsolete + * all of the old code. + */ +typedef struct LRelId { + Oid relId; /* a relation identifier */ + Oid dbId; /* a database identifier */ +} LRelId; + +typedef struct LockInfoData { + bool initialized; + LRelId lRelId; + TransactionId transactionIdData; + uint16 flags; +} LockInfoData; +typedef LockInfoData *LockInfo; + +#define LockInfoIsValid(linfo) \ + ((PointerIsValid(linfo)) && ((LockInfo) linfo)->initialized) + + +extern LRelId RelationGetLRelId(Relation relation); +extern Oid LRelIdGetDatabaseId(LRelId lRelId); +extern Oid LRelIdGetRelationId(LRelId lRelId); +extern bool DatabaseIdIsMyDatabaseId(Oid databaseId); +extern bool LRelIdContainsMyDatabaseId(LRelId lRelId); +extern void RelationInitLockInfo(Relation relation); +extern void RelationDiscardLockInfo(Relation relation); +extern void RelationSetLockForDescriptorOpen(Relation relation); +extern void RelationSetLockForRead(Relation relation); +extern void RelationUnsetLockForRead(Relation relation); +extern void RelationSetLockForWrite(Relation relation); +extern void RelationUnsetLockForWrite(Relation relation); +extern void RelationSetLockForTupleRead(Relation relation, + ItemPointer itemPointer); + +/* used in vaccum.c */ +extern void RelationSetLockForWritePage(Relation relation, + ItemPointer itemPointer); + +/* used in nbtpage.c, hashpage.c */ +extern void RelationSetSingleWLockPage(Relation relation, + ItemPointer itemPointer); +extern void RelationUnsetSingleWLockPage(Relation relation, + ItemPointer itemPointer); +extern void RelationSetSingleRLockPage(Relation relation, + ItemPointer itemPointer); +extern void RelationUnsetSingleRLockPage(Relation relation, + ItemPointer itemPointer); +extern void RelationSetRIntentLock(Relation relation); +extern void RelationUnsetRIntentLock(Relation relation); +extern void RelationSetWIntentLock(Relation relation); +extern void RelationUnsetWIntentLock(Relation relation); +extern void RelationSetLockForExtend(Relation relation); +extern void RelationUnsetLockForExtend(Relation relation); +extern void LRelIdAssign(LRelId *lRelId, Oid dbId, Oid relId); + +/* single.c */ +extern bool SingleLockReln(LockInfo linfo, LOCKT lockt, int action); +extern bool SingleLockPage(LockInfo linfo, ItemPointer tidPtr, + LOCKT lockt, int action); + +#endif /* LMGR_H */ diff --git a/src/include/storage/lock.h b/src/include/storage/lock.h new file mode 100644 index 0000000000..c71aecd869 --- /dev/null +++ b/src/include/storage/lock.h @@ -0,0 +1,218 @@ +/*------------------------------------------------------------------------- + * + * lock.h-- + * + * + * + * Copyright (c) 1994, Regents of the University of California + * + * $Id: lock.h,v 1.1 1996/08/28 01:58:15 scrappy Exp $ + * + *------------------------------------------------------------------------- + */ +#ifndef LOCK_H_ +#define LOCK_H_ + +#include "postgres.h" +#include "storage/itemptr.h" +#include "storage/shmem.h" +#include "storage/spin.h" +#include "storage/backendid.h" +#include "utils/hsearch.h" + +extern SPINLOCK LockMgrLock; +typedef int MASK; + +#define INIT_TABLE_SIZE 100 +#define MAX_TABLE_SIZE 1000 + + +/* ---------------------- + * The following defines are used to estimate how much shared + * memory the lock manager is going to require. + * + * NBACKENDS - The number of concurrently running backends + * NLOCKS_PER_XACT - The number of unique locks acquired in a transaction + * NLOCKENTS - The maximum number of lock entries in the lock table. + * ---------------------- + */ +#define NBACKENDS 50 +#define NLOCKS_PER_XACT 40 +#define NLOCKENTS NLOCKS_PER_XACT*NBACKENDS + +typedef int LOCK_TYPE; +typedef int LOCKT; +typedef int LockTableId; + +/* MAX_LOCKTYPES cannot be larger than the bits in MASK */ +#define MAX_LOCKTYPES 6 + +/* + * MAX_TABLES corresponds to the number of spin locks allocated in + * CreateSpinLocks() or the number of shared memory locations allocated + * for lock table spin locks in the case of machines with TAS instructions. + */ +#define MAX_TABLES 2 + +#define INVALID_TABLEID 0 + +/*typedef struct LOCK LOCK; */ + + +typedef struct ltag { + Oid relId; + Oid dbId; + ItemPointerData tupleId; +} LOCKTAG; + +#define TAGSIZE (sizeof(LOCKTAG)) + +/* This is the control structure for a lock table. It + * lives in shared memory: + * + * tableID -- the handle used by the lock table's clients to + * refer to the table. + * + * nLockTypes -- number of lock types (READ,WRITE,etc) that + * are defined on this lock table + * + * conflictTab -- this is an array of bitmasks showing lock + * type conflicts. conflictTab[i] is a mask with the j-th bit + * turned on if lock types i and j conflict. + * + * prio -- each locktype has a priority, so, for example, waiting + * writers can be given priority over readers (to avoid + * starvation). + * + * masterlock -- synchronizes access to the table + * + */ +typedef struct lockctl { + LockTableId tableId; + int nLockTypes; + int conflictTab[MAX_LOCKTYPES]; + int prio[MAX_LOCKTYPES]; + SPINLOCK masterLock; +} LOCKCTL; + +/* + * lockHash -- hash table on lock Ids, + * xidHash -- hash on xid and lockId in case + * multiple processes are holding the lock + * ctl - control structure described above. + */ +typedef struct ltable { + HTAB *lockHash; + HTAB *xidHash; + LOCKCTL *ctl; +} LOCKTAB; + +/* ----------------------- + * A transaction never conflicts with its own locks. Hence, if + * multiple transactions hold non-conflicting locks on the same + * data, private per-transaction information must be stored in the + * XID table. The tag is XID + shared memory lock address so that + * all locks can use the same XID table. The private information + * we store is the number of locks of each type (holders) and the + * total number of locks (nHolding) held by the transaction. + * + * NOTE: -- + * There were some problems with the fact that currently TransactionIdData + * is a 5 byte entity and compilers long word aligning of structure fields. + * If the 3 byte padding is put in front of the actual xid data then the + * hash function (which uses XID_TAGSIZE when deciding how many bytes of a + * struct to look at for the key) might only see the last two bytes of the xid. + * + * Clearly this is not good since its likely that these bytes will be the + * same for many transactions and hence they will share the same entry in + * hash table causing the entry to be corrupted. For this long-winded + * reason I have put the tag in a struct of its own to ensure that the + * XID_TAGSIZE is computed correctly. It used to be sizeof (SHMEM_OFFSET) + + * sizeof(TransactionIdData) which != sizeof(XIDTAG). + * + * Finally since the hash function will now look at all 12 bytes of the tag + * the padding bytes MUST be zero'd before use in hash_search() as they + * will have random values otherwise. Jeff 22 July 1991. + * ----------------------- + */ + +typedef struct XIDTAG { + SHMEM_OFFSET lock; + int pid; + TransactionId xid; +} XIDTAG; + +typedef struct XIDLookupEnt { + /* tag */ + XIDTAG tag; + + /* data */ + int holders[MAX_LOCKTYPES]; + int nHolding; + SHM_QUEUE queue; +} XIDLookupEnt; + +#define XID_TAGSIZE (sizeof(XIDTAG)) + +/* originally in procq.h */ +typedef struct procQueue { + SHM_QUEUE links; + int size; +} PROC_QUEUE; + + +/* + * lock information: + * + * tag -- uniquely identifies the object being locked + * mask -- union of the conflict masks of all lock types + * currently held on this object. + * waitProcs -- queue of processes waiting for this lock + * holders -- count of each lock type currently held on the + * lock. + * nHolding -- total locks of all types. + */ +typedef struct Lock { + /* hash key */ + LOCKTAG tag; + + /* data */ + int mask; + PROC_QUEUE waitProcs; + int holders[MAX_LOCKTYPES]; + int nHolding; + int activeHolders[MAX_LOCKTYPES]; + int nActive; +} LOCK; + +#define LockGetLock_nHolders(l) l->nHolders + +#define LockDecrWaitHolders(lock, lockt) \ + lock->nHolding--; \ + lock->holders[lockt]-- + +#define LockLockTable() SpinAcquire(LockMgrLock); +#define UnlockLockTable() SpinRelease(LockMgrLock); + +extern SPINLOCK LockMgrLock; + +/* + * function prototypes + */ +extern void InitLocks(void); +extern void LockDisable(int status); +extern LockTableId LockTabInit(char *tabName, MASK *conflictsP, int *prioP, + int ntypes); +extern LockTableId LockTabRename(LockTableId tableId); +extern bool LockAcquire(LockTableId tableId, LOCKTAG *lockName, LOCKT lockt); +extern int LockResolveConflicts(LOCKTAB *ltable, LOCK *lock, LOCKT lockt, + TransactionId xid); +extern int WaitOnLock(LOCKTAB *ltable, LockTableId tableId, LOCK *lock, + LOCKT lockt); +extern bool LockRelease(LockTableId tableId, LOCKTAG *lockName, LOCKT lockt); +extern void GrantLock(LOCK *lock, LOCKT lockt); +extern bool LockReleaseAll(LockTableId tableId, SHM_QUEUE *lockQueue); +extern int LockShmemSize(void); +extern bool LockingDisabled(void); + +#endif /* LOCK_H */ diff --git a/src/include/storage/multilev.h b/src/include/storage/multilev.h new file mode 100644 index 0000000000..1d09c854f8 --- /dev/null +++ b/src/include/storage/multilev.h @@ -0,0 +1,64 @@ +/*------------------------------------------------------------------------- + * + * multilev.h-- + * multi level lock table consts/defs for single.c and multi.c and their + * clients + * + * + * Copyright (c) 1994, Regents of the University of California + * + * $Id: multilev.h,v 1.1 1996/08/28 01:58:17 scrappy Exp $ + * + *------------------------------------------------------------------------- + */ +#ifndef MULTILEV_H +#define MULTILEV_H + +#include "storage/lock.h" +#include "storage/lmgr.h" + +#define READ_LOCK 2 +#define WRITE_LOCK 1 + +/* any time a small granularity READ/WRITE lock is set. + * Higher granularity READ_INTENT/WRITE_INTENT locks must + * also be set. A read intent lock is has value READ+INTENT. + * in this implementation. + */ +#define NO_LOCK 0 +#define INTENT 2 +#define READ_INTENT (READ_LOCK+INTENT) +#define WRITE_INTENT (WRITE_LOCK+INTENT) + +#define EXTEND_LOCK 5 + +#define SHORT_TERM 1 +#define LONG_TERM 2 +#define UNLOCK 0 + +#define N_LEVELS 3 +#define RELN_LEVEL 0 +#define PAGE_LEVEL 1 +#define TUPLE_LEVEL 2 +typedef int LOCK_LEVEL; + +/* multi.c */ + +extern LockTableId MultiTableId; +extern LockTableId ShortTermTableId; + +/* + * function prototypes + */ +extern LockTableId InitMultiLevelLockm(void); +extern bool MultiLockReln(LockInfo linfo, LOCKT lockt); +extern bool MultiLockTuple(LockInfo linfo, ItemPointer tidPtr, LOCKT lockt); +extern bool MultiLockPage(LockInfo linfo, ItemPointer tidPtr, LOCKT lockt); +extern bool MultiAcquire(LockTableId tableId, LOCKTAG *tag, LOCKT lockt, + LOCK_LEVEL level); +extern bool MultiReleasePage(LockInfo linfo, ItemPointer tidPtr, LOCKT lockt); +extern bool MultiReleaseReln(LockInfo linfo, LOCKT lockt); +extern bool MultiRelease(LockTableId tableId, LOCKTAG *tag, LOCKT lockt, + LOCK_LEVEL level); + +#endif /* MULTILEV_H */ diff --git a/src/include/storage/off.h b/src/include/storage/off.h new file mode 100644 index 0000000000..76b38e2ca2 --- /dev/null +++ b/src/include/storage/off.h @@ -0,0 +1,60 @@ +/*------------------------------------------------------------------------- + * + * off.h-- + * POSTGRES disk "offset" definitions. + * + * + * Copyright (c) 1994, Regents of the University of California + * + * $Id: off.h,v 1.1 1996/08/28 01:58:18 scrappy Exp $ + * + *------------------------------------------------------------------------- + */ +#ifndef OFF_H +#define OFF_H + +#include "c.h" +#include "machine.h" /* for BLCKSZ */ +#include "storage/itemid.h" + +/* + * OffsetNumber: + * + * this is a 1-based index into the linp (ItemIdData) array in the + * header of each disk page. + */ +typedef uint16 OffsetNumber; + +#define InvalidOffsetNumber ((OffsetNumber) 0) +#define FirstOffsetNumber ((OffsetNumber) 1) +#define MaxOffsetNumber ((OffsetNumber) (BLCKSZ / sizeof(ItemIdData))) +#define OffsetNumberMask (0xffff) /* valid uint16 bits */ + +/* ---------------- + * support macros + * ---------------- + */ + +/* + * OffsetNumberIsValid -- + * True iff the offset number is valid. + */ +#define OffsetNumberIsValid(offsetNumber) \ + ((bool) ((offsetNumber != InvalidOffsetNumber) && \ + (offsetNumber <= MaxOffsetNumber))) + +/* + * OffsetNumberNext -- + * OffsetNumberPrev -- + * Increments/decrements the argument. These macros look pointless + * but they help us disambiguate the different manipulations on + * OffsetNumbers (e.g., sometimes we substract one from an + * OffsetNumber to move back, and sometimes we do so to form a + * real C array index). + */ +#define OffsetNumberNext(offsetNumber) \ + ((OffsetNumber) (1 + (offsetNumber))) +#define OffsetNumberPrev(offsetNumber) \ + ((OffsetNumber) (-1 + (offsetNumber))) + +#endif /* OFF_H */ diff --git a/src/include/storage/page.h b/src/include/storage/page.h new file mode 100644 index 0000000000..aee623f369 --- /dev/null +++ b/src/include/storage/page.h @@ -0,0 +1,26 @@ +/*------------------------------------------------------------------------- + * + * page.h-- + * POSTGRES buffer page abstraction definitions. + * + * + * Copyright (c) 1994, Regents of the University of California + * + * $Id: page.h,v 1.1 1996/08/28 01:58:20 scrappy Exp $ + * + *------------------------------------------------------------------------- + */ +#ifndef PAGE_H +#define PAGE_H + +#include "c.h" + +typedef Pointer Page; + +/* + * PageIsValid -- + * True iff page is valid. + */ +#define PageIsValid(page) PointerIsValid(page) + +#endif /* PAGE_H */ diff --git a/src/include/storage/pagenum.h b/src/include/storage/pagenum.h new file mode 100644 index 0000000000..77145d042c --- /dev/null +++ b/src/include/storage/pagenum.h @@ -0,0 +1,33 @@ +/*------------------------------------------------------------------------- + * + * pagenum.h-- + * POSTGRES page number definitions. + * + * + * Copyright (c) 1994, Regents of the University of California + * + * $Id: pagenum.h,v 1.1 1996/08/28 01:58:21 scrappy Exp $ + * + *------------------------------------------------------------------------- + */ +#ifndef PAGENUM_H +#define PAGENUM_H + +#include "c.h" +#include "storage/page.h" + +typedef uint16 PageNumber; + +typedef uint32 LogicalPageNumber; + +#define InvalidLogicalPageNumber 0 + +/* + * LogicalPageNumberIsValid -- + * True iff the logical page number is valid. + */ +#define LogicalPageNumberIsValid(pageNumber) \ + ((bool)((pageNumber) != InvalidLogicalPageNumber)) + + +#endif /* PAGENUM_H */ diff --git a/src/include/storage/pos.h b/src/include/storage/pos.h new file mode 100644 index 0000000000..e1a04fffd1 --- /dev/null +++ b/src/include/storage/pos.h @@ -0,0 +1,64 @@ +/*------------------------------------------------------------------------- + * + * pos.h-- + * POSTGRES "position" definitions. + * + * + * Copyright (c) 1994, Regents of the University of California + * + * $Id: pos.h,v 1.1 1996/08/28 01:58:22 scrappy Exp $ + * + *------------------------------------------------------------------------- + */ +#ifndef POS_H +#define POS_H + +#include "c.h" + +/* + * a 'position' used to be in postgres. this has + * been changed to just as the notion of having multiple pages + * within a block has been removed. + * + * the 'offset' abstraction is somewhat confusing. it is NOT a byte + * offset within the page; instead, it is an offset into the line + * pointer array contained on every page that store (heap or index) + * tuples. + */ +typedef bits16 PositionIdData; +typedef PositionIdData *PositionId; + +/* ---------------- + * support macros + * ---------------- + */ + +/* + * PositionIdIsValid -- + * True iff the position identifier is valid. + */ +#define PositionIdIsValid(positionId) \ + PointerIsValid(positionId) + +/* + * PositionIdSetInvalid -- + * Make an invalid position. + */ +#define PositionIdSetInvalid(positionId) \ + *(positionId) = (bits16) 0 + +/* + * PositionIdSet -- + * Sets a position identifier to the specified value. + */ +#define PositionIdSet(positionId, offsetNumber) \ + *(positionId) = (offsetNumber) + +/* + * PositionIdGetOffsetNumber -- + * Retrieve the offset number from a position identifier. + */ +#define PositionIdGetOffsetNumber(positionId) \ + ((OffsetNumber) *(positionId)) + +#endif /* POS_H */ diff --git a/src/include/storage/proc.h b/src/include/storage/proc.h new file mode 100644 index 0000000000..36dd928d39 --- /dev/null +++ b/src/include/storage/proc.h @@ -0,0 +1,123 @@ +/*------------------------------------------------------------------------- + * + * proc.h-- + * + * + * + * Copyright (c) 1994, Regents of the University of California + * + * $Id: proc.h,v 1.1 1996/08/28 01:58:24 scrappy Exp $ + * + *------------------------------------------------------------------------- + */ +#ifndef _PROC_H_ +#define _PROC_H_ + +#include "storage/ipc.h" +#include "storage/lock.h" +#ifndef WIN32 +#include +#else +/* This is because WIN32 already defines PROC */ +#define PROC PGL_PROC +#endif /* WIN32 */ +#include "storage/shmem.h" + + +typedef struct { + int sleeplock; + int semNum; + IpcSemaphoreId semId; + IpcSemaphoreKey semKey; +} SEMA; + +/* + * Each backend has: + */ +typedef struct proc { + + /* proc->links MUST BE THE FIRST ELEMENT OF STRUCT (see ProcWakeup()) */ + + SHM_QUEUE links; /* proc can be waiting for one event(lock) */ + SEMA sem; /* ONE semaphore to sleep on */ + int errType; /* error code tells why we woke up */ + + int procId; /* unique number for this structure + * NOT unique per backend, these things + * are reused after the backend dies. + */ + + int critSects; /* If critSects > 0, we are in sensitive + * routines that cannot be recovered when + * the process fails. + */ + + int prio; /* priority for sleep queue */ + + TransactionId xid; /* transaction currently being executed + * by this proc + */ + + LOCK * waitLock; /* Lock we're sleeping on */ + int token; /* info for proc wakeup routines */ + int pid; /* This procs process id */ + short sLocks[MAX_SPINS]; /* Spin lock stats */ + SHM_QUEUE lockQueue; /* locks associated with current transaction */ +} PROC; + + +/* + * MAX_PROC_SEMS is the maximum number of per-process semaphores (those used + * by the lock mgr) we can keep track of. PROC_NSEMS_PER_SET is the number + * of semaphores in each (sys-V) semaphore set allocated. (Be careful not + * to set it to greater 32. Otherwise, the bitmap will overflow.) + */ +#define MAX_PROC_SEMS 128 +#define PROC_NSEMS_PER_SET 16 + +typedef struct procglobal { + SHMEM_OFFSET freeProcs; + int numProcs; + IPCKey currKey; + int32 freeSemMap[MAX_PROC_SEMS/PROC_NSEMS_PER_SET]; +} PROC_HDR; + +extern PROC *MyProc; + +#define PROC_INCR_SLOCK(lock) if (MyProc) (MyProc->sLocks[(lock)])++ +#define PROC_DECR_SLOCK(lock) if (MyProc) (MyProc->sLocks[(lock)])-- + +/* + * flags explaining why process woke up + */ +#define NO_ERROR 0 +#define ERR_TIMEOUT 1 +#define ERR_BUFFER_IO 2 + +#define MAX_PRIO 50 +#define MIN_PRIO (-1) + +extern SPINLOCK ProcStructLock; + +/* + * Function Prototypes + */ +extern void InitProcess(IPCKey key); +extern void ProcReleaseLocks(void); +extern bool ProcRemove(int pid); +/* extern bool ProcKill(int exitStatus, int pid); */ +/* make static in storage/lmgr/proc.c -- jolly */ + +extern PROC_QUEUE *ProcQueueAlloc(char *name); +extern void ProcQueueInit(PROC_QUEUE *queue); +extern int ProcSleep(PROC_QUEUE *queue, SPINLOCK spinlock, int token, + int prio, LOCK *lock); +extern PROC *ProcWakeup(PROC *proc, int errType); +extern int ProcGetId(void); +extern int ProcLockWakeup(PROC_QUEUE *queue, char * ltable, char * lock); +extern void ProcAddLock(SHM_QUEUE *elem); +extern void HandleDeadLock(int sig); +extern void ProcReleaseSpins(PROC *proc); +extern void ProcFreeAllSemaphores(void); + +#endif /* PROC_H */ diff --git a/src/include/storage/shmem.h b/src/include/storage/shmem.h new file mode 100644 index 0000000000..2b13c372d4 --- /dev/null +++ b/src/include/storage/shmem.h @@ -0,0 +1,104 @@ +/*------------------------------------------------------------------------- + * + * shmem.h-- + * shared memory management structures + * + * + * Copyright (c) 1994, Regents of the University of California + * + * $Id: shmem.h,v 1.1 1996/08/28 01:58:26 scrappy Exp $ + * + *------------------------------------------------------------------------- + */ +#ifndef SHMEM_H +#define SHMEM_H + +#include "storage/spin.h" /* for SPINLOCK */ +#include "utils/hsearch.h" /* for HTAB */ + +/* The shared memory region can start at a different address + * in every process. Shared memory "pointers" are actually + * offsets relative to the start of the shared memory region(s). + */ +typedef unsigned long SHMEM_OFFSET; +#define INVALID_OFFSET (-1) +#define BAD_LOCATION (-1) + +/* start of the lowest shared memory region. For now, assume that + * there is only one shared memory region + */ +extern SHMEM_OFFSET ShmemBase; + + +/* coerce an offset into a pointer in this process's address space */ +#define MAKE_PTR(xx_offs)\ + (ShmemBase+((unsigned long)(xx_offs))) + +/* coerce a pointer into a shmem offset */ +#define MAKE_OFFSET(xx_ptr)\ + (SHMEM_OFFSET) (((unsigned long)(xx_ptr))-ShmemBase) + +#define SHM_PTR_VALID(xx_ptr)\ + (((unsigned long)xx_ptr) > ShmemBase) + +/* cannot have an offset to ShmemFreeStart (offset 0) */ +#define SHM_OFFSET_VALID(xx_offs)\ + ((xx_offs != 0) && (xx_offs != INVALID_OFFSET)) + + +extern SPINLOCK ShmemLock; +extern SPINLOCK BindingLock; + +/* shmemqueue.c */ +typedef struct SHM_QUEUE { + SHMEM_OFFSET prev; + SHMEM_OFFSET next; +} SHM_QUEUE; + +/* shmem.c */ +extern void ShmemBindingTabReset(); +extern void ShmemCreate(unsigned int key, unsigned int size); +extern int InitShmem(unsigned int key, unsigned int size); +extern long *ShmemAlloc(unsigned long size); +extern int ShmemIsValid(unsigned long addr); +extern HTAB *ShmemInitHash(char *name, long init_size, long max_size, + HASHCTL *infoP, int hash_flags); +extern bool ShmemPIDLookup(int pid, SHMEM_OFFSET* locationPtr); +extern SHMEM_OFFSET ShmemPIDDestroy(int pid); +extern long *ShmemInitStruct(char *name, unsigned long size, + bool *foundPtr); + + +typedef int TableID; + +/* size constants for the binding table */ + /* max size of data structure string name */ +#define BTABLE_KEYSIZE (50) + /* data in binding table hash bucket */ +#define BTABLE_DATASIZE (sizeof(BindingEnt) - BTABLE_KEYSIZE) + /* maximum size of the binding table */ +#define BTABLE_SIZE (100) + +/* this is a hash bucket in the binding table */ +typedef struct { + char key[BTABLE_KEYSIZE]; /* string name */ + unsigned long location; /* location in shared mem */ + unsigned long size; /* numbytes allocated for the + * structure + */ +} BindingEnt; + +/* + * prototypes for functions in shmqueue.c + */ +extern void SHMQueueInit(SHM_QUEUE *queue); +extern bool SHMQueueIsDetached(SHM_QUEUE *queue); +extern void SHMQueueElemInit(SHM_QUEUE *queue); +extern void SHMQueueDelete(SHM_QUEUE *queue); +extern void SHMQueueInsertHD(SHM_QUEUE *queue, SHM_QUEUE *elem); +extern void SHMQueueInsertTL(SHM_QUEUE *queue, SHM_QUEUE *elem); +extern void SHMQueueFirst(SHM_QUEUE *queue, Pointer *nextPtrPtr, + SHM_QUEUE *nextQueue); +extern bool SHMQueueEmpty(SHM_QUEUE *queue); + +#endif /* SHMEM_H */ diff --git a/src/include/storage/sinval.h b/src/include/storage/sinval.h new file mode 100644 index 0000000000..15d5335ae0 --- /dev/null +++ b/src/include/storage/sinval.h @@ -0,0 +1,33 @@ +/*------------------------------------------------------------------------- + * + * sinval.h-- + * POSTGRES shared cache invalidation communication definitions. + * + * + * Copyright (c) 1994, Regents of the University of California + * + * $Id: sinval.h,v 1.1 1996/08/28 01:58:28 scrappy Exp $ + * + *------------------------------------------------------------------------- + */ +#ifndef SINVAL_H +#define SINVAL_H + +#include "c.h" +#include "storage/spin.h" +#include "storage/ipc.h" +#include "storage/itemptr.h" +#include "storage/backendid.h" + +extern SPINLOCK SInvalLock; + +extern void CreateSharedInvalidationState(IPCKey key); +extern void AttachSharedInvalidationState(IPCKey key); +extern void InitSharedInvalidationState(); +extern void RegisterSharedInvalid(int cacheId, Index hashIndex, + ItemPointer pointer); +extern void InvalidateSharedInvalid(void (*invalFunction)(), + void (*resetFunction)()); + + +#endif /* SINVAL_H */ diff --git a/src/include/storage/sinvaladt.h b/src/include/storage/sinvaladt.h new file mode 100644 index 0000000000..c51b355800 --- /dev/null +++ b/src/include/storage/sinvaladt.h @@ -0,0 +1,126 @@ +/*------------------------------------------------------------------------- + * + * sinvaladt.h-- + * POSTGRES shared cache invalidation segment definitions. + * + * + * Copyright (c) 1994, Regents of the University of California + * + * $Id: sinvaladt.h,v 1.1 1996/08/28 01:58:29 scrappy Exp $ + * + *------------------------------------------------------------------------- + */ +#ifndef SINVALADT_H +#define SINVALADT_H + +#include "postgres.h" /* XXX */ + +#include "storage/ipc.h" +#include "storage/itemptr.h" +#include "storage/sinval.h" + +/* + * The structure of the shared cache invaidation segment + * + */ +/* +A------------- Header info -------------- + criticalSectionSemaphoreId + generalSemaphoreId + startEntrySection (offset a) + endEntrySection (offset a + b) + startFreeSpace (offset relative to B) + startEntryChain (offset relatiev to B) + endEntryChain (offset relative to B) + numEntries + maxNumEntries + procState[MaxBackendId] --> limit + resetState (bool) +a tag (POSTID) +B------------- Start entry section ------- + SISegEntry --> entryData --> ... (see SharedInvalidData!) + isfree (bool) + next (offset to next entry in chain ) +b .... (dynamically growing down) +C----------------End shared segment ------- + +*/ + +/* Parameters (configurable) *******************************************/ +#define MaxBackendId 32 /* maximum number of backends */ +#define MAXNUMMESSAGES 1000 /* maximum number of messages in seg*/ + + +#define InvalidOffset 1000000000 /* a invalid offset (End of chain) */ + +typedef struct ProcState { + int limit; /* the number of read messages */ + bool resetState; /* true, if backend has to reset its state */ + int tag; /* special tag, recieved from the postmaster */ +} ProcState; + + +typedef struct SISeg { + IpcSemaphoreId criticalSectionSemaphoreId; /* semaphore id */ + IpcSemaphoreId generalSemaphoreId; /* semaphore id */ + Offset startEntrySection; /* (offset a) */ + Offset endEntrySection; /* (offset a + b) */ + Offset startFreeSpace; /* (offset relative to B) */ + Offset startEntryChain; /* (offset relative to B) */ + Offset endEntryChain; /* (offset relative to B) */ + int numEntries; + int maxNumEntries; + ProcState procState[MaxBackendId]; /* reflects the invalidation state */ + /* here starts the entry section, controlled by offsets */ +} SISeg; +#define SizeSISeg sizeof(SISeg) + +typedef struct SharedInvalidData { + int cacheId; /* XXX */ + Index hashIndex; + ItemPointerData pointerData; +} SharedInvalidData; + +typedef SharedInvalidData *SharedInvalid; + + +typedef struct SISegEntry { + SharedInvalidData entryData; /* the message data */ + bool isfree; /* entry free? */ + Offset next; /* offset to next entry*/ +} SISegEntry; + +#define SizeOfOneSISegEntry sizeof(SISegEntry) + +typedef struct SISegOffsets { + Offset startSegment; /* always 0 (for now) */ + Offset offsetToFirstEntry; /* A + a = B */ + Offset offsetToEndOfSegemnt; /* A + a + b */ +} SISegOffsets; + + +/****************************************************************************/ +/* synchronization of the shared buffer access */ +/* access to the buffer is synchronized by the lock manager !! */ +/****************************************************************************/ + +#define SI_LockStartValue 255 +#define SI_SharedLock (-1) +#define SI_ExclusiveLock (-255) + +extern SISeg *shmInvalBuffer; + +/* + * prototypes for functions in sinvaladt.c + */ +extern int SIBackendInit(SISeg *segInOutP); +extern int SISegmentInit(bool killExistingSegment, IPCKey key); + +extern bool SISetDataEntry(SISeg *segP, SharedInvalidData *data); +extern void SISetProcStateInvalid(SISeg *segP); +extern bool SIDelDataEntry(SISeg *segP); +extern void SIReadEntryData(SISeg *segP, int backendId, + void (*invalFunction)(), void (*resetFunction)()); +extern void SIDelExpiredDataEntries(SISeg *segP); + +#endif /* SINVALADT_H */ diff --git a/src/include/storage/smgr.h b/src/include/storage/smgr.h new file mode 100644 index 0000000000..8f7cc98a97 --- /dev/null +++ b/src/include/storage/smgr.h @@ -0,0 +1,84 @@ +/*------------------------------------------------------------------------- + * + * smgr.h-- + * storage manager switch public interface declarations. + * + * + * Copyright (c) 1994, Regents of the University of California + * + * $Id: smgr.h,v 1.1 1996/08/28 01:58:32 scrappy Exp $ + * + *------------------------------------------------------------------------- + */ +#ifndef SMGR_H +#define SMGR_H + +#include "utils/rel.h" +#include "storage/spin.h" /* for SPINLOCK */ + +#define SM_FAIL 0 +#define SM_SUCCESS 1 + +#define DEFAULT_SMGR 0 + +extern int smgrinit(void); +extern void smgrshutdown(int dummy); +extern int smgrcreate(int16 which, Relation reln); +extern int smgrunlink(int16 which, Relation reln); +extern int smgrextend(int16 which, Relation reln, char *buffer); +extern int smgropen(int16 which, Relation reln); +extern int smgrclose(int16 which, Relation reln); +extern int smgrread(int16 which, Relation reln, BlockNumber blocknum, + char *buffer); +extern int smgrwrite(int16 which, Relation reln, BlockNumber blocknum, + char *buffer); +extern int smgrflush(int16 which, Relation reln, BlockNumber blocknum, + char *buffer); +extern int smgrblindwrt(int16 which, char *dbname, char *relname, Oid dbid, + Oid relid, BlockNumber blkno, char *buffer); +extern int smgrnblocks(int16 which, Relation reln); +extern int smgrcommit(void); +extern int smgrabort(void); +extern bool smgriswo(int16 smgrno); + + + +/* internals: move me elsewhere -- ay 7/94 */ + +/* in md.c */ +extern int mdinit(void); +extern int mdcreate(Relation reln); +extern int mdunlink(Relation reln); +extern int mdextend(Relation reln, char *buffer); +extern int mdopen(Relation reln); +extern int mdclose(Relation reln); +extern int mdread(Relation reln, BlockNumber blocknum, char *buffer); +extern int mdwrite(Relation reln, BlockNumber blocknum, char *buffer); +extern int mdflush(Relation reln, BlockNumber blocknum, char *buffer); +extern int mdblindwrt(char *dbstr, char *relstr, Oid dbid, Oid relid, + BlockNumber blkno, char *buffer); +extern int mdnblocks(Relation reln); +extern int mdcommit(void); +extern int mdabort(void); + +/* mm.c */ +extern SPINLOCK MMCacheLock; + +extern int mminit(void); +extern int mmshutdown(void); +extern int mmcreate(Relation reln); +extern int mmunlink(Relation reln); +extern int mmextend(Relation reln, char *buffer); +extern int mmopen(Relation reln); +extern int mmclose(Relation reln); +extern int mmread(Relation reln, BlockNumber blocknum, char *buffer); +extern int mmwrite(Relation reln, BlockNumber blocknum, char *buffer); +extern int mmflush(Relation reln, BlockNumber blocknum, char *buffer); +extern int mmblindwrt(char *dbstr, char *relstr, Oid dbid, Oid relid, + BlockNumber blkno, char *buffer); +extern int mmnblocks(Relation reln); +extern int mmcommit(void); +extern int mmabort(void); +extern int MMShmemSize(void); + +#endif /* SMGR_H */ diff --git a/src/include/storage/spin.h b/src/include/storage/spin.h new file mode 100644 index 0000000000..b7c98463ae --- /dev/null +++ b/src/include/storage/spin.h @@ -0,0 +1,38 @@ +/*------------------------------------------------------------------------- + * + * spin.h-- + * synchronization routines + * + * + * Copyright (c) 1994, Regents of the University of California + * + * $Id: spin.h,v 1.1 1996/08/28 01:58:33 scrappy Exp $ + * + *------------------------------------------------------------------------- + */ +#ifndef SPIN_H +#define SPIN_H + +#include "ipc.h" + +/* + * two implementations of spin locks + * + * sequent, sparc, sun3: real spin locks. uses a TAS instruction; see + * src/storage/ipc/s_lock.c for details. + * + * default: fake spin locks using semaphores. see spin.c + * + */ + +typedef int SPINLOCK; + +extern bool CreateSpinlocks(IPCKey key); +extern bool AttachSpinLocks(IPCKey key); +extern bool InitSpinLocks(int init, IPCKey key); + +extern void SpinAcquire(SPINLOCK lock); +extern void SpinRelease(SPINLOCK lock); +extern bool SpinIsLocked(SPINLOCK lock); + +#endif /* SPIN_H */ diff --git a/src/include/utils/acl.h b/src/include/utils/acl.h new file mode 100644 index 0000000000..d954cedecc --- /dev/null +++ b/src/include/utils/acl.h @@ -0,0 +1,163 @@ +/*------------------------------------------------------------------------- + * + * acl.h-- + * Definition of (and support for) access control list data structures. + * + * + * Copyright (c) 1994, Regents of the University of California + * + * $Id: acl.h,v 1.1 1996/08/28 01:58:40 scrappy Exp $ + * + * NOTES + * For backward-compatability purposes we have to allow there + * to be a null ACL in a pg_class tuple. This will be defined as + * meaning "no protection" (i.e., old catalogs get old semantics). + * + * The AclItems in an ACL array are currently kept in sorted order. + * Things will break hard if you change that without changing the + * code wherever this is included. + * + *------------------------------------------------------------------------- + */ +#ifndef ACL_H +#define ACL_H + +#include "postgres.h" +#include "utils/array.h" +#include "nodes/parsenodes.h" /* for ChangeACLStmt */ + +/* + * AclId system identifier for the user, group, etc. + * XXX currently UNIX uid for users... + */ +typedef uint32 AclId; +#define ACL_ID_WORLD 0 /* XXX only idtype should be checked */ + +/* + * AclIdType tag that describes if the AclId is a user, group, etc. + */ +typedef uint8 AclIdType; +#define ACL_IDTYPE_WORLD 0x00 +#define ACL_IDTYPE_UID 0x01 /* user id - from pg_user */ +#define ACL_IDTYPE_GID 0x02 /* group id - from pg_group */ + +/* + * AclMode the actual permissions + * XXX should probably use bit.h routines. + * XXX should probably also stuff the modechg cruft in the + * high bits, too. + */ +typedef uint8 AclMode; +#define ACL_NO 0 /* no permissions */ +#define ACL_AP (1<<0) /* append */ +#define ACL_RD (1<<1) /* read */ +#define ACL_WR (1<<2) /* write (append/delete/replace) */ +#define ACL_RU (1<<3) /* place rules */ +#define N_ACL_MODES 4 + +#define ACL_MODECHG_ADD 1 +#define ACL_MODECHG_DEL 2 +#define ACL_MODECHG_EQL 3 + +/* change this line if you want to set the default acl permission */ +#define ACL_WORLD_DEFAULT (ACL_RD) +/* #define ACL_WORLD_DEFAULT (ACL_RD|ACL_WR|ACL_AP|ACL_RU) */ +#define ACL_OWNER_DEFAULT (ACL_RD|ACL_WR|ACL_AP|ACL_RU) + +/* + * AclItem + */ +typedef struct AclItem { + AclId ai_id; + AclIdType ai_idtype; + AclMode ai_mode; +} AclItem; +/* Note: if the size of AclItem changes, + change the aclitem typlen in pg_type.h */ + +/* + * The value of the first dimension-array element. Since these arrays + * always have a lower-bound of 0, this is the same as the number of + * elements in the array. + */ +#define ARR_DIM0(a) (((unsigned *) (((char *) a) + sizeof(ArrayType)))[0]) + +/* + * Acl a one-dimensional POSTGRES array of AclItem + */ +typedef ArrayType Acl; +#define ACL_NUM(ACL) ARR_DIM0(ACL) +#define ACL_DAT(ACL) ((AclItem *) ARR_DATA_PTR(ACL)) +#define ACL_N_SIZE(N) \ + ((unsigned) (ARR_OVERHEAD(1) + ((N) * sizeof(AclItem)))) +#define ACL_SIZE(ACL) ARR_SIZE(ACL) + +/* + * IdList a one-dimensional POSTGRES array of AclId + */ +typedef ArrayType IdList; +#define IDLIST_NUM(IDL) ARR_DIM0(IDL) +#define IDLIST_DAT(IDL) ((AclId *) ARR_DATA_PTR(IDL)) +#define IDLIST_N_SIZE(N) \ + ((unsigned) (ARR_OVERHEAD(1) + ((N) * sizeof(AclId)))) +#define IDLIST_SIZE(IDL) ARR_SIZE(IDL) + +#define ACL_MODECHG_STR "+-=" /* list of valid characters */ +#define ACL_MODECHG_ADD_CHR '+' +#define ACL_MODECHG_DEL_CHR '-' +#define ACL_MODECHG_EQL_CHR '=' +#define ACL_MODE_STR "arwR" /* list of valid characters */ +#define ACL_MODE_AP_CHR 'a' +#define ACL_MODE_RD_CHR 'r' +#define ACL_MODE_WR_CHR 'w' +#define ACL_MODE_RU_CHR 'R' + +/* we use this warning string both for non-existent tables and + insufficient privilege so non-privileged users cannot ascertain whether + the class exists or not */ +#define ACL_NO_PRIV_WARNING "Either no such class or insufficient privilege" + +/* + * Enable ACL execution tracing and table dumps + */ +/*#define ACLDEBUG_TRACE*/ + +/* + * routines used internally (parser, etc.) + */ +extern char *aclparse(char *s, AclItem *aip, unsigned *modechg); +extern Acl *aclownerdefault(AclId ownerid); +extern Acl *acldefault(); +extern Acl *aclinsert3(Acl *old_acl, AclItem *mod_aip, unsigned modechg); + +extern char* aclmakepriv(char* old_privlist, char new_priv); +extern char* aclmakeuser(char* user_type, char* user); +extern ChangeACLStmt* makeAclStmt(char* privs, List* rel_list, char* grantee, + char grant_or_revoke); + +/* + * exported routines (from acl.c) + */ +extern Acl *makeacl(int n); +extern AclItem *aclitemin(char *s); +extern char *aclitemout(AclItem *aip); +extern Acl *aclinsert(Acl *old_acl, AclItem *mod_aip); +extern Acl *aclremove(Acl *old_acl, AclItem *mod_aip); +extern int32 aclcontains(Acl *acl, AclItem *aip); + +/* + * prototypes for functions in aclchk.c + */ +extern void ChangeAcl(char *relname, AclItem *mod_aip, unsigned modechg); +extern AclId get_grosysid(char *groname); +extern char *get_groname(AclId grosysid); +extern int32 aclcheck(Acl *acl, AclId id, AclIdType idtype, AclMode mode); + +/* XXX move these elsewhere -pma */ +extern int32 pg_aclcheck(char *relname, char *usename, AclMode mode); +extern int32 pg_ownercheck(char *usename, char *value, int cacheid); +extern int32 pg_func_ownercheck(char *usename, char *funcname, + int nargs, Oid *arglist); + +#endif /* ACL_H */ + diff --git a/src/include/utils/array.h b/src/include/utils/array.h new file mode 100644 index 0000000000..f8bd6fdfd7 --- /dev/null +++ b/src/include/utils/array.h @@ -0,0 +1,166 @@ +/*------------------------------------------------------------------------- + * + * array.h-- + * Utilities for the new array code. Contain prototypes from the + * following files: + * utils/adt/arrayfuncs.c + * utils/adt/arrayutils.c + * utils/adt/chunk.c + * + * + * Copyright (c) 1994, Regents of the University of California + * + * $Id: array.h,v 1.1 1996/08/28 01:58:42 scrappy Exp $ + * + * NOTES + * XXX the data array should be LONGALIGN'd -- notice that the array + * allocation code does not allocate the extra space required for this, + * even though the array-packing code does the LONGALIGNs. + * + *------------------------------------------------------------------------- + */ +#ifndef ARRAY_H +#define ARRAY_H + +#include /* for FILE (XXX should use File) */ +#include "utils/memutils.h" + +typedef struct { + int size; /* total array size (in bytes) */ + int ndim; /* # of dimensions */ + int flags; /* implementation flags */ +} ArrayType; + +/* + * bitmask of ArrayType flags field: + * 1st bit - large object flag + * 2nd bit - chunk flag (array is chunked if set) + * 3rd,4th,&5th bit - large object type (used only if bit 1 is set) + */ +#define ARR_LOB_FLAG (0x1) +#define ARR_CHK_FLAG (0x2) +#define ARR_OBJ_MASK (0x1c) + +#define ARR_FLAGS(a) ((ArrayType *) a)->flags +#define ARR_SIZE(a) (((ArrayType *) a)->size) + +#define ARR_NDIM(a) (((ArrayType *) a)->ndim) +#define ARR_NDIM_PTR(a) (&(((ArrayType *) a)->ndim)) + +#define ARR_IS_LO(a) \ + (((ArrayType *) a)->flags & ARR_LOB_FLAG) +#define SET_LO_FLAG(f,a) \ + (((ArrayType *) a)->flags |= ((f) ? ARR_LOB_FLAG : 0x0)) + +#define ARR_IS_CHUNKED(a) \ + (((ArrayType *) a)->flags & ARR_CHK_FLAG) +#define SET_CHUNK_FLAG(f,a) \ + (((ArrayType *) a)->flags |= ((f) ? ARR_CHK_FLAG : 0x0)) + +#define ARR_OBJ_TYPE(a) \ + ((ARR_FLAGS(a) & ARR_OBJ_MASK) >> 2) +#define SET_OBJ_TYPE(f,a) \ + ((ARR_FLAGS(a)&= ~ARR_OBJ_MASK), (ARR_FLAGS(a)|=((f<<2)&ARR_OBJ_MASK))) + +/* + * ARR_DIMS returns a pointer to an array of array dimensions (number of + * elements along the various array axes). + * + * ARR_LBOUND returns a pointer to an array of array lower bounds. + * + * That is: if the third axis of an array has elements 5 through 10, then + * ARR_DIMS(a)[2] == 6 and ARR_LBOUND[2] == 5. + * + * Unlike C, the default lower bound is 1. + */ +#define ARR_DIMS(a) \ + ((int *) (((char *) a) + sizeof(ArrayType))) +#define ARR_LBOUND(a) \ + ((int *) (((char *) a) + sizeof(ArrayType) + \ + (sizeof(int) * (((ArrayType *) a)->ndim)))) + +/* + * Returns a pointer to the actual array data. + */ +#define ARR_DATA_PTR(a) \ + (((char *) a) + \ + DOUBLEALIGN(sizeof(ArrayType) + 2 * (sizeof(int) * (a)->ndim))) + +/* + * The total array header size for an array of dimension n (in bytes). + */ +#define ARR_OVERHEAD(n) \ + (DOUBLEALIGN(sizeof(ArrayType) + 2 * (n) * sizeof(int))) + +/*------------------------------------------------------------------------ + * Miscellaneous helper definitions and routines for arrayfuncs.c + *------------------------------------------------------------------------ + */ + +/* #if defined(PORTNAME_irix5) */ +/* #define RETURN_NULL {*isNull = true; return(0); }*/ +/* #else*/ /* PORTNAME_irix5 */ +#define RETURN_NULL {*isNull = true; return(0); } +/* #endif */ /* PORTNAME_irix5 */ +#define NAME_LEN 30 +#define MAX_BUFF_SIZE (1 << 13) + +typedef struct { + char lo_name[NAME_LEN]; + int C[MAXDIM]; +} CHUNK_INFO; + +/* + * prototypes for functions defined in arrayfuncs.c + */ +extern char *array_in(char *string, Oid element_type); +extern char *array_out(ArrayType *v, Oid element_type); +extern char *array_dims(ArrayType *v, bool *isNull); +extern Datum array_ref(ArrayType *array, int n, int indx[], int reftype, + int elmlen, int arraylen, bool *isNull); +extern Datum array_clip(ArrayType *array, int n, int upperIndx[], + int lowerIndx[], int reftype, int len, bool *isNull); +extern char *array_set(ArrayType *array, int n, int indx[], char *dataPtr, + int reftype, int elmlen, int arraylen, bool *isNull); +extern char *array_assgn(ArrayType *array, int n, int upperIndx[], + int lowerIndx[], ArrayType *newArr, int reftype, + int len, bool *isNull); +extern int array_eq (ArrayType *array1, ArrayType *array2); +extern SanityCheckInput(int ndim, int n, int dim[], int lb[], int indx[]); +extern char *array_seek(char *ptr, int eltsize, int nitems); +extern int array_read(char *destptr, int eltsize, int nitems, char *srcptr); +extern int _LOtransfer(char **destfd, int size, int nitems, char **srcfd, + int isSrcLO, int isDestLO); + +extern char * _array_newLO(int *fd, int flag); + + +/* + * prototypes for functions defined in arrayutils.c + * [these names seem to be too generic. Add prefix for arrays? -- AY] + */ + +extern int GetOffset(int n, int dim[], int lb[], int indx[]); +extern int getNitems(int n, int a[]); +extern int compute_size(int st[], int endp[], int n, int base); +extern void mda_get_offset_values(int n, int dist[], int PC[], int span[]); +extern void mda_get_range(int n, int span[], int st[], int endp[]); +extern void mda_get_prod(int n, int range[], int P[]); +extern int tuple2linear(int n, int tup[], int scale[]); +extern void array2chunk_coord(int n, int C[], int a_coord[], int c_coord[]); +extern int next_tuple(int n, int curr[], int span[]); + +/* + * prototypes for functions defined in chunk.c + */ +extern char * _ChunkArray(int fd, FILE *afd, int ndim, int dim[], int baseSize, + int *nbytes, char *chunkfile); +extern int GetChunkSize(FILE *fd, int ndim, int dim[MAXDIM], int baseSize, + int d[MAXDIM]); +extern int _ReadChunkArray(int st[], int endp[], int bsize, int fp, + char *destfp, ArrayType *array, int isDestLO, bool *isNull); +extern struct varlena *_ReadChunkArray1El(int st[], int bsize, int fp, + ArrayType *array, bool *isNull); + + +#endif /* ARRAY_H */ diff --git a/src/include/utils/bit.h b/src/include/utils/bit.h new file mode 100644 index 0000000000..dc190accc6 --- /dev/null +++ b/src/include/utils/bit.h @@ -0,0 +1,39 @@ +/*------------------------------------------------------------------------- + * + * bit.h-- + * Standard bit array definitions. + * + * + * Copyright (c) 1994, Regents of the University of California + * + * $Id: bit.h,v 1.1 1996/08/28 01:58:43 scrappy Exp $ + * + *------------------------------------------------------------------------- + */ +#ifndef BIT_H +#define BIT_H + +typedef bits8 *BitArray; +typedef uint32 BitIndex; + +#define BitsPerByte 8 + +/* + * BitArraySetBit -- + * Sets (to 1) the value of a bit in a bit array. + */ +extern void BitArraySetBit(BitArray bitArray, BitIndex bitIndex); + +/* + * BitArrayClearBit -- + * Clears (to 0) the value of a bit in a bit array. + */ +extern void BitArrayClearBit(BitArray bitArray, BitIndex bitIndex); + +/* + * BitArrayBitIsSet -- + * True iff the bit is set (1) in a bit array. + */ +extern bool BitArrayBitIsSet(BitArray bitArray, BitIndex bitIndex); + +#endif /* BIT_H */ diff --git a/src/include/utils/builtins.h b/src/include/utils/builtins.h new file mode 100644 index 0000000000..9695cd5839 --- /dev/null +++ b/src/include/utils/builtins.h @@ -0,0 +1,433 @@ +/*------------------------------------------------------------------------- + * + * builtins.h-- + * Declarations for operations on built-in types. + * + * + * Copyright (c) 1994, Regents of the University of California + * + * $Id: builtins.h,v 1.1 1996/08/28 01:58:45 scrappy Exp $ + * + * NOTES + * This should normally only be included by fmgr.h. + * Under no circumstances should it ever be included before + * including fmgr.h! + * + *------------------------------------------------------------------------- + */ +#ifndef BUILTINS_H +#define BUILTINS_H + +#include "postgres.h" + +#include "storage/itemptr.h" + +#include "storage/large_object.h" + +#include "utils/geo-decls.h" + +/* + * Defined in adt/ + */ +/* bool.c */ +extern int32 boolin(char *b); +extern char *boolout(long b); +extern int32 booleq(int8 arg1, int8 arg2); +extern int32 boolne(int8 arg1, int8 arg2); + +/* char.c */ +extern int32 charin(char *ch); +extern char *charout(int32 ch); +extern int32 cidin(char *s); +extern char *cidout(int32 c); +extern char *char16in(char *s); +extern char *char16out(char *s); +extern int32 chareq(int8 arg1, int8 arg2); +extern int32 charne(int8 arg1, int8 arg2); +extern int32 charlt(int8 arg1, int8 arg2); +extern int32 charle(int8 arg1, int8 arg2); +extern int32 chargt(int8 arg1, int8 arg2); +extern int32 charge(int8 arg1, int8 arg2); +extern int8 charpl(int8 arg1, int8 arg2); +extern int8 charmi(int8 arg1, int8 arg2); +extern int8 charmul(int8 arg1, int8 arg2); +extern int8 chardiv(int8 arg1, int8 arg2); +extern int32 cideq(int8 arg1, int8 arg2); +extern int32 char16eq(char *arg1, char *arg2); +extern int32 char16ne(char *arg1, char *arg2); +extern int32 char16lt(char *arg1, char *arg2); +extern int32 char16le(char *arg1, char *arg2); +extern int32 char16gt(char *arg1, char *arg2); +extern int32 char16ge(char *arg1, char *arg2); +extern uint16 char2in(char *s); +extern char *char2out(uint16 s); +extern int32 char2eq(uint16 a, uint16 b); +extern int32 char2ne(uint16 a, uint16 b); +extern int32 char2lt(uint16 a, uint16 b); +extern int32 char2le(uint16 a, uint16 b); +extern int32 char2gt(uint16 a, uint16 b); +extern int32 char2ge(uint16 a, uint16 b); +extern int32 char2cmp(uint16 a, uint16 b); +extern uint32 char4in(char *s); +extern char *char4out(uint32 s); +extern int32 char4eq(uint32 a, uint32 b); +extern int32 char4ne(uint32 a, uint32 b); +extern int32 char4lt(uint32 a, uint32 b); +extern int32 char4le(uint32 a, uint32 b); +extern int32 char4gt(uint32 a, uint32 b); +extern int32 char4ge(uint32 a, uint32 b); +extern int32 char4cmp(uint32 a, uint32 b); +extern char *char8in(char *s); +extern char *char8out(char *s); +extern int32 char8eq(char *arg1, char *arg2); +extern int32 char8ne(char *arg1, char *arg2); +extern int32 char8lt(char *arg1, char *arg2); +extern int32 char8le(char *arg1, char *arg2); +extern int32 char8gt(char *arg1, char *arg2); +extern int32 char8ge(char *arg1, char *arg2); +extern int32 char8cmp(char *arg1, char *arg2); + +/* int.c */ +extern int32 int2in(char *num); +extern char *int2out(int16 sh); +extern int16 *int28in(char *shs); +extern char *int28out(int16 (*shs)[]); +extern int32 *int44in(char *input_string); +extern char *int44out(int32 an_array[]); +extern int32 int4in(char *num); +extern char *int4out(int32 l); +extern int32 i2toi4(int16 arg1); +extern int16 i4toi2(int32 arg1); +extern int32 int4eq(int32 arg1, int32 arg2); +extern int32 int4ne(int32 arg1, int32 arg2); +extern int32 int4lt(int32 arg1, int32 arg2); +extern int32 int4le(int32 arg1, int32 arg2); +extern int32 int4gt(int32 arg1, int32 arg2); +extern int32 int4ge(int32 arg1, int32 arg2); +extern int32 int2eq(int16 arg1, int16 arg2); +extern int32 int2ne(int16 arg1, int16 arg2); +extern int32 int2lt(int16 arg1, int16 arg2); +extern int32 int2le(int16 arg1, int16 arg2); +extern int32 int2gt(int16 arg1, int16 arg2); +extern int32 int2ge(int16 arg1, int16 arg2); +extern int32 int24eq(int32 arg1, int32 arg2); +extern int32 int24ne(int32 arg1, int32 arg2); +extern int32 int24lt(int32 arg1, int32 arg2); +extern int32 int24le(int32 arg1, int32 arg2); +extern int32 int24gt(int32 arg1, int32 arg2); +extern int32 int24ge(int32 arg1, int32 arg2); +extern int32 int42eq(int32 arg1, int32 arg2); +extern int32 int42ne(int32 arg1, int32 arg2); +extern int32 int42lt(int32 arg1, int32 arg2); +extern int32 int42le(int32 arg1, int32 arg2); +extern int32 int42gt(int32 arg1, int32 arg2); +extern int32 int42ge(int32 arg1, int32 arg2); +extern int32 keyfirsteq(int16 *arg1, int16 arg2); +extern int32 int4um(int32 arg); +extern int32 int4pl(int32 arg1, int32 arg2); +extern int32 int4mi(int32 arg1, int32 arg2); +extern int32 int4mul(int32 arg1, int32 arg2); +extern int32 int4div(int32 arg1, int32 arg2); +extern int32 int4inc(int32 arg); +extern int16 int2um(int16 arg); +extern int16 int2pl(int16 arg1, int16 arg2); +extern int16 int2mi(int16 arg1, int16 arg2); +extern int16 int2mul(int16 arg1, int16 arg2); +extern int16 int2div(int16 arg1, int16 arg2); +extern int16 int2inc(int16 arg); +extern int32 int24pl(int32 arg1, int32 arg2); +extern int32 int24mi(int32 arg1, int32 arg2); +extern int32 int24mul(int32 arg1, int32 arg2); +extern int32 int24div(int32 arg1, int32 arg2); +extern int32 int42pl(int32 arg1, int32 arg2); +extern int32 int42mi(int32 arg1, int32 arg2); +extern int32 int42mul(int32 arg1, int32 arg2); +extern int32 int42div(int32 arg1, int32 arg2); +extern int32 int4mod(int32 arg1, int32 arg2); +extern int32 int2mod(int16 arg1, int16 arg2); +extern int32 int24mod(int32 arg1, int32 arg2); +extern int32 int42mod(int32 arg1, int32 arg2); +extern int32 int4fac(int32 arg1); +extern int32 int2fac(int16 arg1); +extern int16 int2larger(int16 arg1, int16 arg2); +extern int16 int2smaller(int16 arg1, int16 arg2); +extern int32 int4larger(int32 arg1, int32 arg2); +extern int32 int4smaller(int32 arg1, int32 arg2); + +/* name.c */ +extern NameData *namein(char *s); +extern char *nameout(NameData *s); +extern int32 nameeq(NameData *arg1, NameData *arg2); +extern int32 namene(NameData *arg1, NameData *arg2); +extern int32 namelt(NameData *arg1, NameData *arg2); +extern int32 namele(NameData *arg1, NameData *arg2); +extern int32 namegt(NameData *arg1, NameData *arg2); +extern int32 namege(NameData *arg1, NameData *arg2); +extern int namecmp(Name n1, Name n2); +extern int namecpy(Name n1, Name n2); +extern int namecat(Name n1, Name n2); +extern int namestrcpy(Name name, char *str); +extern int namestrcat(Name name, char *str); +extern int namestrcmp(Name name, char *str); +extern uint32 NameComputeLength(Name name); + +/* numutils.c */ +/* XXX hack. HP-UX has a ltoa (with different arguments) already. */ +#ifdef PORTNAME_hpux +#define ltoa pg_ltoa +#endif /* PORTNAME_hpux */ +extern int32 pg_atoi(char *s, int size, int c); +extern void itoa(int i, char *a); +extern void ltoa(int32 l, char *a); +extern int ftoa(double value, char *ascii, int width, int prec1, char format); +extern int atof1(char *str, double *val); + +/* + * Per-opclass comparison functions for new btrees. These are + * stored in pg_amproc and defined in nbtree/ + */ +extern int32 btint2cmp(); +extern int32 btint4cmp(); +extern int32 btint24cmp(); +extern int32 btint42cmp(); +extern int32 btfloat4cmp(); +extern int32 btfloat8cmp(); +extern int32 btoidcmp(); +extern int32 btabstimecmp(); +extern int32 btcharcmp(); +extern int32 btchar16cmp(); +extern int32 bttextcmp(); + +/* + * RTree code. + * Defined in access/index-rtree/ + */ +extern char *rtinsert(); +extern char *rtdelete(); +extern char *rtgettuple(); +extern char *rtbeginscan(); +extern void rtendscan(); +extern void rtreebuild(); +extern void rtmarkpos(); +extern void rtrestrpos(); +extern void rtrescan(); +extern void rtbuild(); + +/* support routines for the rtree access method, by opclass */ +extern BOX *rt_box_union(); +extern BOX *rt_box_inter(); +extern float *rt_box_size(); +extern float *rt_bigbox_size(); +extern float *rt_poly_size(); +extern POLYGON *rt_poly_union(); +extern POLYGON *rt_poly_inter(); + +/* projection utilities */ +/* extern char *GetAttributeByName(); + extern char *GetAttributeByNum(); , + in executor/executor.h*/ + + +extern int32 pqtest(struct varlena *vlena); + +/* arrayfuncs.c */ +#include "utils/array.h" + +/* date.c */ +extern int32 reltimein(char *timestring); +extern char *reltimeout(int32 timevalue); +extern TimeInterval tintervalin(char *intervalstr); +extern char *tintervalout(TimeInterval interval); +extern TimeInterval mktinterval(AbsoluteTime t1, AbsoluteTime t2); +extern AbsoluteTime timepl(AbsoluteTime t1, RelativeTime t2); +extern AbsoluteTime timemi(AbsoluteTime t1, RelativeTime t2); +/* extern RelativeTime abstimemi(AbsoluteTime t1, AbsoluteTime t2); static*/ +extern int ininterval(AbsoluteTime t, TimeInterval interval); +extern RelativeTime intervalrel(TimeInterval interval); +extern AbsoluteTime timenow(void); +extern int32 reltimeeq(RelativeTime t1, RelativeTime t2); +extern int32 reltimene(RelativeTime t1, RelativeTime t2); +extern int32 reltimelt(RelativeTime t1, RelativeTime t2); +extern int32 reltimegt(RelativeTime t1, RelativeTime t2); +extern int32 reltimele(RelativeTime t1, RelativeTime t2); +extern int32 reltimege(RelativeTime t1, RelativeTime t2); +extern int32 intervaleq(TimeInterval i1, TimeInterval i2); +extern int32 intervalleneq(TimeInterval i, RelativeTime t); +extern int32 intervallenne(TimeInterval i, RelativeTime t); +extern int32 intervallenlt(TimeInterval i, RelativeTime t); +extern int32 intervallengt(TimeInterval i, RelativeTime t); +extern int32 intervallenle(TimeInterval i, RelativeTime t); +extern int32 intervallenge(TimeInterval i, RelativeTime t); +extern int32 intervalct(TimeInterval i1, TimeInterval i2); +extern int32 intervalov(TimeInterval i1, TimeInterval i2); +extern AbsoluteTime intervalstart(TimeInterval i); +extern AbsoluteTime intervalend(TimeInterval i); +extern int isreltime(char *timestring, int *sign, long *quantity, int *unitnr); + +/* dt.c */ +extern int32 dtin(char *datetime); +extern char *dtout(int32 datetime); + +/* filename.c */ +extern char *filename_in(char *file); +extern char *filename_out(char *s); + +/* float.c */ +extern float32 float4in(char *num); +extern char *float4out(float32 num); +extern float64 float8in(char *num); +extern char *float8out(float64 num); +extern float32 float4abs(float32 arg1); +extern float32 float4um(float32 arg1); +extern float32 float4larger(float32 arg1, float32 arg2); +extern float32 float4smaller(float32 arg1, float32 arg2); +extern float64 float8abs(float64 arg1); +extern float64 float8um(float64 arg1); +extern float64 float8larger(float64 arg1, float64 arg2); +extern float64 float8smaller(float64 arg1, float64 arg2); +extern float32 float4pl(float32 arg1, float32 arg2); +extern float32 float4mi(float32 arg1, float32 arg2); +extern float32 float4mul(float32 arg1, float32 arg2); +extern float32 float4div(float32 arg1, float32 arg2); +extern float32 float4inc(float32 arg1); +extern float64 float8pl(float64 arg1, float64 arg2); +extern float64 float8mi(float64 arg1, float64 arg2); +extern float64 float8mul(float64 arg1, float64 arg2); +extern float64 float8div(float64 arg1, float64 arg2); +extern float64 float8inc(float64 arg1); +extern long float4eq(float32 arg1, float32 arg2); +extern long float4ne(float32 arg1, float32 arg2); +extern long float4lt(float32 arg1, float32 arg2); +extern long float4le(float32 arg1, float32 arg2); +extern long float4gt(float32 arg1, float32 arg2); +extern long float4ge(float32 arg1, float32 arg2); +extern long float8eq(float64 arg1, float64 arg2); +extern long float8ne(float64 arg1, float64 arg2); +extern long float8lt(float64 arg1, float64 arg2); +extern long float8le(float64 arg1, float64 arg2); +extern long float8gt(float64 arg1, float64 arg2); +extern long float8ge(float64 arg1, float64 arg2); +extern float64 ftod(float32 num); +extern float32 dtof(float64 num); +extern float64 dround(float64 arg1); +extern float64 dtrunc(float64 arg1); +extern float64 dsqrt(float64 arg1); +extern float64 dcbrt(float64 arg1); +extern float64 dpow(float64 arg1, float64 arg2); +extern float64 dexp(float64 arg1); +extern float64 dlog1(float64 arg1); +extern float64 float48pl(float32 arg1, float64 arg2); +extern float64 float48mi(float32 arg1, float64 arg2); +extern float64 float48mul(float32 arg1, float64 arg2); +extern float64 float48div(float32 arg1, float64 arg2); +extern float64 float84pl(float64 arg1, float32 arg2); +extern float64 float84mi(float64 arg1, float32 arg2); +extern float64 float84mul(float64 arg1, float32 arg2); +extern float64 float84div(float64 arg1, float32 arg2); +extern long float48eq(float32 arg1, float64 arg2); +extern long float48ne(float32 arg1, float64 arg2); +extern long float48lt(float32 arg1, float64 arg2); +extern long float48le(float32 arg1, float64 arg2); +extern long float48gt(float32 arg1, float64 arg2); +extern long float48ge(float32 arg1, float64 arg2); +extern long float84eq(float64 arg1, float32 arg2); +extern long float84ne(float64 arg1, float32 arg2); +extern long float84lt(float64 arg1, float32 arg2); +extern long float84le(float64 arg1, float32 arg2); +extern long float84gt(float64 arg1, float32 arg2); +extern long float84ge(float64 arg1, float32 arg2); + +/* geo-ops.c, geo-selfuncs.c */ +#include "utils/geo-decls.h" + +/* misc.c */ +extern bool NullValue(Datum value, bool *isNull); +extern bool NonNullValue(Datum value, bool *isNull); +extern int32 userfntest(int i); + +/* not_in.c */ +extern bool int4notin(int16 not_in_arg, char *relation_and_attr); +extern bool oidnotin(Oid the_oid, char *compare); +extern int my_varattno(Relation rd, char *a); + +/* oid.c */ +extern Oid *oid8in(char *oidString); +extern char *oid8out(Oid (*oidArray)[]); +extern Oid oidin(char *s); +extern char *oidout(Oid o); +extern int32 oideq(Oid arg1, Oid arg2); +extern int32 oidne(Oid arg1, Oid arg2); +extern int32 oid8eq(Oid arg1[], Oid arg2[]); + +/* regexp.c */ +extern bool char2regexeq(uint16 arg1, struct varlena *p); +extern bool char2regexne(uint16 arg1, struct varlena *p); +extern bool char4regexeq(uint32 arg1, struct varlena *p); +extern bool char4regexne(uint32 arg1, struct varlena *p); +extern bool char8regexeq(char *s, struct varlena *p); +extern bool char8regexne(char *s, struct varlena *p); +extern bool char16regexeq(char *s, struct varlena *p); +extern bool char16regexne(char *s, struct varlena *p); +extern bool textregexeq(struct varlena *s, struct varlena *p); +extern bool textregexne(struct varlena *s, struct varlena *p); +extern bool char2icregexeq(uint16 arg1, struct varlena *p); +extern bool char2icregexne(uint16 arg1, struct varlena *p); +extern bool char4icregexeq(uint32 arg1, struct varlena *p); +extern bool char4icregexne(uint32 arg1, struct varlena *p); +extern bool char8icregexeq(char *s, struct varlena *p); +extern bool char8icregexne(char *s, struct varlena *p); +extern bool char16icregexeq(char *s, struct varlena *p); +extern bool char16icregexne(char *s, struct varlena *p); +extern bool nameicregexeq(NameData *s, struct varlena *p); +extern bool nameicregexne(NameData *s, struct varlena *p); +extern bool texticregexeq(struct varlena *s, struct varlena *p); +extern bool texticregexne(struct varlena *s, struct varlena *p); + + +/* regproc.c */ +extern int32 regprocin(char *proname); +extern char *regprocout(RegProcedure proid); +extern Oid RegprocToOid(RegProcedure rp); + +/* selfuncs.c */ +extern float64 eqsel(Oid opid, Oid relid, AttrNumber attno, char *value, int32 flag); +extern float64 neqsel(Oid opid, Oid relid, AttrNumber attno, char *value, int32 flag); +extern float64 intltsel(Oid opid, Oid relid, AttrNumber attno, int32 value, int32 flag); +extern float64 intgtsel(Oid opid, Oid relid, AttrNumber attno, int32 value, int32 flag); +extern float64 eqjoinsel(Oid opid, Oid relid1, AttrNumber attno1, Oid relid2, AttrNumber attno2); +extern float64 neqjoinsel(Oid opid, Oid relid1, AttrNumber attno1, Oid relid2, AttrNumber attno2); +extern float64 intltjoinsel(Oid opid, Oid relid1, AttrNumber attno1, Oid relid2, AttrNumber attno2); +extern float64 intgtjoinsel(Oid opid, Oid relid1, AttrNumber attno1, Oid relid2, AttrNumber attno2); +extern float64 btreesel(Oid operatorOid, Oid indrelid, AttrNumber attributeNumber, char *constValue, int32 constFlag, int32 nIndexKeys, Oid indexrelid); +extern float64 btreenpage(Oid operatorOid, Oid indrelid, AttrNumber attributeNumber, char *constValue, int32 constFlag, int32 nIndexKeys, Oid indexrelid); +extern float64 hashsel(Oid operatorOid, Oid indrelid, AttrNumber attributeNumber, char *constValue, int32 constFlag, int32 nIndexKeys, Oid indexrelid); +extern float64 hashnpage(Oid operatorOid, Oid indrelid, AttrNumber attributeNumber, char *constValue, int32 constFlag, int32 nIndexKeys, Oid indexrelid); +extern float64 rtsel(Oid operatorOid, Oid indrelid, AttrNumber attributeNumber, char *constValue, int32 constFlag, int32 nIndexKeys, Oid indexrelid); +extern float64 rtnpage(Oid operatorOid, Oid indrelid, AttrNumber attributeNumber, char *constValue, int32 constFlag, int32 nIndexKeys, Oid indexrelid); + +/* tid.c */ +extern ItemPointer tidin(char *str); +extern char *tidout(ItemPointer itemPtr); + +/* varlena.c */ +extern struct varlena *byteain(char *inputText); +extern struct varlena *shove_bytes(unsigned char *stuff, int len); +extern char *byteaout(struct varlena *vlena); +extern struct varlena *textin(char *inputText); +extern char *textout(struct varlena *vlena); +extern int32 texteq(struct varlena *arg1, struct varlena *arg2); +extern int32 textne(struct varlena *arg1, struct varlena *arg2); +extern int32 text_lt(struct varlena *arg1, struct varlena *arg2); +extern int32 text_le(struct varlena *arg1, struct varlena *arg2); +extern int32 text_gt(struct varlena *arg1, struct varlena *arg2); +extern int32 text_ge(struct varlena *arg1, struct varlena *arg2); +extern int32 byteaGetSize(struct varlena *v); +extern int32 byteaGetByte(struct varlena *v, int32 n); +extern int32 byteaGetBit(struct varlena *v, int32 n); +extern struct varlena *byteaSetByte(struct varlena *v, int32 n, int32 newByte); +extern struct varlena *byteaSetBit(struct varlena *v, int32 n, int32 newBit); + +/* acl.c */ +#include "utils/acl.h" + +#endif /* BUILTINS_H */ diff --git a/src/include/utils/catcache.h b/src/include/utils/catcache.h new file mode 100644 index 0000000000..317e350543 --- /dev/null +++ b/src/include/utils/catcache.h @@ -0,0 +1,85 @@ +/*------------------------------------------------------------------------- + * + * catcache.h-- + * Low-level catalog cache definitions. + * + * + * Copyright (c) 1994, Regents of the University of California + * + * $Id: catcache.h,v 1.1 1996/08/28 01:58:46 scrappy Exp $ + * + *------------------------------------------------------------------------- + */ +#ifndef CATCACHE_H +#define CATCACHE_H + +/* #define CACHEDEBUG turns DEBUG elogs on */ + +#include "postgres.h" + +#include "access/skey.h" +#include "access/htup.h" +#include "utils/rel.h" +#include "nodes/memnodes.h" +#include "lib/dllist.h" + +/* + * struct catctup: tuples in the cache. + * struct catcache: information for managing a cache. + */ + +typedef struct catctup { + HeapTuple ct_tup; /* A pointer to a tuple */ + Dlelem *ct_node; /* points to LRU list is the CatCTup is in the cache, + else, points to the cache if the CatCTup is in + LRU list */ +} CatCTup; + +/* voodoo constants */ +#define NCCBUCK 500 /* CatCache buckets*/ +#define MAXTUP 300 /* Maximum # of tuples cached per cache */ + +typedef struct catcache { + Oid relationId; + Oid indexId; + char *cc_relname; /* relation name for defered open */ + char *cc_indname; /* index name for defered open */ + HeapTuple (*cc_iscanfunc)(); /* index scanfunction */ + TupleDesc cc_tupdesc; /* tuple descriptor from reldesc */ + int id; /* XXX could be improved -hirohama */ + short cc_ntup; /* # of tuples in this cache */ + short cc_maxtup; /* max # of tuples allowed (LRU)*/ + short cc_nkeys; + short cc_size; + short cc_key[4]; + short cc_klen[4]; + ScanKeyData cc_skey[4]; + struct catcache *cc_next; + Dllist *cc_lrulist; /* LRU list, most recent first */ + Dllist *cc_cache[NCCBUCK+1]; +} CatCache; + +#define InvalidCatalogCacheId (-1) + +extern struct catcache *Caches; +extern GlobalMemory CacheCxt; + +extern void CatalogCacheInitializeCache(struct catcache *cache, + Relation relation); +extern void CatalogCacheSetId(CatCache *cacheInOutP, int id); +extern long comphash(long l, char *v); +extern Index CatalogCacheComputeHashIndex(struct catcache *cacheInP); +extern Index CatalogCacheComputeTupleHashIndex(struct catcache *cacheInOutP, + Relation relation, HeapTuple tuple); +extern void CatCacheRemoveCTup(CatCache *cache, Dlelem *e); +extern void CatalogCacheIdInvalidate(int cacheId, Index hashIndex, + ItemPointer pointer); +extern void ResetSystemCache(void); +extern CatCache *InitSysCache(char *relname, char *indname, int id, int nkeys, + int key[], HeapTuple (*iScanfuncP)()); +extern HeapTuple SearchSysCache(struct catcache *cache, Datum v1, Datum v2, + Datum v3, Datum v4); +extern void RelationInvalidateCatalogCacheTuple(Relation relation, + HeapTuple tuple, void (*function)()); + +#endif /* CATCACHE_H */ diff --git a/src/include/utils/datum.h b/src/include/utils/datum.h new file mode 100644 index 0000000000..1a0b256616 --- /dev/null +++ b/src/include/utils/datum.h @@ -0,0 +1,64 @@ +/*------------------------------------------------------------------------- + * + * datum.h-- + * POSTGRES abstract data type datum representation definitions. + * + * + * Copyright (c) 1994, Regents of the University of California + * + * $Id: datum.h,v 1.1 1996/08/28 01:58:48 scrappy Exp $ + * + *------------------------------------------------------------------------- + */ +#ifndef DATUM_H +#define DATUM_H + +#include "postgres.h" + +/*-------------------------------------------------------- + * SOME NOT VERY PORTABLE ROUTINES ??? + *-------------------------------------------------------- + * + * In the implementation of the next routines we assume the following: + * + * A) if a type is "byVal" then all the information is stored in the + * Datum itself (i.e. no pointers involved!). In this case the + * length of the type is always greater than zero and less than + * "sizeof(Datum)" + * B) if a type is not "byVal" and it has a fixed length, then + * the "Datum" always contain a pointer to a stream of bytes. + * The number of significant bytes are always equal to the length of thr + * type. + * C) if a type is not "byVal" and is of variable length (i.e. it has + * length == -1) then "Datum" always points to a "struct varlena". + * This varlena structure has information about the actual length of this + * particular instance of the type and about its value. + */ + +/*--------------- + * datumGetSize + * find the "real" length of a datum + */ +extern Size datumGetSize(Datum value, Oid type, bool byVal, Size len); + +/*--------------- + * datumCopy + * make a copy of a datum. + */ +extern Datum datumCopy(Datum value, Oid type, bool byVal, Size len); + +/*--------------- + * datumFree + * free space that *might* have been palloced by "datumCopy" + */ +extern void datumFree(Datum value, Oid type, bool byVal, Size len); + +/*--------------- + * datumIsEqual + * return true if thwo datums are equal, false otherwise. + * XXX : See comments in the code for restrictions! + */ +extern bool datumIsEqual(Datum value1, Datum value2, Oid type, + bool byVal, Size len); + +#endif /* DATUM_H */ diff --git a/src/include/utils/dynamic_loader.h b/src/include/utils/dynamic_loader.h new file mode 100644 index 0000000000..81ea4a4cf5 --- /dev/null +++ b/src/include/utils/dynamic_loader.h @@ -0,0 +1,53 @@ +/*------------------------------------------------------------------------- + * + * dynamic_loader.h-- + * + * + * + * Copyright (c) 1994, Regents of the University of California + * + * $Id: dynamic_loader.h,v 1.1 1996/08/28 01:58:49 scrappy Exp $ + * + *------------------------------------------------------------------------- + */ +#ifndef DYNAMIC_LOADER_H +#define DYNAMIC_LOADER_H + +#ifdef MIN +#undef MIN +#undef MAX +#endif /* MIN */ + +#ifdef WIN32 +#define MAXPATHLEN 250 +#endif + +#include /* for MAXPATHLEN */ +#include /* for dev_t, ino_t, etc. */ +#ifdef WIN32 +#include +#endif + +/* + * List of dynamically loaded files. + */ + +typedef struct df_files { + char filename[MAXPATHLEN]; /* Full pathname of file */ +#ifdef WIN32 + _dev_t device; /* Device file is on */ + _ino_t inode; /* Inode number of file */ +#else + dev_t device; /* Device file is on */ + ino_t inode; /* Inode number of file */ +#endif /* WIN32 */ + void *handle; /* a handle for pg_dl* functions */ + struct df_files *next; +} DynamicFileList; + +extern void *pg_dlopen(char *filename); +extern func_ptr pg_dlsym(void *handle, char *funcname); +extern void pg_dlclose(void *handle); +extern char *pg_dlerror(void); + +#endif /* DYNAMIC_LOADER_H */ diff --git a/src/include/utils/elog.h b/src/include/utils/elog.h new file mode 100644 index 0000000000..4db2ced26c --- /dev/null +++ b/src/include/utils/elog.h @@ -0,0 +1,38 @@ +/*------------------------------------------------------------------------- + * + * elog.h-- + * POSTGRES error logging definitions. + * + * + * Copyright (c) 1994, Regents of the University of California + * + * $Id: elog.h,v 1.1 1996/08/28 01:58:52 scrappy Exp $ + * + *------------------------------------------------------------------------- + */ +#ifndef ELOG_H +#define ELOG_H + +#define NOTICE 0 /* random info - no special action */ +#define WARN -1 /* Warning error - return to known state */ +#define FATAL 1 /* Fatal error - abort process */ +#define DEBUG -2 /* debug message */ +#define NOIND -3 /* debug message, don't indent as far */ + +#define PTIME 0x100 /* prepend time to message */ +#define POS 0x200 /* prepend source position to message */ +#define USERMSG 0x400 /* send message to user */ +#define TERM 0x800 /* send message to terminal */ +#define DBLOG 0x1000 /* put message in per db log */ +#define SLOG 0x2000 /* put message in system log */ +#define ABORT 0x4000 /* abort process after logging */ + +#define ELOG_MAXLEN 4096 + + +/* uncomment the following if you want your elog's to be timestamped */ +/* #define ELOG_TIMESTAMPS */ + +extern void elog(int lev, const char *fmt, ...); + +#endif /* ELOG_H */ diff --git a/src/include/utils/exc.h b/src/include/utils/exc.h new file mode 100644 index 0000000000..8ed17d2409 --- /dev/null +++ b/src/include/utils/exc.h @@ -0,0 +1,101 @@ +/*------------------------------------------------------------------------- + * + * exc.h-- + * POSTGRES exception handling definitions. + * + * + * Copyright (c) 1994, Regents of the University of California + * + * $Id: exc.h,v 1.1 1996/08/28 01:58:53 scrappy Exp $ + * + *------------------------------------------------------------------------- + */ +#ifndef EXC_H +#define EXC_H + +#include "c.h" /* for Exception, etc. */ +#include + +extern char *ExcFileName; +extern Index ExcLineNumber; + +/* + * ExcMessage and Exception are now defined in c.h + */ + +#if defined(PORTNAME_hpux) || \ + defined(PORTNAME_linux) || \ + defined(PORTNAME_next) || \ + defined(WIN32) +typedef jmp_buf ExcContext; +#else +typedef sigjmp_buf ExcContext; +#endif + +typedef Exception* ExcId; +typedef long ExcDetail; +typedef char* ExcData; + +typedef struct ExcFrame { + struct ExcFrame *link; + ExcContext context; + ExcId id; + ExcDetail detail; + ExcData data; + ExcMessage message; +} ExcFrame; + +extern ExcFrame* ExcCurFrameP; + +#define ExcBegin() \ + { \ + ExcFrame exception; \ + \ + exception.link = ExcCurFrameP; \ + if (sigsetjmp(exception.context, 1) == 0) { \ + ExcCurFrameP = &exception; \ + { +#define ExcExcept() \ + } \ + ExcCurFrameP = exception.link; \ + } else { \ + { +#define ExcEnd() \ + } \ + } \ + } + +#define raise4(x, t, d, message) \ + ExcRaise(&(x), (ExcDetail)(t), (ExcData)(d), (ExcMessage)(message)) + +#define reraise() \ + raise4(*exception.id,exception.detail,exception.data,exception.message) + +typedef void ExcProc(Exception*, ExcDetail, ExcData, ExcMessage); + + +/* + * prototypes for functions in exc.c + */ +extern void EnableExceptionHandling(bool on); +extern void ExcPrint(Exception *excP, ExcDetail detail, ExcData data, + ExcMessage message); +extern ExcProc *ExcGetUnCaught(); +extern ExcProc *ExcSetUnCaught(ExcProc *newP); +extern void ExcUnCaught(Exception *excP, ExcDetail detail, ExcData data, + ExcMessage message); +extern void ExcUnCaught(Exception *excP, ExcDetail detail, ExcData data, + ExcMessage message); +extern void ExcRaise(Exception *excP, + ExcDetail detail, + ExcData data, + ExcMessage message); + + +/* + * prototypes for functions in excabort.c + */ +extern void ExcAbort(const Exception *excP, ExcDetail detail, ExcData data, + ExcMessage message); + +#endif /* EXC_H */ diff --git a/src/include/utils/excid.h b/src/include/utils/excid.h new file mode 100644 index 0000000000..50431e3fbf --- /dev/null +++ b/src/include/utils/excid.h @@ -0,0 +1,31 @@ +/*------------------------------------------------------------------------- + * + * excid.h-- + * POSTGRES known exception identifier definitions. + * + * + * Copyright (c) 1994, Regents of the University of California + * + * $Id: excid.h,v 1.1 1996/08/28 01:58:55 scrappy Exp $ + * + *------------------------------------------------------------------------- + */ +#ifndef EXCID_H +#define EXCID_H + +#include "c.h" +#include "utils/exc.h" /* for Exception */ + +extern Exception FailedAssertion; +extern Exception BadState; +extern Exception BadArg; +extern Exception BadAllocSize; +extern Exception ExhaustedMemory; +extern Exception Unimplemented; + +extern Exception CatalogFailure; /* XXX inconsistent naming style */ +extern Exception InternalError; /* XXX inconsistent naming style */ +extern Exception SemanticError; /* XXX inconsistent naming style */ +extern Exception SystemError; /* XXX inconsistent naming style */ + +#endif /* EXCID_H */ diff --git a/src/include/utils/fcache.h b/src/include/utils/fcache.h new file mode 100644 index 0000000000..9802fdbfce --- /dev/null +++ b/src/include/utils/fcache.h @@ -0,0 +1,55 @@ +/*------------------------------------------------------------------------- + * + * fcache.h-- + * + * + * + * Copyright (c) 1994, Regents of the University of California + * + * $Id: fcache.h,v 1.1 1996/08/28 01:58:57 scrappy Exp $ + * + *------------------------------------------------------------------------- + */ +#ifndef FCACHE_H +#define FCACHE_H + +#include "fmgr.h" + +typedef struct +{ + int typlen; /* length of the return type */ + int typbyval; /* true if return type is pass by value */ + func_ptr func; /* address of function to call (for c funcs) */ + Oid foid; /* oid of the function in pg_proc */ + Oid language; /* oid of the language in pg_language */ + int nargs; /* number of arguments */ + + /* Might want to make these two arrays of size MAXFUNCARGS */ + + Oid *argOidVect; /* oids of all the arguments */ + bool *nullVect; /* keep track of null arguments */ + + char *src; /* source code of the function */ + char *bin; /* binary object code ?? */ + char *func_state; /* fuction_state struct for execution */ + + bool oneResult; /* true we only want 1 result from the + * function + */ + bool hasSetArg; /* true if func is part of a nested dot expr + * whose argument is func returning a set ugh! + */ + + Pointer funcSlot; /* if one result we need to copy it before we + * end execution of the function and free stuff + */ + + char *setArg; /* current argument for nested dot execution + * Nested dot expressions mean we have funcs + * whose argument is a set of tuples + */ + + bool istrusted; /* trusted fn? */ +} FunctionCache, *FunctionCachePtr; + +#endif /* FCACHE_H */ diff --git a/src/include/utils/fcache2.h b/src/include/utils/fcache2.h new file mode 100644 index 0000000000..a7dd535722 --- /dev/null +++ b/src/include/utils/fcache2.h @@ -0,0 +1,19 @@ +/*------------------------------------------------------------------------- + * + * fcache2.h-- + * + * + * + * Copyright (c) 1994, Regents of the University of California + * + * $Id: fcache2.h,v 1.1 1996/08/28 01:58:58 scrappy Exp $ + * + *------------------------------------------------------------------------- + */ +#ifndef FCACHE2_H +#define FCACHE2_H + +extern void +setFcache(Node *node, Oid foid, List *argList, ExprContext *econtext); + +#endif /* FCACHE2_H */ diff --git a/src/include/utils/fmgrtab.h b/src/include/utils/fmgrtab.h new file mode 100644 index 0000000000..8fe5547b54 --- /dev/null +++ b/src/include/utils/fmgrtab.h @@ -0,0 +1,29 @@ +/*------------------------------------------------------------------------- + * + * fmgrtab.h-- + * + * + * + * Copyright (c) 1994, Regents of the University of California + * + * $Id: fmgrtab.h,v 1.1 1996/08/28 01:58:59 scrappy Exp $ + * + *------------------------------------------------------------------------- + */ +#ifndef FMGRTAB_H +#define FMGRTAB_H + +#include "postgres.h" /* for ObjectId */ +#include "fmgr.h" /* genearated by Gen_fmgrtab.sh */ + +typedef struct { + Oid proid; + uint16 nargs; + func_ptr func; + char* funcName; +} FmgrCall; + +extern FmgrCall *fmgr_isbuiltin(Oid id); +extern func_ptr fmgr_lookupByName(char* name); + +#endif /* FMGRTAB_H */ diff --git a/src/include/utils/geo-decls.h b/src/include/utils/geo-decls.h new file mode 100644 index 0000000000..b4292c38f9 --- /dev/null +++ b/src/include/utils/geo-decls.h @@ -0,0 +1,248 @@ +/*------------------------------------------------------------------------- + * + * geo-decls.h-- + * Declarations for various 2D constructs. + * + * + * Copyright (c) 1994, Regents of the University of California + * + * $Id: geo-decls.h,v 1.1 1996/08/28 01:59:03 scrappy Exp $ + * + * NOTE + * These routines do *not* use the float types from adt/. + * + * XXX These routines were not written by a numerical analyst. + * + *------------------------------------------------------------------------- + */ +#ifndef GEO_DECLS_H +#define GEO_DECLS_H + +/*#ifndef FmgrIncluded -- seems like always included. (it's FMgrIncluded) AY */ + +/*-------------------------------------------------------------------- + * Useful floating point utilities and constants. + *-------------------------------------------------------------------*/ + +#include +#include "c.h" + +#define EPSILON 1.0E-06 + +#define FPzero(A) (fabs(A) <= EPSILON) +#define FPeq(A,B) (fabs((A) - (B)) <= EPSILON) +#define FPlt(A,B) ((B) - (A) > EPSILON) +#define FPle(A,B) ((A) - (B) <= EPSILON) +#define FPgt(A,B) ((A) - (B) > EPSILON) +#define FPge(A,B) ((B) - (A) <= EPSILON) + +#define HYPOT(A, B) sqrt((A) * (A) + (B) * (B)) + +/*-------------------------------------------------------------------- + * Memory management. + *-------------------------------------------------------------------*/ + +#define PALLOC(SIZE) palloc(SIZE) +#define PFREE(P) pfree(P) +#define PALLOCTYPE(TYPE) (TYPE *) PALLOC(sizeof(TYPE)) + +/*#endif !FmgrIncluded */ + +/*--------------------------------------------------------------------- + * Point - (x,y) + *-------------------------------------------------------------------*/ +typedef struct { + double x, y; +} Point; + + +/*--------------------------------------------------------------------- + * LSEG - A straight line, specified by endpoints. + *-------------------------------------------------------------------*/ +typedef struct { + Point p[2]; + + double m; /* precomputed to save time, not in tuple */ +} LSEG; + + +/*--------------------------------------------------------------------- + * PATH - Specified by vertex points. + *-------------------------------------------------------------------*/ +typedef struct { + int32 length; /* XXX varlena */ + int32 npts; + int32 closed; /* is this a closed polygon? */ + int32 dummy; /* padding to make it double align */ + Point p[1]; /* variable length array of POINTs */ +} PATH; + + +/*--------------------------------------------------------------------- + * LINE - Specified by its general equation (Ax+By+C=0). + * If there is a y-intercept, it is C, which + * incidentally gives a freebie point on the line + * (if B=0, then C is the x-intercept). + * Slope m is precalculated to save time; if + * the line is not vertical, m == A. + *-------------------------------------------------------------------*/ +typedef struct { + double A, B, C; + double m; +} LINE; + + +/*--------------------------------------------------------------------- + * BOX - Specified by two corner points, which are + * sorted to save calculation time later. + *-------------------------------------------------------------------*/ +typedef struct { + double xh, yh, xl, yl; /* high and low coords */ +} BOX; + +/*--------------------------------------------------------------------- + * POLYGON - Specified by an array of doubles defining the points, + * keeping the number of points and the bounding box for + * speed purposes. + *-------------------------------------------------------------------*/ +typedef struct { + int32 size; /* XXX varlena */ + int32 npts; + BOX boundbox; + char pts[1]; +} POLYGON; + + +/* + * in geo-ops.h + */ +extern BOX *box_in(char *str); +extern char *box_out(BOX *box); +extern BOX *box_construct(double x1, double x2, double y1, double y2); +extern BOX *box_fill(BOX *result, double x1, double x2, double y1, double y2); +extern BOX *box_copy(BOX *box); +extern long box_same(BOX *box1, BOX *box2); +extern long box_overlap(BOX *box1, BOX *box2); +extern long box_overleft(BOX *box1, BOX *box2); +extern long box_left(BOX *box1, BOX *box2); +extern long box_right(BOX *box1, BOX *box2); +extern long box_overright(BOX *box1, BOX *box2); +extern long box_contained(BOX *box1, BOX *box2); +extern long box_contain(BOX *box1, BOX *box2); +extern long box_below(BOX *box1, BOX *box2); +extern long box_above(BOX *box1, BOX *box2); +extern long box_lt(BOX *box1, BOX *box2); +extern long box_gt(BOX *box1, BOX *box2); +extern long box_eq(BOX *box1, BOX *box2); +extern long box_le(BOX *box1, BOX *box2); +extern long box_ge(BOX *box1, BOX *box2); +extern double *box_area(BOX *box); +extern double *box_length(BOX *box); +extern double *box_height(BOX *box); +extern double *box_distance(BOX *box1, BOX *box2); +extern Point *box_center(BOX *box); +extern double box_ar(BOX *box); +extern double box_ln(BOX *box); +extern double box_ht(BOX *box); +extern double box_dt(BOX *box1, BOX *box2); +extern BOX *box_intersect(BOX *box1, BOX *box2); +extern LSEG *box_diagonal(BOX *box); +extern LINE *line_construct_pm(Point *pt, double m); +extern LINE *line_construct_pp(Point *pt1, Point *pt2); +extern long line_intersect(LINE *l1, LINE *l2); +extern long line_parallel(LINE *l1, LINE *l2); +extern long line_perp(LINE *l1, LINE *l2); +extern long line_vertical(LINE *line); +extern long line_horizontal(LINE *line); +extern long line_eq(LINE *l1, LINE *l2); +extern double *line_distance(LINE *l1, LINE *l2); +extern Point *line_interpt(LINE *l1, LINE *l2); +extern PATH *path_in(char *str); +extern char *path_out(PATH *path); +extern long path_n_lt(PATH *p1, PATH *p2); +extern long path_n_gt(PATH *p1, PATH *p2); +extern long path_n_eq(PATH *p1, PATH *p2); +extern long path_n_le(PATH *p1, PATH *p2); +extern long path_n_ge(PATH *p1, PATH *p2); +extern long path_inter(PATH *p1, PATH *p2); +extern double *path_distance(PATH *p1, PATH *p2); +extern double *path_length(PATH *path); +extern double path_ln(PATH *path); +extern Point *point_in(char *str); +extern char *point_out(Point *pt); +extern Point *point_construct(double x, double y); +extern Point *point_copy(Point *pt); +extern long point_left(Point *pt1, Point *pt2); +extern long point_right(Point *pt1, Point *pt2); +extern long point_above(Point *pt1, Point *pt2); +extern long point_below(Point *pt1, Point *pt2); +extern long point_vert(Point *pt1, Point *pt2); +extern long point_horiz(Point *pt1, Point *pt2); +extern long point_eq(Point *pt1, Point *pt2); +extern long pointdist(Point *p1, Point *p2); +extern double *point_distance(Point *pt1, Point *pt2); +extern double point_dt(Point *pt1, Point *pt2); +extern double *point_slope(Point *pt1, Point *pt2); +extern double point_sl(Point *pt1, Point *pt2); +extern LSEG *lseg_in(char *str); +extern char *lseg_out(LSEG *ls); +extern LSEG *lseg_construct(Point *pt1, Point *pt2); +extern void statlseg_construct(LSEG *lseg, Point *pt1, Point *pt2); +extern long lseg_intersect(LSEG *l1, LSEG *l2); +extern long lseg_parallel(LSEG *l1, LSEG *l2); +extern long lseg_perp(LSEG *l1, LSEG *l2); +extern long lseg_vertical(LSEG *lseg); +extern long lseg_horizontal(LSEG *lseg); +extern long lseg_eq(LSEG *l1, LSEG *l2); +extern double *lseg_distance(LSEG *l1, LSEG *l2); +extern double lseg_dt(LSEG *l1, LSEG *l2); +extern Point *lseg_interpt(LSEG *l1, LSEG *l2); +extern double *dist_pl(Point *pt, LINE *line); +extern double *dist_ps(Point *pt, LSEG *lseg); +extern double *dist_ppth(Point *pt, PATH *path); +extern double *dist_pb(Point *pt, BOX *box); +extern double *dist_sl(LSEG *lseg, LINE *line); +extern double *dist_sb(LSEG *lseg, BOX *box); +extern double *dist_lb(LINE *line, BOX *box); +extern Point *interpt_sl(LSEG *lseg, LINE *line); +extern Point *close_pl(Point *pt, LINE *line); +extern Point *close_ps(Point *pt, LSEG *lseg); +extern Point *close_pb(Point *pt, BOX *box); +extern Point *close_sl(LSEG *lseg, LINE *line); +extern Point *close_sb(LSEG *lseg, BOX *box); +extern Point *close_lb(LINE *line, BOX *box); +extern long on_pl(Point *pt, LINE *line); +extern long on_ps(Point *pt, LSEG *lseg); +extern long on_pb(Point *pt, BOX *box); +extern long on_ppath(Point *pt, PATH *path); +extern long on_sl(LSEG *lseg, LINE *line); +extern long on_sb(LSEG *lseg, BOX *box); +extern long inter_sl(LSEG *lseg, LINE *line); +extern long inter_sb(LSEG *lseg, BOX *box); +extern long inter_lb(LINE *line, BOX *box); +extern void make_bound_box(POLYGON *poly); +extern POLYGON *poly_in(char *s); +extern long poly_pt_count(char *s, char delim); +extern char *poly_out(POLYGON *poly); +extern double poly_max(double *coords, int ncoords); +extern double poly_min(double *coords, int ncoords); +extern long poly_left(POLYGON *polya, POLYGON *polyb); +extern long poly_overleft(POLYGON *polya, POLYGON *polyb); +extern long poly_right(POLYGON *polya, POLYGON *polyb); +extern long poly_overright(POLYGON *polya, POLYGON *polyb); +extern long poly_same(POLYGON *polya, POLYGON *polyb); +extern long poly_overlap(POLYGON *polya, POLYGON *polyb); +extern long poly_contain(POLYGON *polya, POLYGON *polyb); +extern long poly_contained(POLYGON *polya, POLYGON *polyb); + +/* geo-selfuncs.c */ +#if 0 /* FIX ME! */ +extern float64 areasel(Oid opid, Oid relid, AttrNumber attno, char *value, int32 flag); +extern float64 areajoinsel(Oid opid, Oid relid, AttrNumber attno, char *value, int32 flag); +extern float64 leftsel(Oid opid, Oid relid, AttrNumber attno, char *value, int32 flag); +extern float64 leftjoinsel(Oid opid, Oid relid, AttrNumber attno, char *value, int32 flag); +extern float64 contsel(Oid opid, Oid relid, AttrNumber attno, char *value, int32 flag); +extern float64 contjoinsel(Oid opid, Oid relid, AttrNumber attno, char *value, int32 flag); +#endif + +#endif /* GEO_DECLS_H */ diff --git a/src/include/utils/hsearch.h b/src/include/utils/hsearch.h new file mode 100644 index 0000000000..0818d1ba79 --- /dev/null +++ b/src/include/utils/hsearch.h @@ -0,0 +1,141 @@ +/*------------------------------------------------------------------------- + * + * hsearch.h-- + * for hashing in the new buffer manager + * + * + * Copyright (c) 1994, Regents of the University of California + * + * $Id: hsearch.h,v 1.1 1996/08/28 01:59:04 scrappy Exp $ + * + *------------------------------------------------------------------------- + */ +#ifndef HSEARCH_H +#define HSEARCH_H + +#include "postgres.h" + +/* + * Constants + */ +# define DEF_BUCKET_SIZE 256 +# define DEF_BUCKET_SHIFT 8 /* log2(BUCKET) */ +# define DEF_SEGSIZE 256 +# define DEF_SEGSIZE_SHIFT 8 /* log2(SEGSIZE) */ +# define DEF_DIRSIZE 256 +# define PRIME1 37 +# define PRIME2 1048583 +# define DEF_FFACTOR 1 +# define SPLTMAX 8 + + +/* + * Hash bucket is actually bigger than this. Key field can have + * variable length and a variable length data field follows it. + */ +typedef struct element { + unsigned long next; /* secret from user */ + long key; +} ELEMENT; + +typedef unsigned long BUCKET_INDEX; +/* segment is an array of bucket pointers */ +typedef BUCKET_INDEX *SEGMENT; +typedef unsigned long SEG_OFFSET; + +typedef struct hashhdr { + long bsize; /* Bucket/Page Size */ + long bshift; /* Bucket shift */ + long dsize; /* Directory Size */ + long ssize; /* Segment Size */ + long sshift; /* Segment shift */ + long max_bucket; /* ID of Maximum bucket in use */ + long high_mask; /* Mask to modulo into entire table */ + long low_mask; /* Mask to modulo into lower half of table */ + long ffactor; /* Fill factor */ + long nkeys; /* Number of keys in hash table */ + long nsegs; /* Number of allocated segments */ + long keysize; /* hash key length in bytes */ + long datasize; /* elem data length in bytes */ + long max_dsize; /* 'dsize' limit if directory is fixed size */ + BUCKET_INDEX freeBucketIndex; + /* index of first free bucket */ +#ifdef HASH_STATISTICS + long accesses; + long collisions; +#endif +} HHDR; + +typedef struct htab { + HHDR *hctl; /* shared control information */ + long (*hash)(); /* Hash Function */ + char *segbase; /* segment base address for + * calculating pointer values + */ + SEG_OFFSET *dir; /* 'directory' of segm starts */ + long *(*alloc)(); /* memory allocator + * (long * for alignment reasons) + */ + +} HTAB; + +typedef struct hashctl { + long bsize; /* Bucket Size */ + long ssize; /* Segment Size */ + long dsize; /* Dirsize Size */ + long ffactor; /* Fill factor */ + long (*hash)(); /* Hash Function */ + long keysize; /* hash key length in bytes */ + long datasize; /* elem data length in bytes */ + long max_size; /* limit to dsize if directory size is limited */ + long *segbase; /* base for calculating bucket + seg ptrs */ + long * (*alloc)(); /* memory allocation function */ + long *dir; /* directory if allocated already */ + long *hctl; /* location of header information in shd mem */ +} HASHCTL; + +/* Flags to indicate action for hctl */ +#define HASH_BUCKET 0x001 /* Setting bucket size */ +#define HASH_SEGMENT 0x002 /* Setting segment size */ +#define HASH_DIRSIZE 0x004 /* Setting directory size */ +#define HASH_FFACTOR 0x008 /* Setting fill factor */ +#define HASH_FUNCTION 0x010 /* Set user defined hash function */ +#define HASH_ELEM 0x020 /* Setting key/data size */ +#define HASH_SHARED_MEM 0x040 /* Setting shared mem const */ +#define HASH_ATTACH 0x080 /* Do not initialize hctl */ +#define HASH_ALLOC 0x100 /* Setting memory allocator */ + + +/* seg_alloc assumes that INVALID_INDEX is 0*/ +#define INVALID_INDEX (0) +#define NO_MAX_DSIZE (-1) +/* number of hash buckets allocated at once */ +#define BUCKET_ALLOC_INCR (30) + +/* hash_search operations */ +typedef enum { + HASH_FIND, + HASH_ENTER, + HASH_REMOVE, + HASH_FIND_SAVE, + HASH_REMOVE_SAVED +} HASHACTION; + +/* + * prototypes from functions in dynahash.c + */ +extern HTAB *hash_create(int nelem, HASHCTL *info, int flags); +extern void hash_destroy(HTAB *hashp); +extern void hash_stats(char *where, HTAB *hashp); +extern long *hash_search(HTAB *hashp, char *keyPtr, HASHACTION action, + bool *foundPtr); +extern long *hash_seq(HTAB *hashp); + +/* + * prototypes from functions in hashfn.c + */ +extern long string_hash(char *key, int keysize); +extern long tag_hash(int *key, int keysize); +extern long disk_hash(char *key); + +#endif /* HSEARCH_H */ diff --git a/src/include/utils/inval.h b/src/include/utils/inval.h new file mode 100644 index 0000000000..7b5418e14a --- /dev/null +++ b/src/include/utils/inval.h @@ -0,0 +1,56 @@ +/*------------------------------------------------------------------------- + * + * inval.h-- + * POSTGRES cache invalidation dispatcher definitions. + * + * + * Copyright (c) 1994, Regents of the University of California + * + * $Id: inval.h,v 1.1 1996/08/28 01:59:05 scrappy Exp $ + * + *------------------------------------------------------------------------- + */ +#ifndef INVAL_H +#define INVAL_H + +#include "postgres.h" +#include "access/htup.h" +#include "utils/rel.h" + +extern void DiscardInvalid(void); + +extern void RegisterInvalid(bool send); + +extern void SetRefreshWhenInvalidate(bool on); + +extern void RelationInvalidateHeapTuple(Relation relation, HeapTuple tuple); + +/* + * POSTGRES local cache invalidation definitions. (originates from linval.h) + */ +typedef struct InvalidationUserData { + struct InvalidationUserData *dataP[1]; /* VARIABLE LENGTH */ +} InvalidationUserData; /* VARIABLE LENGTH STRUCTURE */ + +typedef struct InvalidationEntryData { + InvalidationUserData *nextP; + InvalidationUserData userData; /* VARIABLE LENGTH ARRAY */ +} InvalidationEntryData; /* VARIABLE LENGTH STRUCTURE */ + +typedef Pointer InvalidationEntry; + +typedef InvalidationEntry LocalInvalid; + +#define EmptyLocalInvalid NULL + +extern InvalidationEntry InvalidationEntryAllocate(uint16 size); + +extern LocalInvalid LocalInvalidRegister(LocalInvalid invalid, + InvalidationEntry entry); + +extern void LocalInvalidInvalidate(LocalInvalid invalid, void (*function)()); + +extern void getmyrelids(void); + +#endif /* INVAL_H */ + diff --git a/src/include/utils/lselect.h b/src/include/utils/lselect.h new file mode 100644 index 0000000000..d130f3dd2a --- /dev/null +++ b/src/include/utils/lselect.h @@ -0,0 +1,40 @@ +/*------------------------------------------------------------------------- + * + * lselect.h-- + * definitions for the replacement selection algorithm. + * + * + * Copyright (c) 1994, Regents of the University of California + * + * $Id: lselect.h,v 1.1 1996/08/28 01:59:07 scrappy Exp $ + * + *------------------------------------------------------------------------- + */ +#ifndef LSELECT_H +#define LSELECT_H + +#include "c.h" +#include "access/htup.h" + +struct leftist { + short lt_dist; /* distance to leaf/empty node */ + short lt_devnum; /* device number of tuple */ + HeapTuple lt_tuple; + struct leftist *lt_left; + struct leftist *lt_right; +}; + +extern struct leftist *Tuples; + +extern struct leftist *lmerge(struct leftist *pt, struct leftist *qt); +extern HeapTuple gettuple(struct leftist **treep, short *devnum); +extern int puttuple(struct leftist **treep, HeapTuple newtuple, int devnum); +extern void dumptuples(FILE *file); +extern int tuplecmp(HeapTuple ltup, HeapTuple rtup); + +#ifdef EBUG +extern void checktree(struct leftist *tree); +extern int checktreer(struct leftist *tree, int level); +#endif /* EBUG */ + +#endif /* LSELECT_H */ diff --git a/src/include/utils/lsyscache.h b/src/include/utils/lsyscache.h new file mode 100644 index 0000000000..2eb66f0bf5 --- /dev/null +++ b/src/include/utils/lsyscache.h @@ -0,0 +1,45 @@ +/*------------------------------------------------------------------------- + * + * lsyscache.h-- + * + * + * + * Copyright (c) 1994, Regents of the University of California + * + * $Id: lsyscache.h,v 1.1 1996/08/28 01:59:08 scrappy Exp $ + * + *------------------------------------------------------------------------- + */ +#ifndef LSYSCACHE_H +#define LSYSCACHE_H + +#include "access/htup.h" + +extern bool op_class(Oid opid, int32 opclass, Oid amopid); +extern char *get_attname(Oid relid, AttrNumber attnum); +extern AttrNumber get_attnum(Oid relid, char *attname); +extern Oid get_atttype(Oid relid, AttrNumber attnum); +extern bool get_attisset(Oid relid, char *attname); +extern RegProcedure get_opcode(Oid opid); +extern char *get_opname(Oid opid); +extern bool op_mergesortable(Oid opid, Oid ltype, Oid rtype, + Oid *leftOp, Oid *rightOp); +extern Oid op_hashjoinable(Oid opid, Oid ltype, Oid rtype); +extern Oid get_commutator(Oid opid); +extern HeapTuple get_operator_tuple(Oid opno); +extern Oid get_negator(Oid opid); +extern RegProcedure get_oprrest(Oid opid); +extern RegProcedure get_oprjoin(Oid opid); +extern int get_relnatts(Oid relid); +extern char *get_rel_name(Oid relid); +extern struct varlena * get_relstub(Oid relid, int no, bool *islast); +extern Oid get_ruleid(char *rulename); +extern Oid get_eventrelid(Oid ruleid); +extern int16 get_typlen(Oid typid); +extern char get_typalign(Oid typid); +extern bool get_typbyval(Oid typid); +extern struct varlena *get_typdefault(Oid typid); +extern char get_typtype(Oid typid); + +#endif /* LSYSCACHE_H */ + diff --git a/src/include/utils/mcxt.h b/src/include/utils/mcxt.h new file mode 100644 index 0000000000..ca047cd4c4 --- /dev/null +++ b/src/include/utils/mcxt.h @@ -0,0 +1,56 @@ +/*------------------------------------------------------------------------- + * + * mcxt.h-- + * POSTGRES memory context definitions. + * + * + * Copyright (c) 1994, Regents of the University of California + * + * $Id: mcxt.h,v 1.1 1996/08/28 01:59:09 scrappy Exp $ + * + *------------------------------------------------------------------------- + */ +#ifndef MCXT_H +#define MCXT_H + +#include "c.h" + +#include "nodes/memnodes.h" +#include "nodes/nodes.h" + +extern MemoryContext CurrentMemoryContext; +extern MemoryContext TopMemoryContext; + + +/* + * MaxAllocSize -- + * Arbitrary limit on size of allocations. + * + * Note: + * There is no guarantee that allocations smaller than MaxAllocSize + * will succeed. Allocation requests larger than MaxAllocSize will + * be summarily denied. + * + * This value should not be referenced except in one place in the code. + * + * XXX This should be defined in a file of tunable constants. + */ +#define MaxAllocSize (0xfffffff) /* 16G - 1 */ + +/* + * prototypes for functions in mcxt.c + */ +extern void EnableMemoryContext(bool on); +extern Pointer MemoryContextAlloc(MemoryContext context, Size size); +extern Pointer MemoryContextRealloc(MemoryContext context, + Pointer pointer, + Size size); +extern void MemoryContextFree(MemoryContext context, Pointer pointer); +extern char *MemoryContextGetName(MemoryContext context); +extern Size PointerGetAllocSize(Pointer pointer); +extern MemoryContext MemoryContextSwitchTo(MemoryContext context); +extern GlobalMemory CreateGlobalMemory(char *name); +extern void GlobalMemoryDestroy(GlobalMemory context); + + +#endif /* MCXT_H */ diff --git a/src/include/utils/memutils.h b/src/include/utils/memutils.h new file mode 100644 index 0000000000..5582bd6b68 --- /dev/null +++ b/src/include/utils/memutils.h @@ -0,0 +1,281 @@ +/*------------------------------------------------------------------------- + * + * memutils.h-- + * this file contains general memory alignment, allocation + * and manipulation stuff that used to be spread out + * between the following files: + * + * align.h alignment macros + * aset.h memory allocation set stuff + * oset.h (used by aset.h) + * (bit.h bit array type / extern) + * clib.h mem routines + * limit.h max bits/byte, etc. + * + * + * Copyright (c) 1994, Regents of the University of California + * + * $Id: memutils.h,v 1.1 1996/08/28 01:59:10 scrappy Exp $ + * + * NOTES + * some of the information in this file will be moved to + * other files, (like MaxHeapTupleSize and MaxAttributeSize). + * + *------------------------------------------------------------------------- + */ +#ifndef MEMUTILS_H +#define MEMUTILS_H + +#include "c.h" + +#if 0 +/***************************************************************************** + * align.h - alignment macros * + **************************************************************************** + [TRH] Let the compiler decide what alignment it uses instead of +tending + we know better. + GCC (at least v2.5.8 and up) has an __alignof__ keyword. + However, we cannot use it here since on some architectures it reports + just a _recommended_ alignment instead of the actual alignment used in + padding structures (or at least, this is how I understand gcc's +s...) + So define a macro that gives us the _actual_ alignment inside a struct. + {{note: assumes that alignment size is always a power of 2.}} + */ +#define _ALIGNSIZE(TYPE) offsetof(struct { char __c; TYPE __t;}, __t) +#define _ALIGN(TYPE, LEN) \ + (((long)(LEN) + (_ALIGNSIZE(TYPE) - 1)) & ~(_ALIGNSIZE(TYPE) - 1)) +#define SHORTALIGN(LEN) _ALIGN(short, (LEN)) +#define INTALIGN(LEN) _ALIGN(int, (LEN)) +#define LONGALIGN(LEN) _ALIGN(long, (LEN)) +#define DOUBLEALIGN(LEN) _ALIGN(double, (LEN)) +#define MAXALIGN(LEN) _ALIGN(double, (LEN)) + +#endif /* 0 */ + +/* + * SHORTALIGN(LEN) - length (or address) aligned for shorts + */ +#define SHORTALIGN(LEN)\ + (((long)(LEN) + (sizeof (short) - 1)) & ~(sizeof (short) - 1)) + +#define INTALIGN(LEN)\ + (((long)(LEN) + (sizeof (int) - 1)) & ~(sizeof (int) -1)) + +/* + * LONGALIGN(LEN) - length (or address) aligned for longs + */ +#if defined(sun) && ! defined(sparc) +#define LONGALIGN(LEN) SHORTALIGN(LEN) +#elif defined (PORTNAME_alpha) +#define LONGALIGN(LEN)\ + (((long)(LEN) + (sizeof (int) - 1)) & ~(sizeof (int) -1)) +#else +#define LONGALIGN(LEN)\ + (((long)(LEN) + (sizeof (long) - 1)) & ~(sizeof (long) -1)) +#endif + +#define DOUBLEALIGN(LEN)\ + (((long)(LEN) + (sizeof (double) - 1)) & ~(sizeof (double) -1)) + +#define MAXALIGN(LEN)\ + (((long)(LEN) + (sizeof (double) - 1)) & ~(sizeof (double) -1)) + +/***************************************************************************** + * bit.h * + *****************************************************************************/ +#include "utils/bit.h" + +/***************************************************************************** + * oset.h -- Fixed format ordered set definitions. * + *****************************************************************************/ +/* Note: + * Fixed format ordered sets are . + * XXX This is a preliminary version. Work is needed to explain + * XXX semantics of the external definitions. Otherwise, the + * XXX functional interface should not change. + * + * Identification: + * $Header: /cvsroot/pgsql/src/include/utils/memutils.h,v 1.1 1996/08/28 01:59:10 scrappy Exp $ + */ + +typedef struct OrderedElemData OrderedElemData; +typedef OrderedElemData* OrderedElem; + +typedef struct OrderedSetData OrderedSetData; +typedef OrderedSetData* OrderedSet; + +struct OrderedElemData { + OrderedElem next; /* Next elem or &this->set->dummy */ + OrderedElem prev; /* Previous elem or &this->set->head */ + OrderedSet set; /* Parent set */ +}; + +struct OrderedSetData { + OrderedElem head; /* First elem or &this->dummy */ + OrderedElem dummy; /* (hack) Terminator == NULL */ + OrderedElem tail; /* Last elem or &this->head */ + Offset offset; /* Offset from struct base to elem */ + /* this could be signed short int! */ +}; + +extern void OrderedSetInit(OrderedSet set, Offset offset); +extern bool OrderedSetContains(OrderedSet set, OrderedElem elem); +extern Pointer OrderedSetGetHead(OrderedSet set); +extern Pointer OrderedSetGetTail(OrderedSet set); +extern Pointer OrderedElemGetPredecessor(OrderedElem elem); +extern Pointer OrderedElemGetSuccessor(OrderedElem elem); +extern void OrderedElemPop(OrderedElem elem); +extern void OrderedElemPushInto(OrderedElem elem, OrderedSet Set); + +/***************************************************************************** + * aset.h -- Allocation set definitions. * + *****************************************************************************/ +/* + * Description: + * An allocation set is a set containing allocated elements. When + * an allocation is requested for a set, memory is allocated and a + * pointer is returned. Subsequently, this memory may be freed or + * reallocated. In addition, an allocation set may be reset which + * will cause all allocated memory to be freed. + * + * Allocations may occur in four different modes. The mode of + * allocation does not affect the behavior of allocations except in + * terms of performance. The allocation mode is set at the time of + * set initialization. Once the mode is chosen, it cannot be changed + * unless the set is reinitialized. + * + * "Dynamic" mode forces all allocations to occur in a heap. This + * is a good mode to use when small memory segments are allocated + * and freed very frequently. This is a good choice when allocation + * characteristics are unknown. This is the default mode. + * + * "Static" mode attemts to allocate space as efficiently as possible + * without regard to freeing memory. This mode should be chosen only + * when it is known that many allocations will occur but that very + * little of the allocated memory will be explicitly freed. + * + * "Tunable" mode is a hybrid of dynamic and static modes. The + * tunable mode will use static mode allocation except when the + * allocation request exceeds a size limit supplied at the time of set + * initialization. "Big" objects are allocated using dynamic mode. + * + * "Bounded" mode attempts to allocate space efficiently given a limit + * on space consumed by the allocation set. This restriction can be + * considered a "soft" restriction, because memory segments will + * continue to be returned after the limit is exceeded. The limit is + * specified at the time of set initialization like for tunable mode. + * + * Note: + * Allocation sets are not automatically reset on a system reset. + * Higher level code is responsible for cleaning up. + * + * There may other modes in the future. + */ + +/* + * AllocPointer -- + * Aligned pointer which may be a member of an allocation set. + */ +typedef Pointer AllocPointer; + +/* + * AllocMode -- + * Mode of allocation for an allocation set. + * + * Note: + * See above for a description of the various nodes. + */ +typedef enum AllocMode { + DynamicAllocMode, /* always dynamically allocate */ + StaticAllocMode, /* always "statically" allocate */ + TunableAllocMode, /* allocations are "tuned" */ + BoundedAllocMode /* allocations bounded to fixed usage */ +} AllocMode; + +#define DefaultAllocMode DynamicAllocMode + +/* + * AllocSet -- + * Allocation set. + */ +typedef struct AllocSetData { + OrderedSetData setData; + /* Note: this will change in the future to support other modes */ +} AllocSetData; + +typedef AllocSetData *AllocSet; + +/* + * AllocPointerIsValid -- + * True iff pointer is valid allocation pointer. + */ +#define AllocPointerIsValid(pointer) PointerIsValid(pointer) + +/* + * AllocSetIsValid -- + * True iff set is valid allocation set. + */ +#define AllocSetIsValid(set) PointerIsValid(set) + +extern void AllocSetInit(AllocSet set, AllocMode mode, Size limit); + +extern void AllocSetReset(AllocSet set); + +extern bool AllocSetContains(AllocSet set, AllocPointer pointer); +extern AllocPointer AllocSetAlloc(AllocSet set, Size size); +extern void AllocSetFree(AllocSet set, AllocPointer pointer); +extern AllocPointer AllocSetRealloc(AllocSet set, AllocPointer pointer, + Size size); + +extern int AllocSetIterate(AllocSet set, + void (*function)(AllocPointer pointer)); + +extern int AllocSetCount(AllocSet set); + +extern void AllocPointerDump(AllocPointer pointer); +extern void AllocSetDump(AllocSet set); + +/***************************************************************************** + * clib.h -- Standard C library definitions * + *****************************************************************************/ +/* + * Note: + * This file is OPERATING SYSTEM dependent!!! + * + */ +/* #include */ +/* use because it's ANSI */ +#include + +/* + * LibCCopyLength is only used within this file. -cim 6/12/90 + * + */ +typedef int LibCCopyLength; + +typedef CLibCopyLength; + +/* + * MemoryCopy -- + * Copies fixed length block of memory to another. + */ +#define MemoryCopy(toBuffer, fromBuffer, length)\ + memcpy(toBuffer, fromBuffer, length) + +/***************************************************************************** + * limit.h -- POSTGRES limit definitions. * + *****************************************************************************/ + +#define MaxBitsPerByte 8 + +typedef uint32 AttributeSize; /* XXX should be defined elsewhere */ + +#define MaxHeapTupleSize 0x7fffffff +#define MaxAttributeSize 0x7fffffff + +#define MaxIndexAttributeNumber 7 + + +#endif /* MEMUTILS_H */ diff --git a/src/include/utils/module.h b/src/include/utils/module.h new file mode 100644 index 0000000000..6c5d77d6ad --- /dev/null +++ b/src/include/utils/module.h @@ -0,0 +1,25 @@ +/*------------------------------------------------------------------------- + * + * module.h-- + * this file contains general "module" stuff that used to be + * spread out between the following files: + * + * enbl.h module enable stuff + * trace.h module trace stuff (now gone) + * + * + * Copyright (c) 1994, Regents of the University of California + * + * $Id: module.h,v 1.1 1996/08/28 01:59:12 scrappy Exp $ + * + *------------------------------------------------------------------------- + */ +#ifndef MODULE_H +#define MODULE_H + +/* + * prototypes for functions in init/enbl.c + */ +extern bool BypassEnable(int *enableCountInOutP, bool on); + +#endif /* MODULE_H */ diff --git a/src/include/utils/nabstime.h b/src/include/utils/nabstime.h new file mode 100644 index 0000000000..d36dec3ac7 --- /dev/null +++ b/src/include/utils/nabstime.h @@ -0,0 +1,165 @@ +/*------------------------------------------------------------------------- + * + * nabstime.h-- + * Definitions for the "new" abstime code. + * + * + * Copyright (c) 1994, Regents of the University of California + * + * $Id: nabstime.h,v 1.1 1996/08/28 01:59:13 scrappy Exp $ + * + *------------------------------------------------------------------------- + */ +#ifndef NABSTIME_H +#define NABSTIME_H + +#include +#include +#if !defined(PORTNAME_irix5) +#include +#endif +#include "miscadmin.h" /* for SystemTime */ + +/* ---------------------------------------------------------------- + * time types + support macros + * + * + * ---------------------------------------------------------------- + */ +typedef int32 AbsoluteTime; +typedef int32 RelativeTime; + +typedef struct { + int32 status; + AbsoluteTime data[2]; +} TimeIntervalData; +typedef TimeIntervalData *TimeInterval; + +#define EPOCH_ABSTIME ((AbsoluteTime) 0) +#define INVALID_ABSTIME ((AbsoluteTime) 2147483647) /* 2^31 - 1 */ +#define CURRENT_ABSTIME ((AbsoluteTime) 2147483646) /* 2^31 - 2 */ +#define NOEND_ABSTIME ((AbsoluteTime) 2147483645) /* 2^31 - 3 */ + + +#if defined(PORTNAME_aix) +/* + * AIX considers 2147483648 == -2147483648 (since they have the same bit + * representation) but uses a different sign sense in a comparison to + * these integer constants depending on whether the constant is signed + * or not! + */ +#include +/*#define NOSTART_ABSTIME ((AbsoluteTime) HIBITI) */ /* - 2^31 */ +#define NOSTART_ABSTIME ((AbsoluteTime) INT_MIN) +#else +/*#define NOSTART_ABSTIME ((AbsoluteTime) 2147483648)*/ /* - 2^31 */ +#define NOSTART_ABSTIME ((AbsoluteTime) -2147483647) /* - 2^31 */ +#endif /* PORTNAME_aix */ + +#define INVALID_RELTIME ((RelativeTime) 2147483647) /* 2^31 - 1 */ + +/* ---------------- + * time support macros (from tim.h) + * ---------------- + */ + +#define AbsoluteTimeIsValid(time) \ + ((bool) ((time) != INVALID_ABSTIME)) + +#define AbsoluteTimeIsReal(time) \ + ((bool) (((AbsoluteTime) time) < NOEND_ABSTIME && \ + ((AbsoluteTime) time) > NOSTART_ABSTIME)) + +/* have to include this because EPOCH_ABSTIME used to be invalid - yuk */ +#define AbsoluteTimeIsBackwardCompatiblyValid(time) \ + ((bool) (((AbsoluteTime) time) != INVALID_ABSTIME && \ + ((AbsoluteTime) time) > EPOCH_ABSTIME)) + +#define AbsoluteTimeIsBackwardCompatiblyReal(time) \ + ((bool) (((AbsoluteTime) time) < NOEND_ABSTIME && \ + ((AbsoluteTime) time) > NOSTART_ABSTIME && \ + ((AbsoluteTime) time) > EPOCH_ABSTIME)) + +#define RelativeTimeIsValid(time) \ + ((bool) (((RelativeTime) time) != INVALID_RELTIME)) + +#define GetCurrentAbsoluteTime() \ + ((AbsoluteTime) getSystemTime()) + +/* + * getSystemTime -- + * Returns system time. + */ +#define getSystemTime() \ + ((time_t) (time(0l))) + + +/* + * Meridian: am, pm, or 24-hour style. + */ +#define AM 0 +#define PM 1 +#define HR24 2 + +/* can't have more of these than there are bits in an unsigned long */ +#define MONTH 1 +#define YEAR 2 +#define DAY 3 +#define TIME 4 +#define TZ 5 +#define DTZ 6 +#define PG_IGNORE 7 +#define AMPM 8 +/* below here are unused so far */ +#define SECONDS 9 +#define MONTHS 10 +#define YEARS 11 +#define NUMBER 12 +/* these are only for relative dates */ +#define ABS_BEFORE 13 +#define ABS_AFTER 14 +#define AGO 15 + + +#define SECS(n) ((time_t)(n)) +#define MINS(n) ((time_t)(n) * SECS(60)) +#define HOURS(n) ((time_t)(n) * MINS(60)) /* 3600 secs */ +#define DAYS(n) ((time_t)(n) * HOURS(24)) /* 86400 secs */ +/* months and years are not constant length, must be specially dealt with */ + +#define TOKMAXLEN 6 /* only this many chars are stored in datetktbl */ + +/* keep this struct small; it gets used a lot */ +typedef struct { +#if defined(PORTNAME_aix) + char *token; +#else + char token[TOKMAXLEN]; +#endif /* PORTNAME_aix */ + char type; + char value; /* this may be unsigned, alas */ +} datetkn; + +/* + * nabstime.c prototypes + */ +extern AbsoluteTime nabstimein(char *timestr); +extern int prsabsdate(char *timestr, struct tm *tm, int *tzp); +extern int tryabsdate(char *fields[], int nf, struct tm *tm, int *tzp); +extern int parsetime(char *time, struct tm *tm); +extern int split(char *string, char *fields[], int nfields, char *sep); +extern char *nabstimeout(AbsoluteTime time); +extern AbsoluteTime dateconv(struct tm *tm, int zone); +extern time_t qmktime(struct tm *tp); +extern datetkn *datetoktype(char *s, int *bigvalp); +extern datetkn *datebsearch(char *key, datetkn *base, unsigned int nel); +extern bool AbsoluteTimeIsBefore(AbsoluteTime time1, AbsoluteTime time2); +extern bool AbsoluteTimeIsAfter(AbsoluteTime time1, AbsoluteTime time2); +extern int32 abstimeeq(AbsoluteTime t1, AbsoluteTime t2); +extern int32 abstimene(AbsoluteTime t1, AbsoluteTime t2); +extern int32 abstimelt(AbsoluteTime t1, AbsoluteTime t2); +extern int32 abstimegt(AbsoluteTime t1, AbsoluteTime t2); +extern int32 abstimele(AbsoluteTime t1, AbsoluteTime t2); +extern int32 abstimege(AbsoluteTime t1, AbsoluteTime t2); + +#endif /* NABSTIME_H */ diff --git a/src/include/utils/oidcompos.h b/src/include/utils/oidcompos.h new file mode 100644 index 0000000000..290fb08ee6 --- /dev/null +++ b/src/include/utils/oidcompos.h @@ -0,0 +1,52 @@ +/*------------------------------------------------------------------------- + * + * oidcompos.h-- + * prototype file for the oid {char16,int4} composite type functions. + * + * + * Copyright (c) 1994, Regents of the University of California + * + * $Id: oidcompos.h,v 1.1 1996/08/28 01:59:15 scrappy Exp $ + * + *------------------------------------------------------------------------- + */ +#ifndef OIDCOMPOS_H +#define OIDCOMPOS_H + +/* oidint4.c */ +OidInt4 oidint4in(char *o); +char *oidint4out(OidInt4 o); +bool oidint4lt(OidInt4 o1, OidInt4 o2); +bool oidint4le(OidInt4 o1, OidInt4 o2); +bool oidint4eq(OidInt4 o1, OidInt4 o2); +bool oidint4ge(OidInt4 o1, OidInt4 o2); +bool oidint4gt(OidInt4 o1, OidInt4 o2); +bool oidint4ne(OidInt4 o1, OidInt4 o2); +int oidint4cmp(OidInt4 o1, OidInt4 o2); +OidInt4 mkoidint4(Oid v_oid, uint32 v_int4); + +/* oidint2.c */ +OidInt2 oidint2in(char *o); +char *oidint2out(OidInt2 o); +bool oidint2lt(OidInt2 o1, OidInt2 o2); +bool oidint2le(OidInt2 o1, OidInt2 o2); +bool oidint2eq(OidInt2 o1, OidInt2 o2); +bool oidint2ge(OidInt2 o1, OidInt2 o2); +bool oidint2gt(OidInt2 o1, OidInt2 o2); +bool oidint2ne(OidInt2 o1, OidInt2 o2); +int oidint2cmp(OidInt2 o1, OidInt2 o2); +OidInt2 mkoidint2(Oid v_oid, uint16 v_int2); + +/* oidname.c */ +OidName oidnamein(char *inStr); +char *oidnameout(OidName oidname); +bool oidnamelt(OidName o1, OidName o2); +bool oidnamele(OidName o1, OidName o2); +bool oidnameeq(OidName o1, OidName o2); +bool oidnamene(OidName o1, OidName o2); +bool oidnamege(OidName o1, OidName o2); +bool oidnamegt(OidName o1, OidName o2); +int oidnamecmp(OidName o1, OidName o2); +OidName mkoidname(Oid id, char *name); + +#endif /* OIDCOMPOS_H */ diff --git a/src/include/utils/palloc.h b/src/include/utils/palloc.h new file mode 100644 index 0000000000..d3953e941a --- /dev/null +++ b/src/include/utils/palloc.h @@ -0,0 +1,26 @@ +/*------------------------------------------------------------------------- + * + * palloc.h-- + * POSTGRES memory allocator definitions. + * + * + * Copyright (c) 1994, Regents of the University of California + * + * $Id: palloc.h,v 1.1 1996/08/28 01:59:16 scrappy Exp $ + * + *------------------------------------------------------------------------- + */ +#ifndef PALLOC_H +#define PALLOC_H + +#include "c.h" + +extern void* palloc(Size size); +extern void pfree(void *pointer); +extern void *repalloc(void *pointer, Size size); + +/* like strdup except uses palloc */ +extern char* pstrdup(char* pointer); + +#endif /* PALLOC_H */ + diff --git a/src/include/utils/portal.h b/src/include/utils/portal.h new file mode 100644 index 0000000000..4eb1ece56d --- /dev/null +++ b/src/include/utils/portal.h @@ -0,0 +1,97 @@ +/*------------------------------------------------------------------------- + * + * portal.h-- + * POSTGRES portal definitions. + * + * + * Copyright (c) 1994, Regents of the University of California + * + * $Id: portal.h,v 1.1 1996/08/28 01:59:18 scrappy Exp $ + * + *------------------------------------------------------------------------- + */ +/* + * Note: + * A portal is an abstraction which represents the execution state of + * a running query (or a fixed sequence of queries). The "blank portal" is + * a portal with an InvalidName. This blank portal is in existance except + * between calls to BlankPortalAssignName and GetPortalByName(NULL). + * + * Note: + * now that PQ calls can be made from within a backend, a portal + * may also be used to keep track of the tuples resulting + * from the execution of a query. In this case, entryIndex + */ +#ifndef PORTAL_H +#define PORTAL_H + +#include "c.h" + +#include "nodes/execnodes.h" /* for EState */ +#include "nodes/memnodes.h" +#include "nodes/nodes.h" +#include "nodes/pg_list.h" +#include "nodes/plannodes.h" /* for Plan */ +#include "executor/execdesc.h" + +typedef struct PortalBlockData { + AllocSetData setData; + FixedItemData itemData; +} PortalBlockData; + +typedef PortalBlockData *PortalBlock; + +typedef struct PortalD PortalD; +typedef PortalD *Portal; + +struct PortalD { + char *name; /* XXX PortalName */ + struct PortalVariableMemory variable; + struct PortalHeapMemory heap; + QueryDesc *queryDesc; + TupleDesc attinfo; + EState *state; + void (*cleanup)(Portal); +}; + +/* + * PortalIsValid -- + * True iff portal is valid. + */ +#define PortalIsValid(p) PointerIsValid(p) + +/* + * Special portals (well, their names anyway) + */ +#define VACPNAME "" + +extern bool PortalNameIsSpecial(char *pname); +extern void CollectNamedPortals(Portal *portalP, int destroy); +extern void AtEOXact_portals(void); +extern void EnablePortalManager(bool on); +extern Portal GetPortalByName(char *name); +extern Portal BlankPortalAssignName(char *name); +extern void PortalSetQuery(Portal portal, QueryDesc *queryDesc, + TupleDesc attinfo, EState *state, + void (*cleanup)(Portal portal)); +extern QueryDesc *PortalGetQueryDesc(Portal portal); +extern EState *PortalGetState(Portal portal); +extern Portal CreatePortal(char *name); +extern void PortalDestroy(Portal *portalP); +extern void PortalResetHeapMemory(Portal portal); +extern void StartPortalAllocMode(AllocMode mode, Size limit); +extern void EndPortalAllocMode(void); +extern PortalVariableMemory PortalGetVariableMemory(Portal portal); +extern PortalHeapMemory PortalGetHeapMemory(Portal portal); +extern Portal PortalVariableMemoryGetPortal(PortalVariableMemory context); +extern Portal PortalHeapMemoryGetPortal(PortalHeapMemory context); +extern PortalHeapMemory PortalVariableMemoryGetHeapMemory(PortalVariableMemory context); +extern PortalVariableMemory PortalHeapMemoryGetVariableMemory(PortalHeapMemory context); + +/* estimate of the maximum number of open portals a user would have, + * used in initially sizing the PortalHashTable in EnablePortalManager() + */ +#define PORTALS_PER_USER 10 + + +#endif /* PORTAL_H */ diff --git a/src/include/utils/psort.h b/src/include/utils/psort.h new file mode 100644 index 0000000000..45d5231981 --- /dev/null +++ b/src/include/utils/psort.h @@ -0,0 +1,86 @@ +/*------------------------------------------------------------------------- + * + * psort.h-- + * + * + * + * Copyright (c) 1994, Regents of the University of California + * + * $Id: psort.h,v 1.1 1996/08/28 01:59:20 scrappy Exp $ + * + *------------------------------------------------------------------------- + */ +#ifndef PSORT_H +#define PSORT_H + +#define SORTMEM (1 << 18) /* 1/4 M - any static memory */ +#define MAXTAPES 7 /* 7--See Fig. 70, p273 */ +#define TAPEEXT "pg_psort.XXXXXX" /* TEMPDIR/TAPEEXT */ +#define FREE(x) free((char *) x) + +struct tape { + int tp_dummy; /* (D) */ + int tp_fib; /* (A) */ + FILE *tp_file; /* (TAPE) */ + struct tape *tp_prev; +}; + +struct cmplist { + int cp_attn; /* attribute number */ + int cp_num; /* comparison function code */ + int cp_rev; /* invert comparison flag */ + struct cmplist *cp_next; /* next in chain */ +}; + +extern int Nkeys; +extern ScanKey key; +extern int SortMemory; /* free memory */ +extern Relation SortRdesc; +extern struct leftist *Tuples; + +#ifdef EBUG +#include +#include "utils/elog.h" +#include "storage/buf.h" +#include "storage/bufmgr.h" + +#define PDEBUG(PROC, S1)\ +elog(DEBUG, "%s:%d>> PROC: %s.", __FILE__, __LINE__, S1) + +#define PDEBUG2(PROC, S1, D1)\ +elog(DEBUG, "%s:%d>> PROC: %s %d.", __FILE__, __LINE__, S1, D1) + +#define PDEBUG4(PROC, S1, D1, S2, D2)\ +elog(DEBUG, "%s:%d>> PROC: %s %d, %s %d.", __FILE__, __LINE__, S1, D1, S2, D2) + +#define VDEBUG(VAR, FMT)\ +elog(DEBUG, "%s:%d>> VAR =FMT", __FILE__, __LINE__, VAR) + +#define ASSERT(EXPR, STR)\ +if (!(EXPR)) elog(FATAL, "%s:%d>> %s", __FILE__, __LINE__, STR) + +#define TRACE(VAL, CODE)\ +if (1) CODE; else + +#else +#define PDEBUG(MSG) +#define VDEBUG(VAR, FMT) +#define ASSERT(EXPR, MSG) +#define TRACE(VAL, CODE) +#endif + +/* psort.c */ +extern void psort(Relation oldrel, Relation newrel, int nkeys, ScanKey key); +extern void initpsort(void); +extern void resetpsort(void); +extern void initialrun(Relation rdesc); +extern bool createrun(HeapScanDesc sdesc, FILE *file); +extern HeapTuple tuplecopy(HeapTuple tup, Relation rdesc, Buffer b); +extern FILE *mergeruns(void); +extern void merge(struct tape *dest); +extern void endpsort(Relation rdesc, FILE *file); +extern FILE *gettape(void); +extern void resettape(FILE *file); +extern void destroytape(FILE *file); + +#endif /* PSORT_H */ diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h new file mode 100644 index 0000000000..c848ae138e --- /dev/null +++ b/src/include/utils/rel.h @@ -0,0 +1,170 @@ +/*------------------------------------------------------------------------- + * + * rel.h-- + * POSTGRES relation descriptor definitions. + * + * + * Copyright (c) 1994, Regents of the University of California + * + * $Id: rel.h,v 1.1 1996/08/28 01:59:21 scrappy Exp $ + * + *------------------------------------------------------------------------- + */ +#ifndef REL_H +#define REL_H + +#include "postgres.h" + +#include "storage/fd.h" +#include "access/strat.h" +#include "access/tupdesc.h" + +#include "catalog/pg_am.h" +#include "catalog/pg_operator.h" +#include "catalog/pg_class.h" + +#include "rewrite/prs2lock.h" + +typedef struct RelationData { + File rd_fd; /* open file descriptor */ + int rd_nblocks; /* number of blocks in rel */ + uint16 rd_refcnt; /* reference count */ + bool rd_islocal; /* uses the local buffer mgr */ + bool rd_isnailed; /* rel is nailed in cache */ + Form_pg_am rd_am; /* AM tuple */ + Form_pg_class rd_rel; /* RELATION tuple */ + Oid rd_id; /* relations's object id */ + Pointer lockInfo; /* ptr. to misc. info. */ + TupleDesc rd_att; /* tuple desciptor */ + RuleLock *rd_rules; /* rewrite rules */ + IndexStrategy rd_istrat; + RegProcedure* rd_support; +} RelationData; + +typedef RelationData *Relation; + +/* ---------------- + * RelationPtr is used in the executor to support index scans + * where we have to keep track of several index relations in an + * array. -cim 9/10/89 + * ---------------- + */ +typedef Relation *RelationPtr; + +#define InvalidRelation ((Relation)NULL) + +typedef char ArchiveMode; + +/* + * RelationIsValid -- + * True iff relation descriptor is valid. + */ +#define RelationIsValid(relation) PointerIsValid(relation) + +/* + * RelationGetSystemPort -- + * Returns system port of a relation. + * + * Note: + * Assumes relation descriptor is valid. + */ +#define RelationGetSystemPort(relation) ((relation)->rd_fd) + +/* + * RelationGetLockInfo -- + * Returns the lock information structure in the reldesc + * + */ +#define RelationGetLockInfo(relation) ((relation)->lockInfo) + +/* + * RelationHasReferenceCountZero -- + * True iff relation reference count is zero. + * + * Note: + * Assumes relation descriptor is valid. + */ +#define RelationHasReferenceCountZero(relation) \ + ((bool)((relation)->rd_refcnt == 0)) + +/* + * RelationSetReferenceCount -- + * Sets relation reference count. + */ +#define RelationSetReferenceCount(relation,count) ((relation)->rd_refcnt = count) + +/* + * RelationIncrementReferenceCount -- + * Increments relation reference count. + */ +#define RelationIncrementReferenceCount(relation) ((relation)->rd_refcnt += 1); + +/* + * RelationDecrementReferenceCount -- + * Decrements relation reference count. + */ +#define RelationDecrementReferenceCount(relation) ((relation)->rd_refcnt -= 1) + +/* + * RelationGetAccessMethodTupleForm -- + * Returns access method attribute values for a relation. + * + * Note: + * Assumes relation descriptor is valid. + */ +#define RelationGetAccessMethodTupleForm(relation) ((relation)->rd_am) + +/* + * RelationGetRelationTupleForm -- + * Returns relation attribute values for a relation. + * + * Note: + * Assumes relation descriptor is valid. + */ +#define RelationGetRelationTupleForm(relation) ((relation)->rd_rel) + + +/* + * RelationGetRelationId -- + * + * returns the object id of the relation + * + */ +#define RelationGetRelationId(relation) ((relation)->rd_id) + +/* + * RelationGetFile -- + * + * Returns the open File decscriptor + */ +#define RelationGetFile(relation) ((relation)->rd_fd) + + +/* + * RelationGetRelationName -- + * + * Returns a Relation Name + */ +#define RelationGetRelationName(relation) (&(relation)->rd_rel->relname) + +/* + * RelationGetRelationName -- + * + * Returns a the number of attributes. + */ +#define RelationGetNumberOfAttributes(relation) ((relation)->rd_rel->relnatts) + +/* + * RelationGetTupleDescriptor -- + * Returns tuple descriptor for a relation. + * + * Note: + * Assumes relation descriptor is valid. + */ +#define RelationGetTupleDescriptor(relation) ((relation)->rd_att) + +extern IndexStrategy RelationGetIndexStrategy(Relation relation); + +extern void RelationSetIndexSupport(Relation relation, IndexStrategy strategy, + RegProcedure *support); +#endif /* REL_H */ diff --git a/src/include/utils/rel2.h b/src/include/utils/rel2.h new file mode 100644 index 0000000000..8f2742457c --- /dev/null +++ b/src/include/utils/rel2.h @@ -0,0 +1,23 @@ +/*------------------------------------------------------------------------- + * + * rel2.h-- + * + * + * + * Copyright (c) 1994, Regents of the University of California + * + * $Id: rel2.h,v 1.1 1996/08/28 01:59:22 scrappy Exp $ + * + *------------------------------------------------------------------------- + */ +#ifndef TMP_REL2_H +#define TMP_REL2_H + +#include "access/istrat.h" + +extern IndexStrategy RelationGetIndexStrategy(Relation relation); + +extern void RelationSetIndexSupport(Relation relation, IndexStrategy strategy, + RegProcedure *support); + +#endif /* TMP_REL2_H */ diff --git a/src/include/utils/relcache.h b/src/include/utils/relcache.h new file mode 100644 index 0000000000..3ad124d7f6 --- /dev/null +++ b/src/include/utils/relcache.h @@ -0,0 +1,47 @@ +/*------------------------------------------------------------------------- + * + * relcache.h-- + * Relation descriptor cache definitions. + * + * + * Copyright (c) 1994, Regents of the University of California + * + * $Id: relcache.h,v 1.1 1996/08/28 01:59:24 scrappy Exp $ + * + *------------------------------------------------------------------------- + */ +#ifndef RELCACHE_H +#define RELCACHE_H + +#include + +#include "postgres.h" +#include "utils/rel.h" + +/* + * relation lookup routines + */ +extern Relation RelationIdCacheGetRelation(Oid relationId); +extern Relation RelationNameCacheGetRelation(char *relationName); +extern Relation RelationIdGetRelation(Oid relationId); +extern Relation RelationNameGetRelation(char *relationName); +extern Relation getreldesc(char *relationName); + +extern void RelationClose(Relation relation); +extern void RelationFlushRelation(Relation *relationPtr, + bool onlyFlushReferenceCountZero); +extern void RelationIdInvalidateRelationCacheByRelationId(Oid relationId); + +extern void +RelationIdInvalidateRelationCacheByAccessMethodId(Oid accessMethodId); + +extern void RelationCacheInvalidate(bool onlyFlushReferenceCountZero); + +extern void RelationRegisterRelation(Relation relation); +extern void RelationPurgeLocalRelation(bool xactComitted); +extern void RelationInitialize(); +extern void init_irels(); +extern void write_irels(); + + +#endif /* RELCACHE_H */ diff --git a/src/include/utils/sets.h b/src/include/utils/sets.h new file mode 100644 index 0000000000..4580f15a3d --- /dev/null +++ b/src/include/utils/sets.h @@ -0,0 +1,22 @@ +/*------------------------------------------------------------------------- + * + * sets.h-- + * + * + * + * Copyright (c) 1994, Regents of the University of California + * + * $Id: sets.h,v 1.1 1996/08/28 01:59:25 scrappy Exp $ + * + *------------------------------------------------------------------------- + */ +#ifndef SETS_H +#define SETS_H + +/* Temporary name of set, before SetDefine changes it. */ +#define GENERICSETNAME "zyxset" + +extern Oid SetDefine(char *querystr, char *typename); +extern int seteval(Oid funcoid); + +#endif /* SETS_H */ diff --git a/src/include/utils/syscache.h b/src/include/utils/syscache.h new file mode 100644 index 0000000000..82f38b9a90 --- /dev/null +++ b/src/include/utils/syscache.h @@ -0,0 +1,90 @@ +/*------------------------------------------------------------------------- + * + * syscache.h-- + * System catalog cache definitions. + * + * + * Copyright (c) 1994, Regents of the University of California + * + * $Id: syscache.h,v 1.1 1996/08/28 01:59:26 scrappy Exp $ + * + *------------------------------------------------------------------------- + */ +#ifndef SYSCACHE_H +#define SYSCACHE_H + +/*#define CACHEDEBUG*/ /* turns DEBUG elogs on */ + +#include "postgres.h" +#include "access/htup.h" +#include "nodes/pg_list.h" + +/* + * Declarations for util/syscache.c. + * + * SysCache identifiers. + * + * The order of these must match the order + * they are entered into the structure cacheinfo[] in syscache.c + * The best thing to do is to add yours at the END, because some + * code assumes that certain caches are at certain places in this + * array. + */ + +#define AMOPOPID 0 +#define AMOPSTRATEGY 1 +#define ATTNAME 2 +#define ATTNUM 3 +#define INDEXRELID 4 +#define LANNAME 5 +#define OPRNAME 6 +#define OPROID 7 +#define PRONAME 8 +#define PROOID 9 +#define RELNAME 10 +#define RELOID 11 +#define TYPNAME 12 +#define TYPOID 13 +#define AMNAME 14 +#define CLANAME 15 +#define INDRELIDKEY 16 +#define INHRELID 17 +#define RULOID 18 +#define AGGNAME 19 +#define LISTENREL 20 +#define USENAME 21 +#define USESYSID 22 +#define GRONAME 23 +#define GROSYSID 24 +#define REWRITENAME 25 +#define PROSRC 26 +#define CLADEFTYPE 27 + +/* ---------------- + * struct cachedesc: information needed for a call to InitSysCache() + * ---------------- + */ +struct cachedesc { + char *name; /* this is Name * so that we can initialize it */ + int nkeys; + int key[4]; + int size; /* sizeof(appropriate struct) */ + char *indname; /* index relation for this cache, if exists */ + HeapTuple (*iScanFunc)(); /* function to handle index scans */ +}; + +extern void zerocaches(void); +extern void InitCatalogCache(void); +extern HeapTuple SearchSysCacheTuple(int cacheId, Datum key1, Datum key2, + Datum key3, Datum key4); +extern int32 SearchSysCacheStruct(int cacheId, char *returnStruct, + Datum key1, Datum key2, Datum key3, Datum key4); +extern void *SearchSysCacheGetAttribute(int cacheId, + AttrNumber attributeNumber, + Datum key1, + Datum key2, + Datum key3, + Datum key4); +extern void *TypeDefaultRetrieve(Oid typId); + +#endif /* SYSCACHE_H */ diff --git a/src/include/utils/tqual.h b/src/include/utils/tqual.h new file mode 100644 index 0000000000..a082d757bb --- /dev/null +++ b/src/include/utils/tqual.h @@ -0,0 +1,55 @@ +/*------------------------------------------------------------------------- + * + * tqual.h-- + * POSTGRES time qualification definitions. + * + * + * Copyright (c) 1994, Regents of the University of California + * + * $Id: tqual.h,v 1.1 1996/08/28 01:59:28 scrappy Exp $ + * + * NOTE + * It may be desirable to allow time qualifications to indicate + * relative times. + * + *------------------------------------------------------------------------- + */ +#ifndef TQUAL_H +#define TQUAL_H + +#include "postgres.h" +#include "utils/nabstime.h" +#include "access/htup.h" + +typedef struct TimeQualSpace { + char data[12]; +} TimeQualSpace; + +typedef Pointer TimeQual; + +/* Tuples valid as of StartTransactionCommand */ +#define NowTimeQual ((TimeQual) NULL) + +/* As above, plus updates in this command */ +extern TimeQual SelfTimeQual; + +extern void setheapoverride(bool on); +extern bool heapisoverride(void); + +extern bool TimeQualIsValid(TimeQual qual); +extern bool TimeQualIsLegal(TimeQual qual); +extern bool TimeQualIncludesNow(TimeQual qual); +extern bool TimeQualIncludesPast(TimeQual qual); +extern bool TimeQualIsSnapshot(TimeQual qual); +extern bool TimeQualIsRanged(TimeQual qual); +extern bool TimeQualIndicatesDisableValidityChecking(TimeQual qual); +extern AbsoluteTime TimeQualGetSnapshotTime(TimeQual qual); +extern AbsoluteTime TimeQualGetStartTime(TimeQual qual); +extern AbsoluteTime TimeQualGetEndTime(TimeQual qual); +extern TimeQual TimeFormSnapshotTimeQual(AbsoluteTime time); +extern TimeQual TimeFormRangedTimeQual(AbsoluteTime startTime, + AbsoluteTime endTime); +extern bool HeapTupleSatisfiesTimeQual(HeapTuple tuple, TimeQual qual); + + +#endif /* TQUAL_H */