10-remove-nullability.td 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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. # Change the definition of a column to be NOT NULL
  11. #
  12. # TODO: Reenable when database-issues#2047 is fixed
  13. $ skip-if
  14. SELECT true
  15. $ postgres-execute connection=postgres://postgres:postgres@postgres
  16. CREATE TABLE alter_remove_nullability (f1 INTEGER);
  17. ALTER TABLE alter_remove_nullability REPLICA IDENTITY FULL;
  18. INSERT INTO alter_remove_nullability VALUES (123),(234);
  19. > CREATE CONNECTION IF NOT EXISTS csr_conn TO CONFLUENT SCHEMA REGISTRY (
  20. URL '${testdrive.schema-registry-url}'
  21. );
  22. > CREATE CONNECTION IF NOT EXISTS kafka_conn TO KAFKA (BROKER '${testdrive.kafka-addr}', SECURITY PROTOCOL PLAINTEXT);
  23. > CREATE SOURCE alter_remove_nullability
  24. FROM KAFKA CONNECTION kafka_conn (TOPIC 'postgres.public.alter_remove_nullability');
  25. > CREATE TABLE alter_remove_nullability_tbl FROM SOURCE alter_remove_nullability (REFERENCE "postgres.public.alter_remove_nullability")
  26. FORMAT AVRO USING CONFLUENT SCHEMA REGISTRY CONNECTION csr_conn
  27. ENVELOPE DEBEZIUM;
  28. > SELECT * FROM alter_remove_nullability_tbl;
  29. 123
  30. 234
  31. $ postgres-execute connection=postgres://postgres:postgres@postgres
  32. ALTER TABLE alter_remove_nullability ALTER COLUMN f1 SET NOT NULL;
  33. INSERT INTO alter_remove_nullability VALUES (345);
  34. UPDATE alter_remove_nullability SET f1 = 456 WHERE f1 = 123;
  35. DELETE FROM alter_remove_nullability WHERE f1 = 234;
  36. > SELECT * FROM alter_remove_nullability_tbl;
  37. 345
  38. 456