CURRENT_TIMESTAMP & DEFAULT Keywords do not work in MySQL INSERT STATEMENT
saklanipankaj opened this issue · 1 comments
saklanipankaj commented
INSERT INTO t2 (a, b, c, d) VALUES
( 1, 2, 'Hello', DEFAULT),
(12, 7, 'Test', DEFAULT),
( 0, 123, 'This is encrypted', DEFAULT),
(71, 13, 'Last', DEFAULT);
ERROR 13180 (HY000): Unknown column 'a' in 'field list'
INSERT INTO t1 (a, b, i, j) VALUES
( 1, 2, 'Hello', CURRENT_TIMESTAMP),
(12, 0, 'Test', CURRENT_TIMESTAMP),
( 0, 2, 'This is encrypted', CURRENT_TIMESTAMP),
(71, 67, 'Last', CURRENT_TIMESTAMP);
ERROR 13180 (HY000): One or more errors occurred. (Unable to cast object of type 'PrismaDB.QueryAST.DML.ScalarFunction' to type 'PrismaDB.QueryAST.DML.Constant'.)
Ambiguous Error statement, is returned when the DEFAULT & CURRENT_TIMESTAMP keywords are used in the MySQL INSERT Statement. The keyword is supported in the PostgreSQL and MSSQL databases, and can be used in the INSERT statements there.
cheziyi commented
In MySQL, to insert the current time, it should be NOW()
. That said, insertion of CURRENT_TIMESTAMP
and DEFAULT
is not officially supported, so this is not considered a bug, and will be closed.