pg_enum.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. /*-------------------------------------------------------------------------
  2. *
  3. * pg_enum.h
  4. * definition of the "enum" system catalog (pg_enum)
  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_enum.h
  11. *
  12. * NOTES
  13. * The Catalog.pm module reads this file and derives schema
  14. * information.
  15. *
  16. *-------------------------------------------------------------------------
  17. */
  18. #ifndef PG_ENUM_H
  19. #define PG_ENUM_H
  20. #include "catalog/genbki.h"
  21. #include "catalog/pg_enum_d.h"
  22. #include "nodes/pg_list.h"
  23. /* ----------------
  24. * pg_enum definition. cpp turns this into
  25. * typedef struct FormData_pg_enum
  26. * ----------------
  27. */
  28. CATALOG(pg_enum,3501,EnumRelationId)
  29. {
  30. Oid oid; /* oid */
  31. Oid enumtypid BKI_LOOKUP(pg_type); /* OID of owning enum type */
  32. float4 enumsortorder; /* sort position of this enum value */
  33. NameData enumlabel; /* text representation of enum value */
  34. } FormData_pg_enum;
  35. /* ----------------
  36. * Form_pg_enum corresponds to a pointer to a tuple with
  37. * the format of pg_enum relation.
  38. * ----------------
  39. */
  40. typedef FormData_pg_enum *Form_pg_enum;
  41. DECLARE_UNIQUE_INDEX_PKEY(pg_enum_oid_index, 3502, EnumOidIndexId, on pg_enum using btree(oid oid_ops));
  42. DECLARE_UNIQUE_INDEX(pg_enum_typid_label_index, 3503, EnumTypIdLabelIndexId, on pg_enum using btree(enumtypid oid_ops, enumlabel name_ops));
  43. DECLARE_UNIQUE_INDEX(pg_enum_typid_sortorder_index, 3534, EnumTypIdSortOrderIndexId, on pg_enum using btree(enumtypid oid_ops, enumsortorder float4_ops));
  44. /*
  45. * prototypes for functions in pg_enum.c
  46. */
  47. extern void EnumValuesCreate(Oid enumTypeOid, List *vals);
  48. extern void EnumValuesDelete(Oid enumTypeOid);
  49. extern void AddEnumLabel(Oid enumTypeOid, const char *newVal,
  50. const char *neighbor, bool newValIsAfter,
  51. bool skipIfExists);
  52. extern void RenameEnumLabel(Oid enumTypeOid,
  53. const char *oldVal, const char *newVal);
  54. extern bool EnumUncommitted(Oid enum_id);
  55. extern Size EstimateUncommittedEnumsSpace(void);
  56. extern void SerializeUncommittedEnums(void *space, Size size);
  57. extern void RestoreUncommittedEnums(void *space);
  58. extern void AtEOXact_Enum(void);
  59. #endif /* PG_ENUM_H */