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

Function EncodeRestrictedSQLIdent

postgres/parser/lex/encode.go:165–171  ·  view source on GitHub ↗

EncodeRestrictedSQLIdent writes the identifier in s to buf. The identifier is quoted if either the flags ask for it, the identifier contains special characters, or the identifier is a reserved SQL keyword.

(buf *bytes.Buffer, s string, flags EncodeFlags)

Source from the content-addressed store, hash-verified

163// contains special characters, or the identifier is a reserved SQL
164// keyword.
165func EncodeRestrictedSQLIdent(buf *bytes.Buffer, s string, flags EncodeFlags) {
166 if flags.HasFlags(EncBareIdentifiers) || (!isReservedKeyword(s) && isBareIdentifier(s)) {
167 buf.WriteString(s)
168 return
169 }
170 EncodeEscapedSQLIdent(buf, s)
171}
172
173// EncodeEscapedSQLIdent writes the identifier in s to buf. The
174// identifier is always quoted. Double quotes inside the identifier

Callers 1

FormatMethod · 0.92

Calls 5

isReservedKeywordFunction · 0.85
isBareIdentifierFunction · 0.85
EncodeEscapedSQLIdentFunction · 0.85
WriteStringMethod · 0.80
HasFlagsMethod · 0.45

Tested by

no test coverage detected