GetTypeFromValidSQLSyntax retrieves a type from its SQL syntax. The caller is responsible for guaranteeing that the type expression is valid SQL (or handling the resulting error). This includes verifying that complex identifiers are enclosed in double quotes, etc.
(sql string)
| 423 | // SQL (or handling the resulting error). This includes verifying that complex |
| 424 | // identifiers are enclosed in double quotes, etc. |
| 425 | func GetTypeFromValidSQLSyntax(sql string) (tree.ResolvableTypeReference, error) { |
| 426 | expr, err := ParseExpr(fmt.Sprintf("1::%s", sql)) |
| 427 | if err != nil { |
| 428 | return nil, err |
| 429 | } |
| 430 | return GetTypeFromCastOrCollate(expr) |
| 431 | } |
| 432 | |
| 433 | // GetTypeFromCastOrCollate returns the type of the given tree.Expr. The method |
| 434 | // assumes that the expression is either tree.CastExpr or tree.CollateExpr |
nothing calls this directly
no test coverage detected
searching dependent graphs…