Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitc5ff3ff

Browse files
committed
Avoid an unnecessary syscache lookup in parse_coerce.c.
All the other fields of the constant are being extracted from the syscacheentry we already have, so handle collation similarly. (There don't seemto be any other uses for the new function at the moment.)
1 parentcba9cd4 commitc5ff3ff

File tree

3 files changed

+15
-4
lines changed

3 files changed

+15
-4
lines changed

‎src/backend/parser/parse_coerce.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ coerce_type(ParseState *pstate, Node *node,
219219

220220
newcon->consttype=baseTypeId;
221221
newcon->consttypmod=inputTypeMod;
222-
newcon->constcollid=get_typcollation(newcon->consttype);
222+
newcon->constcollid=typeTypeCollation(targetType);
223223
newcon->constlen=typeLen(targetType);
224224
newcon->constbyval=typeByVal(targetType);
225225
newcon->constisnull=con->constisnull;

‎src/backend/parser/parse_type.c

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -528,7 +528,7 @@ typeLen(Type t)
528528
returntyp->typlen;
529529
}
530530

531-
/* given type (as type struct), returnthe value ofits 'byval' attribute.*/
531+
/* given type (as type struct), return its 'byval' attribute*/
532532
bool
533533
typeByVal(Typet)
534534
{
@@ -538,7 +538,7 @@ typeByVal(Type t)
538538
returntyp->typbyval;
539539
}
540540

541-
/* given type (as type struct), return thename oftype */
541+
/* given type (as type struct), return the type's name */
542542
char*
543543
typeTypeName(Typet)
544544
{
@@ -549,16 +549,26 @@ typeTypeName(Type t)
549549
returnpstrdup(NameStr(typ->typname));
550550
}
551551

552+
/* given type (as type struct), return its 'typrelid' attribute */
552553
Oid
553554
typeTypeRelid(Typetyp)
554555
{
555556
Form_pg_typetyptup;
556557

557558
typtup= (Form_pg_type)GETSTRUCT(typ);
558-
559559
returntyptup->typrelid;
560560
}
561561

562+
/* given type (as type struct), return its 'typcollation' attribute */
563+
Oid
564+
typeTypeCollation(Typetyp)
565+
{
566+
Form_pg_typetyptup;
567+
568+
typtup= (Form_pg_type)GETSTRUCT(typ);
569+
returntyptup->typcollation;
570+
}
571+
562572
/*
563573
* Given a type structure and a string, returns the internal representation
564574
* of that string.The "string" can be NULL to perform conversion of a NULL

‎src/include/parser/parse_type.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ extern int16 typeLen(Type t);
4040
externbooltypeByVal(Typet);
4141
externchar*typeTypeName(Typet);
4242
externOidtypeTypeRelid(Typetyp);
43+
externOidtypeTypeCollation(Typetyp);
4344
externDatumstringTypeDatum(Typetp,char*string,int32atttypmod);
4445

4546
externOidtypeidTypeRelid(Oidtype_id);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp