map.td 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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. > SELECT id, key_id, value_id, key_modifiers::text, value_modifiers::text FROM mz_map_types;
  10. > SHOW TYPES
  11. > CREATE TYPE bool AS MAP (KEY TYPE = text, VALUE TYPE = int4)
  12. > CREATE TYPE custom AS MAP (KEY TYPE = text, VALUE TYPE = bool)
  13. $ set-regex match=^s\d*$ replacement=<GID>
  14. # Without qualifiers, should default to builtin bool.
  15. > SELECT value_id
  16. FROM mz_map_types JOIN mz_types ON mz_map_types.id = mz_types.id
  17. WHERE name = 'custom'
  18. <GID>
  19. > CREATE TYPE another_custom AS MAP (KEY TYPE = text, VALUE TYPE = public.bool)
  20. $ set-regex match=^u\d*$ replacement=<GID>
  21. # Qualified name should point to user-defined bool.
  22. > SELECT value_id
  23. FROM mz_map_types JOIN mz_types ON mz_map_types.id = mz_types.id
  24. WHERE name = 'another_custom'
  25. <GID>
  26. > CREATE SCHEMA test_schema
  27. > CREATE TYPE test_schema.bool AS MAP (KEY TYPE = text, VALUE TYPE = float4)
  28. > SHOW TYPES
  29. name comment
  30. -----------------------
  31. bool ""
  32. custom ""
  33. another_custom ""
  34. > SHOW TYPES FROM test_schema
  35. name comment
  36. ---------------
  37. bool ""
  38. ! DROP TYPE bool
  39. contains:cannot drop type bool because it is required by the database system
  40. ! DROP TYPE public.bool
  41. contains:cannot drop type "public.bool": still depended upon by type "another_custom"
  42. > DROP TYPE another_custom
  43. > DROP TYPE public.bool