mz_columns.slt 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. # Copyright Materialize, Inc. and contributors. All rights reserved.
  2. #
  3. # Use of this software is governed by the Business Source License
  4. # included in the LICENSE file at the root of this repository.
  5. #
  6. # As of the Change Date specified in that file, in accordance with
  7. # the Business Source License, use of this software will be governed
  8. # by the Apache License, Version 2.0.
  9. mode cockroach
  10. statement ok
  11. CREATE TYPE r AS (a int)
  12. statement ok
  13. CREATE TYPE l AS LIST (ELEMENT TYPE = int)
  14. statement ok
  15. CREATE TYPE m AS MAP (KEY TYPE = text, VALUE TYPE = int)
  16. statement ok
  17. CREATE VIEW v AS SELECT
  18. row(1) AS ra,
  19. row(1)::r AS rn,
  20. list[]::int list AS la,
  21. list[]::l AS ln,
  22. map[]::map[text=>int] AS ma,
  23. '{}'::m AS mn
  24. # We intentionally don't assert on the `c.type_oid` or `t.id` columns, as
  25. # IDs are not stable. Instead, we ensure that the `c.type_oid` column can be
  26. # used to look up the type in the `mz_types` table and that the ID is
  27. # as expected (system or user).
  28. query TTTIT
  29. SELECT
  30. c.position, c.name, c.type, c.type_mod, left(t.id, 1)
  31. FROM mz_columns c
  32. JOIN mz_views v ON c.id = v.id
  33. JOIN mz_types t ON c.type_oid = t.oid
  34. WHERE v.name = 'v'
  35. ORDER BY c.position
  36. ----
  37. 1 ra record -1 s
  38. 2 rn r -1 u
  39. 3 la list -1 s
  40. 4 ln l -1 u
  41. 5 ma map -1 s
  42. 6 mn m -1 u