pg_attrdef.h 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. /*-------------------------------------------------------------------------
  2. *
  3. * pg_attrdef.h
  4. * definition of the "attribute defaults" system catalog (pg_attrdef)
  5. *
  6. *
  7. * Portions Copyright (c) 1996-2022, PostgreSQL Global Development Group
  8. * Portions Copyright (c) 1994, Regents of the University of California
  9. *
  10. * src/include/catalog/pg_attrdef.h
  11. *
  12. * NOTES
  13. * The Catalog.pm module reads this file and derives schema
  14. * information.
  15. *
  16. *-------------------------------------------------------------------------
  17. */
  18. #ifndef PG_ATTRDEF_H
  19. #define PG_ATTRDEF_H
  20. #include "catalog/genbki.h"
  21. #include "catalog/objectaddress.h"
  22. #include "catalog/pg_attrdef_d.h"
  23. /* ----------------
  24. * pg_attrdef definition. cpp turns this into
  25. * typedef struct FormData_pg_attrdef
  26. * ----------------
  27. */
  28. CATALOG(pg_attrdef,2604,AttrDefaultRelationId)
  29. {
  30. Oid oid; /* oid */
  31. Oid adrelid BKI_LOOKUP(pg_class); /* OID of table containing
  32. * attribute */
  33. int16 adnum; /* attnum of attribute */
  34. #ifdef CATALOG_VARLEN /* variable-length fields start here */
  35. pg_node_tree adbin BKI_FORCE_NOT_NULL; /* nodeToString representation of
  36. * default */
  37. #endif
  38. } FormData_pg_attrdef;
  39. /* ----------------
  40. * Form_pg_attrdef corresponds to a pointer to a tuple with
  41. * the format of pg_attrdef relation.
  42. * ----------------
  43. */
  44. typedef FormData_pg_attrdef *Form_pg_attrdef;
  45. DECLARE_TOAST(pg_attrdef, 2830, 2831);
  46. DECLARE_UNIQUE_INDEX(pg_attrdef_adrelid_adnum_index, 2656, AttrDefaultIndexId, on pg_attrdef using btree(adrelid oid_ops, adnum int2_ops));
  47. DECLARE_UNIQUE_INDEX_PKEY(pg_attrdef_oid_index, 2657, AttrDefaultOidIndexId, on pg_attrdef using btree(oid oid_ops));
  48. DECLARE_FOREIGN_KEY((adrelid, adnum), pg_attribute, (attrelid, attnum));
  49. extern Oid StoreAttrDefault(Relation rel, AttrNumber attnum,
  50. Node *expr, bool is_internal,
  51. bool add_column_mode);
  52. extern void RemoveAttrDefault(Oid relid, AttrNumber attnum,
  53. DropBehavior behavior,
  54. bool complain, bool internal);
  55. extern void RemoveAttrDefaultById(Oid attrdefId);
  56. extern Oid GetAttrDefaultOid(Oid relid, AttrNumber attnum);
  57. extern ObjectAddress GetAttrDefaultColumnAddress(Oid attrdefoid);
  58. #endif /* PG_ATTRDEF_H */