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

Function processCollationOnType

pkg/sql/sem/tree/create.go:260–277  ·  view source on GitHub ↗
(name Name, typ *types.T, c ColumnCollation)

Source from the content-addressed store, hash-verified

258}
259
260func processCollationOnType(name Name, typ *types.T, c ColumnCollation) (*types.T, error) {
261 switch typ.Family() {
262 case types.StringFamily:
263 return types.MakeCollatedString(typ, string(c)), nil
264 case types.CollatedStringFamily:
265 return nil, pgerror.Newf(pgcode.Syntax,
266 "multiple COLLATE declarations for column %q", name)
267 case types.ArrayFamily:
268 elemTyp, err := processCollationOnType(name, typ.ArrayContents(), c)
269 if err != nil {
270 return nil, err
271 }
272 return types.MakeArray(elemTyp), nil
273 default:
274 return nil, pgerror.Newf(pgcode.DatatypeMismatch,
275 "COLLATE declaration for non-string-typed column %q", name)
276 }
277}
278
279// NewColumnTableDef constructs a column definition for a CreateTable statement.
280func NewColumnTableDef(

Callers 1

NewColumnTableDefFunction · 0.85

Calls 5

MakeCollatedStringFunction · 0.92
NewfFunction · 0.92
MakeArrayFunction · 0.92
FamilyMethod · 0.80
ArrayContentsMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…