40-truncate-table.td 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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. # Check that TRUNCATE table is properly replicated. Debezium is supposed
  11. # to issue a dedicated TRUNCATE message on the topic, however instead
  12. # it suffers an internal Java exception and replication stops
  13. #
  14. $ postgres-execute connection=postgres://postgres:postgres@postgres
  15. CREATE TABLE truncate_table (f1 INTEGER PRIMARY KEY);
  16. INSERT INTO truncate_table VALUES (1),(2),(3);
  17. $ schema-registry-wait topic=postgres.public.truncate_table
  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 truncate_table
  23. FROM KAFKA CONNECTION kafka_conn (TOPIC 'postgres.public.truncate_table');
  24. > CREATE TABLE truncate_table_tbl FROM SOURCE truncate_table (REFERENCE "postgres.public.truncate_table")
  25. FORMAT AVRO USING CONFLUENT SCHEMA REGISTRY CONNECTION csr_conn
  26. ENVELOPE DEBEZIUM;
  27. > SELECT * FROM truncate_table_tbl;
  28. 1
  29. 2
  30. 3
  31. $ postgres-execute connection=postgres://postgres:postgres@postgres
  32. TRUNCATE TABLE truncate_table;
  33. INSERT INTO truncate_table VALUES (2),(3),(4);
  34. # TODO: database-issues#8602
  35. # ! SELECT * FROM truncate_table_tbl;
  36. # contains:table was truncated