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

Method parseElement

pkg/sql/sem/tree/parse_array.go:112–144  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

110}
111
112func (p *parseState) parseElement() error {
113 var next string
114 var err error
115 r := p.peek()
116 switch r {
117 case '{':
118 return nestedArraysNotSupportedError
119 case '"':
120 p.advance()
121 next, err = p.parseQuotedString()
122 if err != nil {
123 return err
124 }
125 p.advance()
126 default:
127 if !isElementChar(r) {
128 return malformedError
129 }
130 next, err = p.parseUnquotedString()
131 if err != nil {
132 return err
133 }
134 if strings.EqualFold(next, "null") {
135 return p.result.Append(DNull)
136 }
137 }
138
139 d, err := ParseAndRequireString(p.t, next, p.ctx)
140 if err != nil {
141 return err
142 }
143 return p.result.Append(d)
144}
145
146// ParseDArrayFromString parses the string-form of constructing arrays, handling
147// cases such as `'{1,2,3}'::INT[]`. The input type t is the type of the

Callers 1

doParseDArrayFromStringFunction · 0.95

Calls 6

peekMethod · 0.95
advanceMethod · 0.95
parseQuotedStringMethod · 0.95
parseUnquotedStringMethod · 0.95
ParseAndRequireStringFunction · 0.85
AppendMethod · 0.80

Tested by

no test coverage detected