matrixone icon indicating copy to clipboard operation
matrixone copied to clipboard

[Bug]: cast from date to timestamp syntax error

Open dengn opened this issue 2 years ago • 1 comments

Is there an existing issue for the same bug?

  • [X] I have checked the existing issues.

Environment

- Version or commit-id (e.g. v0.1.0 or 8b23a93): 408bd69dc8a4d869adf5cdad49d2d9eebd6e01d7
- Hardware parameters:
- OS type:
- Others:

Actual Behavior

mysql> create table t1(a date); Query OK, 0 rows affected (0.02 sec)

mysql> insert into t1 values("2022-01-30"); Query OK, 1 row affected (0.03 sec)

mysql> select cast(a as timestamp); ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MatrixOne server version for the right syntax to use. syntax error at position 27 near 'timestamp';

mysql> select from_unixtime(a) from t1; ERROR 1105 (HY000): Function 'from_unixtime' with parameters [DATE] will be implemented in future version.

Expected Behavior

DATE to timestamp should be castable explicitly and implicitly.

Steps to Reproduce

No response

Additional information

No response

dengn avatar Jul 11 '22 05:07 dengn

mysql does't support select cast(a as timestamp).

iamlinjunhong avatar Jul 11 '22 06:07 iamlinjunhong

Casting from date to timestamp should be normal after applying #4502. Please confirm.

aunjgr avatar Aug 17 '22 08:08 aunjgr

mysql> use test; Database changed mysql> create table t1(a date); Query OK, 0 rows affected (0.01 sec)

mysql> insert into t1 values("2022-01-30"); Query OK, 1 row affected (0.00 sec)

mysql> mysql> select cast(a as timestamp); ERROR 20301 (HY000): invalid input: column a does not exist mysql> select from_unixtime(a) from t1; ERROR 20203 (HY000): invalid argument function from_unixtime, bad value [DATE] mysql>

aressu1985 avatar Oct 20 '22 15:10 aressu1985