ParseType parses a column type.
(sql string)
| 299 | |
| 300 | // ParseType parses a column type. |
| 301 | func ParseType(sql string) (*types.T, error) { |
| 302 | expr, err := ParseExpr(fmt.Sprintf("1::%s", sql)) |
| 303 | if err != nil { |
| 304 | return nil, err |
| 305 | } |
| 306 | |
| 307 | cast, ok := expr.(*tree.CastExpr) |
| 308 | if !ok { |
| 309 | return nil, errors.AssertionFailedf("expected a tree.CastExpr, but found %T", expr) |
| 310 | } |
| 311 | |
| 312 | return cast.Type, nil |
| 313 | } |
| 314 | |
| 315 | var errBitLengthNotPositive = pgerror.WithCandidateCode( |
| 316 | errors.New("length for type bit must be at least 1"), pgcode.InvalidParameterValue) |
nothing calls this directly
no test coverage detected
searching dependent graphs…