21-types-boolean.td 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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 boolean type is replicated correctly
  11. #
  12. $ postgres-execute connection=postgres://postgres:postgres@postgres
  13. CREATE TABLE boolean_type (pk_col BOOLEAN PRIMARY KEY, nopk_col BOOLEAN);
  14. ALTER TABLE boolean_type REPLICA IDENTITY FULL;
  15. INSERT INTO boolean_type VALUES (TRUE, TRUE);
  16. INSERT INTO boolean_type VALUES (FALSE, FALSE);
  17. $ schema-registry-wait topic=postgres.public.boolean_type
  18. > CREATE CONNECTION IF NOT EXISTS csr_conn TO CONFLUENT SCHEMA REGISTRY (
  19. URL '${testdrive.schema-registry-url}'
  20. );
  21. > CREATE CONNECTION IF NOT EXISTS kafka_conn TO KAFKA (BROKER '${testdrive.kafka-addr}', SECURITY PROTOCOL PLAINTEXT);
  22. > CREATE SOURCE boolean_type
  23. FROM KAFKA CONNECTION kafka_conn (TOPIC 'postgres.public.boolean_type');
  24. > CREATE TABLE boolean_type_tbl FROM SOURCE boolean_type (REFERENCE "postgres.public.boolean_type")
  25. FORMAT AVRO USING CONFLUENT SCHEMA REGISTRY CONNECTION csr_conn
  26. ENVELOPE DEBEZIUM;
  27. > SELECT * FROM boolean_type_tbl;
  28. true true
  29. false false
  30. $ postgres-execute connection=postgres://postgres:postgres@postgres
  31. UPDATE boolean_type SET nopk_col = NULL WHERE pk_col = TRUE;
  32. DELETE FROM boolean_type WHERE pk_col = FALSE;
  33. > SELECT * FROM boolean_type_tbl;
  34. true <null>