mirror of
https://github.com/postgres/postgres.git
synced 2025-07-08 11:42:09 +03:00
Refactor typenameTypeId()
Split the old typenameTypeId() into two functions: A new typenameTypeId() that returns only a type OID, and typenameTypeIdAndMod() that returns type OID and typmod. This isolates call sites better that actually care about the typmod.
This commit is contained in:
@ -398,7 +398,7 @@ DefineOpClass(CreateOpClassStmt *stmt)
|
||||
errmsg("must be superuser to create an operator class")));
|
||||
|
||||
/* Look up the datatype */
|
||||
typeoid = typenameTypeId(NULL, stmt->datatype, NULL);
|
||||
typeoid = typenameTypeId(NULL, stmt->datatype);
|
||||
|
||||
#ifdef NOT_USED
|
||||
/* XXX this is unnecessary given the superuser check above */
|
||||
@ -540,7 +540,7 @@ DefineOpClass(CreateOpClassStmt *stmt)
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
|
||||
errmsg("storage type specified more than once")));
|
||||
storageoid = typenameTypeId(NULL, item->storedtype, NULL);
|
||||
storageoid = typenameTypeId(NULL, item->storedtype);
|
||||
|
||||
#ifdef NOT_USED
|
||||
/* XXX this is unnecessary given the superuser check above */
|
||||
@ -1009,12 +1009,12 @@ processTypesSpec(List *args, Oid *lefttype, Oid *righttype)
|
||||
Assert(args != NIL);
|
||||
|
||||
typeName = (TypeName *) linitial(args);
|
||||
*lefttype = typenameTypeId(NULL, typeName, NULL);
|
||||
*lefttype = typenameTypeId(NULL, typeName);
|
||||
|
||||
if (list_length(args) > 1)
|
||||
{
|
||||
typeName = (TypeName *) lsecond(args);
|
||||
*righttype = typenameTypeId(NULL, typeName, NULL);
|
||||
*righttype = typenameTypeId(NULL, typeName);
|
||||
}
|
||||
else
|
||||
*righttype = *lefttype;
|
||||
|
Reference in New Issue
Block a user