22-types-double.td 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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 double type is replicated correctly
  11. #
  12. $ postgres-execute connection=postgres://postgres:postgres@postgres
  13. CREATE TABLE double_type (f1 DOUBLE PRECISION, f2 INTEGER PRIMARY KEY);
  14. ALTER TABLE double_type REPLICA IDENTITY FULL;
  15. INSERT INTO double_type VALUES (NULL, 0), ('Infinity', 1),('-Infinity', 2), ('NaN', 3);
  16. $ schema-registry-wait topic=postgres.public.double_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 double_type
  22. FROM KAFKA CONNECTION kafka_conn (TOPIC 'postgres.public.double_type');
  23. > CREATE TABLE double_type_tbl FROM SOURCE double_type (REFERENCE "postgres.public.double_type")
  24. FORMAT AVRO USING CONFLUENT SCHEMA REGISTRY CONNECTION csr_conn
  25. ENVELOPE DEBEZIUM;
  26. > SELECT f1 FROM double_type_tbl;
  27. <null>
  28. inf
  29. -inf
  30. NaN
  31. $ postgres-execute connection=postgres://postgres:postgres@postgres
  32. UPDATE double_type SET f1 = 123 WHERE f1 = 'Infinity';
  33. UPDATE double_type SET f1 = -123 WHERE f1 = '-Infinity';
  34. UPDATE double_type SET f1 = NULL WHERE f1 = 'NaN';
  35. > SELECT f1 FROM double_type_tbl;
  36. <null>
  37. <null>
  38. 123
  39. -123