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 | init_uncommitted_enum_types (void) |
static void | init_uncommitted_enum_values (void) |
static bool | EnumTypeUncommitted (Oid typ_id) |
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) |
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_enum_types = NULL |
static HTAB * | uncommitted_enum_values = NULL |
void AddEnumLabel | ( | Oid | enumTypeOid, |
const char * | newVal, | ||
const char * | neighbor, | ||
bool | newValIsAfter, | ||
bool | skipIfExists | ||
) |
Definition at line 292 of file pg_enum.c.
References binary_upgrade_next_pg_enum_oid, CatalogTupleInsert(), CStringGetDatum(), EnumTypeUncommitted(), ereport, errcode(), ERRCODE_DUPLICATE_OBJECT, errdetail(), errmsg(), ERROR, ExclusiveLock, Float4GetDatum(), GetCurrentTransactionNestLevel(), GetNewOidWithIndex(), GETSTRUCT, HASH_ENTER, hash_search(), heap_form_tuple(), heap_freetuple(), HeapTupleIsValid, i, init_uncommitted_enum_values(), 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_enum_values, and values.
Referenced by AlterEnum().
void AtEOXact_Enum | ( | void | ) |
Definition at line 726 of file pg_enum.c.
References uncommitted_enum_types, and uncommitted_enum_values.
Referenced by AbortTransaction(), CommitTransaction(), and PrepareTransaction().
|
static |
Definition at line 690 of file pg_enum.c.
References HASH_FIND, hash_search(), and uncommitted_enum_types.
Referenced by AddEnumLabel().
bool EnumUncommitted | ( | Oid | enum_id | ) |
Definition at line 708 of file pg_enum.c.
References HASH_FIND, hash_search(), and uncommitted_enum_values.
Referenced by check_safe_enum_use().
Definition at line 84 of file pg_enum.c.
References CatalogCloseIndexes(), CatalogOpenIndexes(), CatalogTuplesMultiInsertWithInfo(), ereport, errcode(), errdetail(), errmsg(), ERROR, ExecClearTuple(), ExecDropSingleTupleTableSlot(), ExecStoreVirtualTuple(), Float4GetDatum(), FormData_pg_enum, GetCurrentTransactionNestLevel(), GetNewOidWithIndex(), HASH_ENTER, hash_search(), i, init_uncommitted_enum_types(), 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, TTSOpsHeapTuple, and uncommitted_enum_types.
Referenced by DefineEnum().
void EnumValuesDelete | ( | Oid | enumTypeOid | ) |
Definition at line 224 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 813 of file pg_enum.c.
References hash_get_num_entries(), uncommitted_enum_types, and uncommitted_enum_values.
Referenced by InitializeParallelDSM(), and SerializeUncommittedEnums().
|
static |
Definition at line 255 of file pg_enum.c.
References HASHCTL::entrysize, HASH_BLOBS, HASH_CONTEXT, hash_create(), HASH_ELEM, HASHCTL::hcxt, HASHCTL::keysize, TopTransactionContext, and uncommitted_enum_types.
Referenced by EnumValuesCreate(), and RestoreUncommittedEnums().
|
static |
Definition at line 272 of file pg_enum.c.
References HASHCTL::entrysize, HASH_BLOBS, HASH_CONTEXT, hash_create(), HASH_ELEM, HASHCTL::hcxt, HASHCTL::keysize, TopTransactionContext, and uncommitted_enum_values.
Referenced by AddEnumLabel(), and RestoreUncommittedEnums().
void RenameEnumLabel | ( | Oid | enumTypeOid, |
const char * | oldVal, | ||
const char * | newVal | ||
) |
Definition at line 607 of file pg_enum.c.
References CatalogTupleUpdate(), 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 761 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 873 of file pg_enum.c.
References Assert, HASH_ENTER, hash_search(), init_uncommitted_enum_types(), init_uncommitted_enum_values(), OidIsValid, uncommitted_enum_types, and uncommitted_enum_values.
Referenced by ParallelWorkerMain().
void SerializeUncommittedEnums | ( | void * | space, |
Size | size | ||
) |
Definition at line 827 of file pg_enum.c.
References Assert, EstimateUncommittedEnumsSpace(), hash_seq_init(), hash_seq_search(), InvalidOid, size, uncommitted_enum_types, uncommitted_enum_values, 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 62 of file pg_enum.c.
Referenced by AtEOXact_Enum(), EnumTypeUncommitted(), EnumValuesCreate(), EstimateUncommittedEnumsSpace(), init_uncommitted_enum_types(), RestoreUncommittedEnums(), and SerializeUncommittedEnums().
|
static |
Definition at line 63 of file pg_enum.c.
Referenced by AddEnumLabel(), AtEOXact_Enum(), EnumUncommitted(), EstimateUncommittedEnumsSpace(), init_uncommitted_enum_values(), RestoreUncommittedEnums(), and SerializeUncommittedEnums().