arrayOf creates a type alias for an array of the given element type and fixed bounds. The bounds are currently ignored.
( ref tree.ResolvableTypeReference, bounds []int32, )
| 497 | // arrayOf creates a type alias for an array of the given element type and fixed |
| 498 | // bounds. The bounds are currently ignored. |
| 499 | func arrayOf( |
| 500 | ref tree.ResolvableTypeReference, bounds []int32, |
| 501 | ) (tree.ResolvableTypeReference, error) { |
| 502 | // If the reference is a statically known type, then return an array type, |
| 503 | // rather than an array type reference. |
| 504 | if typ, ok := tree.GetStaticallyKnownType(ref); ok { |
| 505 | switch typ.Family() { |
| 506 | case types.UnknownFamily, types.VoidFamily, types.TriggerFamily: |
| 507 | // Do not allow arrays of these types. This is consistent with Postgres' |
| 508 | // behavior. |
| 509 | return nil, pgerror.Newf(pgcode.UndefinedObject, "type %s[] does not exist", typ.Name()) |
| 510 | } |
| 511 | if err := types.CheckArrayElementType(typ); err != nil { |
| 512 | return nil, err |
| 513 | } |
| 514 | return types.MakeArray(typ), nil |
| 515 | } |
| 516 | return &tree.ArrayTypeReference{ElementType: ref}, nil |
| 517 | } |
| 518 | |
| 519 | // ParseDoBlockFn allows the SQL parser to parse a PL/pgSQL DO block body. |
| 520 | var ParseDoBlockFn func(tree.DoBlockOptions) (tree.DoBlockBody, error) |
nothing calls this directly
no test coverage detected
searching dependent graphs…