mirror of
https://github.com/postgres/postgres.git
synced 2025-10-18 04:29:09 +03:00
Avoid an unnecessary syscache lookup in parse_coerce.c.
All the other fields of the constant are being extracted from the syscache entry we already have, so handle collation similarly. (There don't seem to be any other uses for the new function at the moment.)
This commit is contained in:
@@ -219,7 +219,7 @@ coerce_type(ParseState *pstate, Node *node,
|
||||
|
||||
newcon->consttype = baseTypeId;
|
||||
newcon->consttypmod = inputTypeMod;
|
||||
newcon->constcollid = get_typcollation(newcon->consttype);
|
||||
newcon->constcollid = typeTypeCollation(targetType);
|
||||
newcon->constlen = typeLen(targetType);
|
||||
newcon->constbyval = typeByVal(targetType);
|
||||
newcon->constisnull = con->constisnull;
|
||||
|
@@ -528,7 +528,7 @@ typeLen(Type t)
|
||||
return typ->typlen;
|
||||
}
|
||||
|
||||
/* given type (as type struct), return the value of its 'byval' attribute.*/
|
||||
/* given type (as type struct), return its 'byval' attribute */
|
||||
bool
|
||||
typeByVal(Type t)
|
||||
{
|
||||
@@ -538,7 +538,7 @@ typeByVal(Type t)
|
||||
return typ->typbyval;
|
||||
}
|
||||
|
||||
/* given type (as type struct), return the name of type */
|
||||
/* given type (as type struct), return the type's name */
|
||||
char *
|
||||
typeTypeName(Type t)
|
||||
{
|
||||
@@ -549,16 +549,26 @@ typeTypeName(Type t)
|
||||
return pstrdup(NameStr(typ->typname));
|
||||
}
|
||||
|
||||
/* given type (as type struct), return its 'typrelid' attribute */
|
||||
Oid
|
||||
typeTypeRelid(Type typ)
|
||||
{
|
||||
Form_pg_type typtup;
|
||||
|
||||
typtup = (Form_pg_type) GETSTRUCT(typ);
|
||||
|
||||
return typtup->typrelid;
|
||||
}
|
||||
|
||||
/* given type (as type struct), return its 'typcollation' attribute */
|
||||
Oid
|
||||
typeTypeCollation(Type typ)
|
||||
{
|
||||
Form_pg_type typtup;
|
||||
|
||||
typtup = (Form_pg_type) GETSTRUCT(typ);
|
||||
return typtup->typcollation;
|
||||
}
|
||||
|
||||
/*
|
||||
* Given a type structure and a string, returns the internal representation
|
||||
* of that string. The "string" can be NULL to perform conversion of a NULL
|
||||
|
Reference in New Issue
Block a user