types-serial.td 1.2 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. $ set-sql-timeout duration=1s
  10. #
  11. # Test SERIAL
  12. # Note that SERIAL is just an alias for INT with AUTO_INCREMENT
  13. #
  14. > CREATE SECRET mysqlpass AS '${arg.mysql-root-password}'
  15. > CREATE CONNECTION mysql_conn TO MYSQL (
  16. HOST mysql,
  17. USER root,
  18. PASSWORD SECRET mysqlpass
  19. )
  20. $ mysql-connect name=mysql url=mysql://root@mysql password=${arg.mysql-root-password}
  21. $ mysql-execute name=mysql
  22. DROP DATABASE IF EXISTS public;
  23. CREATE DATABASE public;
  24. USE public;
  25. CREATE TABLE t1 (f1 SERIAL);
  26. INSERT INTO t1 VALUES (2147483647);
  27. > CREATE SOURCE mz_source FROM MYSQL CONNECTION mysql_conn;
  28. > CREATE TABLE t1 FROM SOURCE mz_source (REFERENCE public.t1);
  29. > SELECT COUNT(*) > 0 FROM t1;
  30. true
  31. # Do no insert the same data post-snapshot to avoid "duplicate entry"
  32. > SELECT pg_typeof(f1) FROM t1 LIMIT 1;
  33. uint8
  34. > SELECT * FROM t1;
  35. 2147483647