PostgreSQL Source Code git master
pg_enum.h
Go to the documentation of this file.
1/*-------------------------------------------------------------------------
2 *
3 * pg_enum.h
4 * definition of the "enum" system catalog (pg_enum)
5 *
6 *
7 * Portions Copyright (c) 1996-2025, 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
21#include "catalog/genbki.h"
22#include "catalog/pg_enum_d.h" /* IWYU pragma: export */
23
24#include "nodes/pg_list.h"
25
26/* ----------------
27 * pg_enum definition. cpp turns this into
28 * typedef struct FormData_pg_enum
29 * ----------------
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 */
38
39/* ----------------
40 * Form_pg_enum corresponds to a pointer to a tuple with
41 * the format of pg_enum relation.
42 * ----------------
43 */
45
46DECLARE_UNIQUE_INDEX_PKEY(pg_enum_oid_index, 3502, EnumOidIndexId, pg_enum, btree(oid oid_ops));
47DECLARE_UNIQUE_INDEX(pg_enum_typid_label_index, 3503, EnumTypIdLabelIndexId, pg_enum, btree(enumtypid oid_ops, enumlabel name_ops));
48DECLARE_UNIQUE_INDEX(pg_enum_typid_sortorder_index, 3534, EnumTypIdSortOrderIndexId, pg_enum, btree(enumtypid oid_ops, enumsortorder float4_ops));
49
50MAKE_SYSCACHE(ENUMOID, pg_enum_oid_index, 8);
51MAKE_SYSCACHE(ENUMTYPOIDNAME, pg_enum_typid_label_index, 8);
52
53/*
54 * prototypes for functions in pg_enum.c
55 */
56extern void EnumValuesCreate(Oid enumTypeOid, List *vals);
57extern void EnumValuesDelete(Oid enumTypeOid);
58extern void AddEnumLabel(Oid enumTypeOid, const char *newVal,
59 const char *neighbor, bool newValIsAfter,
60 bool skipIfExists);
61extern void RenameEnumLabel(Oid enumTypeOid,
62 const char *oldVal, const char *newVal);
63extern bool EnumUncommitted(Oid enum_id);
65extern void SerializeUncommittedEnums(void *space, Size size);
66extern void RestoreUncommittedEnums(void *space);
67extern void AtEOXact_Enum(void);
68
69#endif /* PG_ENUM_H */
float float4
Definition: c.h:586
size_t Size
Definition: c.h:562
#define BKI_LOOKUP(catalog)
Definition: genbki.h:46
DECLARE_UNIQUE_INDEX(pg_enum_typid_label_index, 3503, EnumTypIdLabelIndexId, pg_enum, btree(enumtypid oid_ops, enumlabel name_ops))
void RestoreUncommittedEnums(void *space)
Definition: pg_enum.c:873
void RenameEnumLabel(Oid enumTypeOid, const char *oldVal, const char *newVal)
Definition: pg_enum.c:607
Size EstimateUncommittedEnumsSpace(void)
Definition: pg_enum.c:813
FormData_pg_enum * Form_pg_enum
Definition: pg_enum.h:44
bool EnumUncommitted(Oid enum_id)
Definition: pg_enum.c:708
MAKE_SYSCACHE(ENUMOID, pg_enum_oid_index, 8)
void EnumValuesDelete(Oid enumTypeOid)
Definition: pg_enum.c:224
void AddEnumLabel(Oid enumTypeOid, const char *newVal, const char *neighbor, bool newValIsAfter, bool skipIfExists)
Definition: pg_enum.c:292
void SerializeUncommittedEnums(void *space, Size size)
Definition: pg_enum.c:827
CATALOG(pg_enum, 3501, EnumRelationId)
Definition: pg_enum.h:31
void AtEOXact_Enum(void)
Definition: pg_enum.c:726
FormData_pg_enum
Definition: pg_enum.h:37
DECLARE_UNIQUE_INDEX_PKEY(pg_enum_oid_index, 3502, EnumOidIndexId, pg_enum, btree(oid oid_ops))
void EnumValuesCreate(Oid enumTypeOid, List *vals)
Definition: pg_enum.c:84
unsigned int Oid
Definition: postgres_ext.h:32
static pg_noinline void Size size
Definition: slab.c:607
Definition: pg_list.h:54
Definition: c.h:698