PostgreSQL Source Code
git master
|
#include "postgres.h"
#include "access/htup_details.h"
#include "access/relation.h"
#include "access/table.h"
#include "access/xact.h"
#include "catalog/binary_upgrade.h"
#include "catalog/catalog.h"
#include "catalog/dependency.h"
#include "catalog/indexing.h"
#include "catalog/objectaccess.h"
#include "catalog/pg_collation.h"
#include "catalog/pg_namespace.h"
#include "catalog/pg_proc.h"
#include "catalog/pg_type.h"
#include "commands/typecmds.h"
#include "mb/pg_wchar.h"
#include "miscadmin.h"
#include "parser/scansup.h"
#include "utils/acl.h"
#include "utils/builtins.h"
#include "utils/fmgroids.h"
#include "utils/lsyscache.h"
#include "utils/rel.h"
#include "utils/syscache.h"
Go to the source code of this file.
Functions | |
static char * | makeUniqueTypeName (const char *typeName, Oid typeNamespace, bool tryOriginal) |
ObjectAddress | TypeShellMake (const char *typeName, Oid typeNamespace, Oid ownerId) |
ObjectAddress | TypeCreate (Oid newTypeOid, const char *typeName, Oid typeNamespace, Oid relationOid, char relationKind, Oid ownerId, int16 internalSize, char typeType, char typeCategory, bool typePreferred, char typDelim, Oid inputProcedure, Oid outputProcedure, Oid receiveProcedure, Oid sendProcedure, Oid typmodinProcedure, Oid typmodoutProcedure, Oid analyzeProcedure, Oid subscriptProcedure, Oid elementType, bool isImplicitArray, Oid arrayType, Oid baseType, const char *defaultTypeValue, char *defaultTypeBin, bool passedByValue, char alignment, char storage, int32 typeMod, int32 typNDims, bool typeNotNull, Oid typeCollation) |
List * | GetTypeCollations (Oid typeoid) |
void | GenerateTypeDependencies (HeapTuple typeTuple, Relation typeCatalog, Node *defaultExpr, void *typacl, char relationKind, bool isImplicitArray, bool isDependentType, bool rebuild) |
void | RenameTypeInternal (Oid typeOid, const char *newTypeName, Oid typeNamespace) |
char * | makeArrayTypeName (const char *typeName, Oid typeNamespace) |
bool | moveArrayTypeName (Oid typeOid, const char *typeName, Oid typeNamespace) |
char * | makeMultirangeTypeName (const char *rangeTypeName, Oid typeNamespace) |
Variables | |
Oid | binary_upgrade_next_pg_type_oid = InvalidOid |
void GenerateTypeDependencies | ( | HeapTuple | typeTuple, |
Relation | typeCatalog, | ||
Node * | defaultExpr, | ||
void * | typacl, | ||
char | relationKind, | ||
bool | isImplicitArray, | ||
bool | isDependentType, | ||
bool | rebuild | ||
) |
Definition at line 618 of file pg_type.c.
References add_exact_object_address(), DatumGetAclPCopy, deleteDependencyRecordsFor(), deleteSharedDependencyRecordsFor(), DEPENDENCY_INTERNAL, DEPENDENCY_NORMAL, free_object_addresses(), GETSTRUCT, heap_getattr, new_object_addresses(), NIL, ObjectAddressSet, OidIsValid, record_object_address_dependencies(), recordDependencyOn(), recordDependencyOnCurrentExtension(), recordDependencyOnExpr(), recordDependencyOnNewAcl(), recordDependencyOnOwner(), RelationGetDescr, stringToNode(), and TextDatumGetCString.
Referenced by AlterDomainDefault(), AlterTypeRecurse(), TypeCreate(), and TypeShellMake().
Definition at line 527 of file pg_type.c.
References AccessShareLock, Assert, elog, ERROR, get_range_collation(), get_range_subtype(), GETSTRUCT, GetTypeCollations(), HeapTupleIsValid, i, list_append_unique_oid(), list_concat_unique_oid(), list_make1_oid, NIL, NoLock, ObjectIdGetDatum, OidIsValid, relation_close(), relation_open(), RelationGetDescr, RelationGetNumberOfAttributes, ReleaseSysCache(), SearchSysCache1(), TupleDescAttr, and TYPEOID.
Referenced by GetTypeCollations(), and index_create().
char* makeArrayTypeName | ( | const char * | typeName, |
Oid | typeNamespace | ||
) |
Definition at line 877 of file pg_type.c.
References ereport, errcode(), ERRCODE_DUPLICATE_OBJECT, errmsg(), ERROR, and makeUniqueTypeName().
Referenced by DefineDomain(), DefineEnum(), DefineRange(), DefineType(), heap_create_with_catalog(), moveArrayTypeName(), and RenameTypeInternal().
char* makeMultirangeTypeName | ( | const char * | rangeTypeName, |
Oid | typeNamespace | ||
) |
Definition at line 962 of file pg_type.c.
References buf, CStringGetDatum, ereport, errcode(), ERRCODE_DUPLICATE_OBJECT, errdetail(), errhint(), errmsg(), ERROR, NAMEDATALEN, ObjectIdGetDatum, pg_mbcliplen(), pnstrdup(), psprintf(), pstrdup(), SearchSysCacheExists2, and TYPENAMENSP.
Referenced by DefineRange().
|
static |
Definition at line 1006 of file pg_type.c.
References Assert, CStringGetDatum, generate_unaccent_rules::dest, i, NAMEDATALEN, ObjectIdGetDatum, pstrdup(), SearchSysCacheExists2, strlcpy(), truncate_identifier(), and TYPENAMENSP.
Referenced by makeArrayTypeName().
Definition at line 917 of file pg_type.c.
References CommandCounterIncrement(), get_array_type(), get_element_type(), get_typisdefined(), makeArrayTypeName(), OidIsValid, pfree(), and RenameTypeInternal().
Referenced by DefineCompositeType(), DefineDomain(), DefineEnum(), DefineRange(), DefineType(), heap_create_with_catalog(), and RenameTypeInternal().
Definition at line 802 of file pg_type.c.
References Assert, CatalogTupleUpdate(), CStringGetDatum, elog, ereport, errcode(), ERRCODE_DUPLICATE_OBJECT, errmsg(), ERROR, get_typisdefined(), GETSTRUCT, GetSysCacheOid2, heap_freetuple(), HeapTupleIsValid, InvokeObjectPostAlterHook, makeArrayTypeName(), moveArrayTypeName(), namestrcpy(), ObjectIdGetDatum, OidIsValid, pfree(), RenameTypeInternal(), RowExclusiveLock, SearchSysCacheCopy1, HeapTupleData::t_self, table_close(), table_open(), TYPENAMENSP, and TYPEOID.
Referenced by moveArrayTypeName(), RenameRelationInternal(), RenameType(), and RenameTypeInternal().
ObjectAddress TypeCreate | ( | Oid | newTypeOid, |
const char * | typeName, | ||
Oid | typeNamespace, | ||
Oid | relationOid, | ||
char | relationKind, | ||
Oid | ownerId, | ||
int16 | internalSize, | ||
char | typeType, | ||
char | typeCategory, | ||
bool | typePreferred, | ||
char | typDelim, | ||
Oid | inputProcedure, | ||
Oid | outputProcedure, | ||
Oid | receiveProcedure, | ||
Oid | sendProcedure, | ||
Oid | typmodinProcedure, | ||
Oid | typmodoutProcedure, | ||
Oid | analyzeProcedure, | ||
Oid | subscriptProcedure, | ||
Oid | elementType, | ||
bool | isImplicitArray, | ||
Oid | arrayType, | ||
Oid | baseType, | ||
const char * | defaultTypeValue, | ||
char * | defaultTypeBin, | ||
bool | passedByValue, | ||
char | alignment, | ||
char | storage, | ||
int32 | typeMod, | ||
int32 | typNDims, | ||
bool | typeNotNull, | ||
Oid | typeCollation | ||
) |
Definition at line 198 of file pg_type.c.
References aclcheck_error(), ACLCHECK_NOT_OWNER, binary_upgrade_next_pg_type_oid, BoolGetDatum, CatalogTupleInsert(), CatalogTupleUpdate(), CharGetDatum, CStringGetDatum, CStringGetTextDatum, elog, ereport, errcode(), ERRCODE_DUPLICATE_OBJECT, errmsg(), ERROR, GenerateTypeDependencies(), get_user_default_acl(), GetNewOidWithIndex(), GETSTRUCT, heap_form_tuple(), heap_modify_tuple(), HeapTupleIsValid, i, Int16GetDatum, Int32GetDatum, InvalidOid, InvokeObjectPostCreateHook, IsBinaryUpgrade, IsBootstrapProcessingMode, name, NameGetDatum, namestrcpy(), OBJECT_TYPE, ObjectAddressSet, ObjectIdGetDatum, OidIsValid, PointerGetDatum, RelationGetDescr, RowExclusiveLock, SearchSysCacheCopy2, stringToNode(), HeapTupleData::t_self, table_close(), table_open(), TYPENAMENSP, TypeOidIndexId, and values.
Referenced by AddNewRelationType(), DefineDomain(), DefineEnum(), DefineRange(), DefineType(), and heap_create_with_catalog().
ObjectAddress TypeShellMake | ( | const char * | typeName, |
Oid | typeNamespace, | ||
Oid | ownerId | ||
) |
Definition at line 61 of file pg_type.c.
References Assert, binary_upgrade_next_pg_type_oid, BoolGetDatum, CatalogTupleInsert(), CharGetDatum, DEFAULT_TYPDELIM, ereport, errcode(), errmsg(), ERROR, GenerateTypeDependencies(), GetNewOidWithIndex(), heap_form_tuple(), heap_freetuple(), i, Int16GetDatum, Int32GetDatum, InvalidOid, InvokeObjectPostCreateHook, IsBinaryUpgrade, IsBootstrapProcessingMode, name, NameGetDatum, namestrcpy(), ObjectAddressSet, ObjectIdGetDatum, OidIsValid, PointerIsValid, RelationData::rd_att, RowExclusiveLock, table_close(), table_open(), TypeOidIndexId, and values.
Referenced by compute_return_type(), and DefineType().
Oid binary_upgrade_next_pg_type_oid = InvalidOid |
Definition at line 45 of file pg_type.c.
Referenced by binary_upgrade_set_next_pg_type_oid(), TypeCreate(), and TypeShellMake().