MCPcopy Create free account
hub / github.com/auxten/postgresql-parser / MakeCollatedString

Function MakeCollatedString

pkg/sql/types/types.go:653–660  ·  view source on GitHub ↗

MakeCollatedString constructs a new instance of a CollatedStringFamily type that is collated according to the given locale. The new type is based upon the given string type, having the same oid and width values. For example: STRING => STRING COLLATE EN VARCHAR(20) => VARCHAR(20) COLLATE EN

(strType *T, locale string)

Source from the content-addressed store, hash-verified

651// VARCHAR(20) => VARCHAR(20) COLLATE EN
652//
653func MakeCollatedString(strType *T, locale string) *T {
654 switch strType.Oid() {
655 case oid.T_text, oid.T_varchar, oid.T_bpchar, oid.T_char, oid.T_name:
656 return &T{InternalType: InternalType{
657 Family: CollatedStringFamily, Oid: strType.Oid(), Width: strType.Width(), Locale: &locale}}
658 }
659 panic(errors.AssertionFailedf("cannot apply collation to non-string type: %s", strType))
660}
661
662// MakeDecimal constructs a new instance of a DECIMAL type (oid = T_numeric)
663// that has at most "precision" # of decimal digits (0 = unspecified number of

Callers 4

ResolvedTypeMethod · 0.92
NewTypedCollateExprFunction · 0.92
TypeCheckMethod · 0.92
processCollationOnTypeFunction · 0.92

Calls 2

OidMethod · 0.80
WidthMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…