codekingpro/portable-devtools
115k
1/*-------------------------------------------------------------------------2 *3 * pg_enum.h4 * definition of the "enum" system catalog (pg_enum)5 *6 *7 * Portions Copyright (c) 1996-2023, PostgreSQL Global Development Group8 * Portions Copyright (c) 1994, Regents of the University of California9 *10 * src/include/catalog/pg_enum.h11 *12 * NOTES13 * The Catalog.pm module reads this file and derives schema14 * information.15 *16 *-------------------------------------------------------------------------17 */18#ifndef PG_ENUM_H19#define PG_ENUM_H20 21#include "catalog/genbki.h"22#include "catalog/pg_enum_d.h"23 24#include "nodes/pg_list.h"25 26/* ----------------27 * pg_enum definition. cpp turns this into28 * typedef struct FormData_pg_enum29 * ----------------30 */31CATALOG(pg_enum,3501,EnumRelationId)32{33 Oid oid; /* oid */34 Oid enumtypid BKI_LOOKUP(pg_type); /* OID of owning enum type */35 float4 enumsortorder; /* sort position of this enum value */36 NameData enumlabel; /* text representation of enum value */37} FormData_pg_enum;38 39/* ----------------40 * Form_pg_enum corresponds to a pointer to a tuple with41 * the format of pg_enum relation.42 * ----------------43 */44typedef FormData_pg_enum *Form_pg_enum;45 46DECLARE_UNIQUE_INDEX_PKEY(pg_enum_oid_index, 3502, EnumOidIndexId, on pg_enum using btree(oid oid_ops));47DECLARE_UNIQUE_INDEX(pg_enum_typid_label_index, 3503, EnumTypIdLabelIndexId, on pg_enum using btree(enumtypid oid_ops, enumlabel name_ops));48DECLARE_UNIQUE_INDEX(pg_enum_typid_sortorder_index, 3534, EnumTypIdSortOrderIndexId, on pg_enum using btree(enumtypid oid_ops, enumsortorder float4_ops));49 50/*51 * prototypes for functions in pg_enum.c52 */53extern void EnumValuesCreate(Oid enumTypeOid, List *vals);54extern void EnumValuesDelete(Oid enumTypeOid);55extern void AddEnumLabel(Oid enumTypeOid, const char *newVal,56 const char *neighbor, bool newValIsAfter,57 bool skipIfExists);58extern void RenameEnumLabel(Oid enumTypeOid,59 const char *oldVal, const char *newVal);60extern bool EnumUncommitted(Oid enum_id);61extern Size EstimateUncommittedEnumsSpace(void);62extern void SerializeUncommittedEnums(void *space, Size size);63extern void RestoreUncommittedEnums(void *space);64extern void AtEOXact_Enum(void);65 66#endif /* PG_ENUM_H */67 