PostgreSQL Source Code
git master
|
#include "postgres.h"
#include "access/genam.h"
#include "access/htup_details.h"
#include "access/table.h"
#include "access/xact.h"
#include "catalog/binary_upgrade.h"
#include "catalog/catalog.h"
#include "catalog/indexing.h"
#include "catalog/pg_enum.h"
#include "catalog/pg_type.h"
#include "miscadmin.h"
#include "nodes/value.h"
#include "storage/lmgr.h"
#include "utils/builtins.h"
#include "utils/catcache.h"
#include "utils/fmgroids.h"
#include "utils/hsearch.h"
#include "utils/memutils.h"
#include "utils/syscache.h"
Go to the source code of this file.
Functions | |
static void | RenumberEnumType (Relation pg_enum, HeapTuple *existing, int nelems) |
static int | sort_order_cmp (const void *p1, const void *p2) |
void | EnumValuesCreate (Oid enumTypeOid, List *vals) |
void | EnumValuesDelete (Oid enumTypeOid) |
static void | init_uncommitted_enums (void) |
void | AddEnumLabel (Oid enumTypeOid, const char *newVal, const char *neighbor, bool newValIsAfter, bool skipIfExists) |
void | RenameEnumLabel (Oid enumTypeOid, const char *oldVal, const char *newVal) |
bool | EnumUncommitted (Oid enum_id) |
void | AtEOXact_Enum (void) |
Size | EstimateUncommittedEnumsSpace (void) |
void | SerializeUncommittedEnums (void *space, Size size) |
void | RestoreUncommittedEnums (void *space) |
Variables | |
Oid | binary_upgrade_next_pg_enum_oid = InvalidOid |
static HTAB * | uncommitted_enums = NULL |
void AddEnumLabel | ( | Oid | enumTypeOid, |
const char * | newVal, | ||
const char * | neighbor, | ||
bool | newValIsAfter, | ||
bool | skipIfExists | ||
) |
Definition at line 237 of file pg_enum.c.
References binary_upgrade_next_pg_enum_oid, CatalogTupleInsert(), CStringGetDatum(), ENUMTYPOIDNAME, ereport, errcode(), ERRCODE_DUPLICATE_OBJECT, errdetail(), errmsg(), ERROR, ExclusiveLock, Float4GetDatum(), GetNewOidWithIndex(), GETSTRUCT, HASH_ENTER, hash_search(), heap_form_tuple(), heap_freetuple(), HeapTupleIsValid, i, init_uncommitted_enums(), InvalidOid, IsBinaryUpgrade, sort-test::list, LockDatabaseObject(), NAMEDATALEN, NameGetDatum(), NameStr, namestrcpy(), NOTICE, ObjectIdGetDatum(), OidIsValid, palloc(), pfree(), qsort, RelationGetDescr, ReleaseCatCacheList(), ReleaseSysCache(), RenumberEnumType(), RowExclusiveLock, SearchSysCache2(), SearchSysCacheList1, sort_order_cmp(), table_close(), table_open(), uncommitted_enums, and values.
Referenced by AlterEnum().
void AtEOXact_Enum | ( | void | ) |
Definition at line 638 of file pg_enum.c.
References uncommitted_enums.
Referenced by AbortTransaction(), CommitTransaction(), and PrepareTransaction().
Definition at line 620 of file pg_enum.c.
References HASH_FIND, hash_search(), and uncommitted_enums.
Referenced by check_safe_enum_use().
Definition at line 61 of file pg_enum.c.
References CatalogCloseIndexes(), CatalogOpenIndexes(), CatalogTuplesMultiInsertWithInfo(), ereport, errcode(), errdetail(), errmsg(), ERROR, ExecClearTuple(), ExecDropSingleTupleTableSlot(), ExecStoreVirtualTuple(), Float4GetDatum(), FormData_pg_enum, GetNewOidWithIndex(), i, lfirst, list_length(), MakeSingleTupleTableSlot(), MAX_CATALOG_MULTI_INSERT_BYTES, Min, NAMEDATALEN, NameGetDatum(), namestrcpy(), ObjectIdGetDatum(), oid_cmp(), palloc(), palloc0(), pfree(), qsort, RelationGetDescr, RowExclusiveLock, strVal, table_close(), table_open(), TupleTableSlot::tts_values, and TTSOpsHeapTuple.
Referenced by DefineEnum().
void EnumValuesDelete | ( | Oid | enumTypeOid | ) |
Definition at line 186 of file pg_enum.c.
References BTEqualStrategyNumber, CatalogTupleDelete(), HeapTupleIsValid, sort-test::key, ObjectIdGetDatum(), RowExclusiveLock, ScanKeyInit(), systable_beginscan(), systable_endscan(), systable_getnext(), HeapTupleData::t_self, table_close(), and table_open().
Referenced by RemoveTypeById().
Size EstimateUncommittedEnumsSpace | ( | void | ) |
Definition at line 724 of file pg_enum.c.
References hash_get_num_entries(), and uncommitted_enums.
Referenced by InitializeParallelDSM(), and SerializeUncommittedEnums().
|
static |
Definition at line 217 of file pg_enum.c.
References HASHCTL::entrysize, HASH_BLOBS, HASH_CONTEXT, hash_create(), HASH_ELEM, HASHCTL::hcxt, HASHCTL::keysize, TopTransactionContext, and uncommitted_enums.
Referenced by AddEnumLabel(), and RestoreUncommittedEnums().
void RenameEnumLabel | ( | Oid | enumTypeOid, |
const char * | oldVal, | ||
const char * | newVal | ||
) |
Definition at line 537 of file pg_enum.c.
References CatalogTupleUpdate(), ENUMTYPOIDNAME, ereport, errcode(), ERRCODE_DUPLICATE_OBJECT, errdetail(), errmsg(), ERROR, ExclusiveLock, GETSTRUCT, heap_copytuple(), heap_freetuple(), i, sort-test::list, LockDatabaseObject(), NAMEDATALEN, NameStr, namestrcpy(), ObjectIdGetDatum(), ReleaseCatCacheList(), RowExclusiveLock, SearchSysCacheList1, HeapTupleData::t_self, table_close(), and table_open().
Referenced by AlterEnum().
Definition at line 672 of file pg_enum.c.
References CatalogTupleUpdate(), CommandCounterIncrement(), GETSTRUCT, heap_copytuple(), heap_freetuple(), i, and HeapTupleData::t_self.
Referenced by AddEnumLabel().
void RestoreUncommittedEnums | ( | void * | space | ) |
Definition at line 770 of file pg_enum.c.
References Assert(), HASH_ENTER, hash_search(), init_uncommitted_enums(), OidIsValid, and uncommitted_enums.
Referenced by ParallelWorkerMain().
void SerializeUncommittedEnums | ( | void * | space, |
Size | size | ||
) |
Definition at line 738 of file pg_enum.c.
References Assert(), EstimateUncommittedEnumsSpace(), hash_seq_init(), hash_seq_search(), InvalidOid, uncommitted_enums, and value.
Referenced by InitializeParallelDSM().
|
static |
Oid binary_upgrade_next_pg_enum_oid = InvalidOid |
Definition at line 36 of file pg_enum.c.
Referenced by AddEnumLabel(), and binary_upgrade_set_next_pg_enum_oid().
|
static |
Definition at line 48 of file pg_enum.c.
Referenced by AddEnumLabel(), AtEOXact_Enum(), EnumUncommitted(), EstimateUncommittedEnumsSpace(), init_uncommitted_enums(), RestoreUncommittedEnums(), and SerializeUncommittedEnums().