types-temporal-2.td 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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 further temporal data types
  12. #
  13. > CREATE SECRET mysqlpass AS '${arg.mysql-root-password}'
  14. > CREATE CONNECTION mysql_conn TO MYSQL (
  15. HOST mysql,
  16. USER root,
  17. PASSWORD SECRET mysqlpass
  18. )
  19. $ mysql-connect name=mysql url=mysql://root@mysql password=${arg.mysql-root-password}
  20. $ mysql-execute name=mysql
  21. DROP DATABASE IF EXISTS public;
  22. CREATE DATABASE public;
  23. USE public;
  24. CREATE TABLE t1 (time_col TIME);
  25. INSERT INTO t1 VALUES ('00:00:00');
  26. INSERT INTO t1 VALUES ('23:59:59');
  27. CREATE TABLE t2 (year_col YEAR);
  28. INSERT INTO t2 VALUES ('1901');
  29. INSERT INTO t2 VALUES ('2155');
  30. > CREATE SOURCE mz_source FROM MYSQL CONNECTION mysql_conn;
  31. > CREATE TABLE t1 FROM SOURCE mz_source (REFERENCE public.t1);
  32. > CREATE TABLE t2 FROM SOURCE mz_source (REFERENCE public.t2) WITH (TEXT COLUMNS (year_col));
  33. > SELECT * FROM t1;
  34. "00:00:00"
  35. "23:59:59"
  36. > SELECT * FROM t2;
  37. "1901"
  38. "2155"