24-types-enum.td 1.3 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. # Make sure that the ENUM type is replicated correctly
  11. #
  12. $ postgres-execute connection=postgres://postgres:postgres@postgres
  13. CREATE TYPE enum1 AS ENUM ('val1', 'val2');
  14. CREATE TABLE enum_type ( f1 enum1, f2 INTEGER PRIMARY KEY);
  15. INSERT INTO enum_type VALUES ('val1', 0), ('val2', 1);
  16. $ schema-registry-wait topic=postgres.public.enum_type
  17. > CREATE CONNECTION IF NOT EXISTS csr_conn TO CONFLUENT SCHEMA REGISTRY (
  18. URL '${testdrive.schema-registry-url}'
  19. );
  20. > CREATE CONNECTION IF NOT EXISTS kafka_conn TO KAFKA (BROKER '${testdrive.kafka-addr}', SECURITY PROTOCOL PLAINTEXT);
  21. > CREATE SOURCE enum_type
  22. FROM KAFKA CONNECTION kafka_conn (TOPIC 'postgres.public.enum_type');
  23. > CREATE TABLE enum_type_tbl FROM SOURCE enum_type (REFERENCE "postgres.public.enum_type")
  24. FORMAT AVRO USING CONFLUENT SCHEMA REGISTRY CONNECTION csr_conn
  25. ENVELOPE DEBEZIUM;
  26. > SELECT pg_typeof(f1), f1 FROM enum_type_tbl;
  27. text val1
  28. text val2