/*------------------------------------------------------------------------- * * pg_depend.h * definition of the system "depend" relation (pg_depend) * along with the relation's initial contents. * * * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * $Header$ * * NOTES * the genbki.sh script reads this file and generates .bki * information from theDATA() statements. * *------------------------------------------------------------------------- */ #ifndef PG_DEPEND_H #define PG_DEPEND_H /* ---------------- * postgres.h contains the system type definitions and the * CATALOG(), BOOTSTRAP andDATA() sugar words so this file * can be read by both genbki.sh and the C compiler. * ---------------- */ /* ---------------- * pg_depend definition. cpp turns this into * typedef struct FormData_pg_depend * ---------------- */ CATALOG(pg_depend) BKI_PINWRITE BKI_WITHOUT_OIDS { Oid classid; /* OID of table containing object */ Oid objid; /* OID of object itself */ int4 objsubid; /* column number, or 0 if not used */ Oid depclassid; /* OID of table containing dependee object */ Oid depobjid; /* OID of dependee object itself */ int4 depobjsubid; /* dependee column number, or 0 if not used */ /* * Always cascade to the item, even when the RESTRICT behavior has been * specified. Used primarily for SERIAL, and ARRAY types. */ bool alwayscascade; } FormData_pg_depend; /* ---------------- * Form_pg_depend corresponds to a pointer to a row with * the format of pg_depend relation. * ---------------- */ typedef FormData_pg_depend *Form_pg_depend; /* ---------------- * compiler constants for pg_depend * ---------------- */ #define Natts_pg_depend 7 #define Anum_pg_depend_classid 1 #define Anum_pg_depend_objid 2 #define Anum_pg_depend_objsubid 3 #define Anum_pg_depend_depclassid 4 #define Anum_pg_depend_depobjid 5 #define Anum_pg_depend_depobjsubid 6 #define Anum_pg_depend_alwayscascade 7 #define DEPEND_RESTRICT 1 #define DEPEND_CASCADE 2 #define DEPEND_IMPLICITONLY 3 /* * Dependencies are automatically discovered in the genbki.sh * script by using tha TABLEOID variable located at the top of * the table description files. */ typedef struct ObjectAddress { Oid classId; /* Class Id from pg_class */ Oid objectId; /* OID of the object */ int32 objectSubId; /* Subitem within the object (column of table) */ } ObjectAddress; extern void dependCreate(const ObjectAddress *depender, const ObjectAddress *dependee, bool behavior); extern void dependDelete(ObjectAddress *object, int behavior); extern void dependDeleteTuple(const HeapTuple tup, const Relation relation, int behavior); #endif /* PG_DEPEND_H */