MCPcopy Create free account
hub / github.com/dolthub/doltgresql / collatedStringTypeSQL

Method collatedStringTypeSQL

postgres/parser/types/types.go:2441–2451  ·  view source on GitHub ↗

collatedStringTypeSQL returns the string representation of a COLLATEDSTRING or []COLLATEDSTRING type. This is tricky in the case of an array of collated string, since brackets must precede the COLLATE identifier: STRING COLLATE EN VARCHAR(20)[] COLLATE DE

(isArray bool)

Source from the content-addressed store, hash-verified

2439// STRING COLLATE EN
2440// VARCHAR(20)[] COLLATE DE
2441func (t *T) collatedStringTypeSQL(isArray bool) string {
2442 var buf bytes.Buffer
2443 buf.WriteString(t.stringTypeSQL())
2444 if isArray {
2445 buf.WriteString("[] COLLATE ")
2446 } else {
2447 buf.WriteString(" COLLATE ")
2448 }
2449 lex.EncodeLocaleName(&buf, t.Locale())
2450 return buf.String()
2451}
2452
2453// stringTypeSQL returns the visible type name plus any width specifier for the
2454// STRING/COLLATEDSTRING type.

Callers 1

SQLStringMethod · 0.95

Calls 5

stringTypeSQLMethod · 0.95
LocaleMethod · 0.95
EncodeLocaleNameFunction · 0.92
WriteStringMethod · 0.80
StringMethod · 0.65

Tested by

no test coverage detected