30#include "utils/fmgroids.h"
149 nslots =
Min(num_elems,
152 for (
int i = 0;
i < nslots;
i++)
170 errmsg(
"invalid enum label \"%s\"",
lab),
171 errdetail(
"Labels must be %d bytes or less.",
187 errmsg(
"enum label \"%s\" used more than once",
195 slot[
slotCount]->tts_tupleDescriptor->natts *
sizeof(
bool));
225 for (
int i = 0;
i < nslots;
i++)
327 errmsg(
"invalid enum label \"%s\"", newVal),
328 errdetail(
"Labels must be %d bytes or less.",
356 errmsg(
"enum label \"%s\" already exists, skipping",
363 errmsg(
"enum label \"%s\" already exists",
375 nelems = list->n_members;
379 for (
i = 0;
i < nelems;
i++)
418 errmsg(
"\"%s\" is not an existing enum label",
476 errmsg(
"pg_enum OID value not set when in binary upgrade mode")));
486 errmsg(
"ALTER TYPE ADD BEFORE/AFTER is incompatible with binary upgrade")));
515 for (
i = 0;
i < nelems;
i++)
579 memset(nulls,
false,
sizeof(nulls));
637 errmsg(
"invalid enum label \"%s\"", newVal),
638 errdetail(
"Labels must be %d bytes or less.",
655 nelems = list->n_members;
664 for (
i = 0;
i < nelems;
i++)
676 errmsg(
"\"%s\" is not an existing enum label",
681 errmsg(
"enum label \"%s\" already exists",
783 for (
i = nelems - 1;
i >= 0;
i--)
817 if (
en1->enumsortorder <
en2->enumsortorder)
819 else if (
en1->enumsortorder >
en2->enumsortorder)
836 return sizeof(
Oid) * (entries + 2);
static Datum values[MAXATTR]
#define Assert(condition)
#define OidIsValid(objectId)
Oid GetNewOidWithIndex(Relation relation, Oid indexId, AttrNumber oidcolumn)
void ReleaseCatCacheList(CatCList *list)
void * hash_search(HTAB *hashp, const void *keyPtr, HASHACTION action, bool *foundPtr)
HTAB * hash_create(const char *tabname, int64 nelem, const HASHCTL *info, int flags)
void * hash_seq_search(HASH_SEQ_STATUS *status)
int64 hash_get_num_entries(HTAB *hashp)
void hash_seq_init(HASH_SEQ_STATUS *status, HTAB *hashp)
int errdetail(const char *fmt,...)
int errcode(int sqlerrcode)
int errmsg(const char *fmt,...)
#define ereport(elevel,...)
TupleTableSlot * MakeSingleTupleTableSlot(TupleDesc tupdesc, const TupleTableSlotOps *tts_ops)
void ExecDropSingleTupleTableSlot(TupleTableSlot *slot)
TupleTableSlot * ExecStoreVirtualTuple(TupleTableSlot *slot)
const TupleTableSlotOps TTSOpsHeapTuple
#define palloc_array(type, count)
void systable_endscan(SysScanDesc sysscan)
HeapTuple systable_getnext(SysScanDesc sysscan)
SysScanDesc systable_beginscan(Relation heapRelation, Oid indexId, bool indexOK, Snapshot snapshot, int nkeys, ScanKey key)
HeapTuple heap_copytuple(HeapTuple tuple)
HeapTuple heap_form_tuple(TupleDesc tupleDescriptor, const Datum *values, const bool *isnull)
void heap_freetuple(HeapTuple htup)
#define HeapTupleIsValid(tuple)
static void * GETSTRUCT(const HeapTupleData *tuple)
void CatalogTuplesMultiInsertWithInfo(Relation heapRel, TupleTableSlot **slot, int ntuples, CatalogIndexState indstate)
void CatalogTupleUpdate(Relation heapRel, const ItemPointerData *otid, HeapTuple tup)
void CatalogCloseIndexes(CatalogIndexState indstate)
void CatalogTupleInsert(Relation heapRel, HeapTuple tup)
CatalogIndexState CatalogOpenIndexes(Relation heapRel)
void CatalogTupleDelete(Relation heapRel, const ItemPointerData *tid)
#define MAX_CATALOG_MULTI_INSERT_BYTES
void LockDatabaseObject(Oid classid, Oid objid, uint16 objsubid, LOCKMODE lockmode)
MemoryContext TopTransactionContext
void pfree(void *pointer)
void * palloc0(Size size)
void namestrcpy(Name name, const char *str)
int oid_cmp(const void *p1, const void *p2)
void RestoreUncommittedEnums(void *space)
static HTAB * uncommitted_enum_values
void RenameEnumLabel(Oid enumTypeOid, const char *oldVal, const char *newVal)
Size EstimateUncommittedEnumsSpace(void)
static void init_uncommitted_enum_types(void)
bool EnumUncommitted(Oid enum_id)
static void init_uncommitted_enum_values(void)
void EnumValuesDelete(Oid enumTypeOid)
void AddEnumLabel(Oid enumTypeOid, const char *newVal, const char *neighbor, bool newValIsAfter, bool skipIfExists)
void SerializeUncommittedEnums(void *space, Size size)
Oid binary_upgrade_next_pg_enum_oid
static HTAB * uncommitted_enum_types
static int sort_order_cmp(const void *p1, const void *p2)
static bool EnumTypeUncommitted(Oid typ_id)
static void RenumberEnumType(Relation pg_enum, HeapTuple *existing, int nelems)
void EnumValuesCreate(Oid enumTypeOid, List *vals)
FormData_pg_enum * Form_pg_enum
static int list_length(const List *l)
#define qsort(a, b, c, d)
static Datum Float4GetDatum(float4 X)
static Datum ObjectIdGetDatum(Oid X)
static Datum NameGetDatum(const NameData *X)
static Datum CStringGetDatum(const char *X)
#define RelationGetDescr(relation)
void ScanKeyInit(ScanKey entry, AttrNumber attributeNumber, StrategyNumber strategy, RegProcedure procedure, Datum argument)
#define BTEqualStrategyNumber
#define ERRCODE_DUPLICATE_OBJECT
void ReleaseSysCache(HeapTuple tuple)
HeapTuple SearchSysCache2(int cacheId, Datum key1, Datum key2)
#define SearchSysCacheList1(cacheId, key1)
void table_close(Relation relation, LOCKMODE lockmode)
Relation table_open(Oid relationId, LOCKMODE lockmode)
static TupleTableSlot * ExecClearTuple(TupleTableSlot *slot)
int GetCurrentTransactionNestLevel(void)
void CommandCounterIncrement(void)