[MDEV-26765] UNIX_TIMESTAMP(CURRENT_TIME()) return null ?!? Created: 2021-10-04  Updated: 2023-04-06  Resolved: 2023-03-29

Status: Closed
Project: MariaDB Server
Component/s: Data types
Affects Version/s: 10.5.12, 10.4, 10.5, 10.6
Fix Version/s: 10.11.3, 10.4.29, 10.5.20, 10.6.13, 10.7.8, 10.8.8, 10.9.6, 10.10.4

Type: Bug Priority: Critical
Reporter: Christophe DEVEL Assignee: Alexander Barkov
Resolution: Fixed Votes: 1
Labels: regression-10.4
Environment:

Debian 10.10



 Description   

Hello,
It seems that UNIX_TIMESTAMP(CURRENT_TIME()) returns null, but not UNIX_TIMESTAMP(CURRENT_TIMESTAMP())
Is it wanted?
Or is it a bug?
Thank you for your reply

– --------------------------------------
SELECT
UNIX_TIMESTAMP(CURRENT_TIME()),
UNIX_TIMESTAMP(CURRENT_TIMESTAMP()),
UNIX_TIMESTAMP(NOW())
– --------------------------------------
;



 Comments   
Comment by Alice Sherepa [ 2021-10-05 ]

Thanks!
I repeated on 10.4-10.6, while 10.3 returns the correct result.

Comment by Alexander Barkov [ 2023-03-29 ]

The same problem is repeatable with this statement:

MariaDB [test]> SELECT UNIX_TIMESTAMP(TIME'10:20:30');
+--------------------------------+
| UNIX_TIMESTAMP(TIME'10:20:30') |
+--------------------------------+
|                           NULL |
+--------------------------------+

Also repeatable in this script:

CREATE OR REPLACE TABLE t1 (a TIME);
INSERT INTO t1 VALUES ('10:20:30');
SELECT UNIX_TIMESTAMP(a) FROM t1;

+-------------------+
| UNIX_TIMESTAMP(a) |
+-------------------+
|              NULL |
+-------------------+
1 row in set, 1 warning (1.767 sec)

Generated at Thu Feb 08 09:47:47 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.