create-in-v0.27.0-custom-types.td 1.2 KB

123456789101112131415161718192021222324252627282930313233343536
  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. #
  10. # CREATE various custom types and use them in views
  11. #
  12. > DROP TYPE IF EXISTS int4_list_list;
  13. > DROP TYPE IF EXISTS int4_list;
  14. > CREATE TYPE int4_list AS LIST (ELEMENT TYPE = int4);
  15. > CREATE MATERIALIZED VIEW int4_list_view AS SELECT '{1,2}'::int4_list AS custom_list;
  16. > CREATE TYPE int4_list_list AS LIST (ELEMENT TYPE = int4_list);
  17. > CREATE MATERIALIZED VIEW int4_list_list_view AS SELECT '{{1,2}}'::int4_list_list AS custom_nested_list;
  18. > DROP TYPE IF EXISTS int4_map_map;
  19. > DROP TYPE IF EXISTS int4_map;
  20. > CREATE TYPE int4_map AS MAP (KEY TYPE = text, VALUE TYPE = int4);
  21. > CREATE MATERIALIZED VIEW int4_map_view AS SELECT '{a=>1}'::int4_map AS custom_map;
  22. > CREATE TYPE int4_map_map AS MAP (KEY TYPE = text, VALUE TYPE = int4_map);
  23. > CREATE MATERIALIZED VIEW int4_map_map_view AS SELECT '{a=>{"a a"=>1}}'::int4_map_map AS custom_nested_map;