[MDEV-10353] New DEFAULT logic does not support use of some suitable functions Created: 2016-07-09  Updated: 2016-10-28  Resolved: 2016-10-28

Status: Closed
Project: MariaDB Server
Component/s: OTHER
Affects Version/s: 10.2
Fix Version/s: 10.2.2

Type: Bug Priority: Minor
Reporter: Elena Stepanova Assignee: Sergei Golubchik
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
Relates
relates to MDEV-10134 Add full support for DEFAULT Closed

 Description   

There seems to be no obvious good reason why

  • MONTHNAME(..)
  • DAYNAME(...)
  • DATE_FORMAT(...)
  • TIME_FORMAT(...)

should not work in DEFAULT clause, so it's worth checking whether it was intended:

MariaDB [test]> create table t1 (d datetime default current_timestamp, m varchar(16) default monthname(d));
ERROR 1901 (HY000): Function or expression 'monthname()' cannot be used in the DEFAULT clause of `m`

Especially since MONTH() works:

MariaDB [test]> create or replace table t1 (d datetime default current_timestamp, m varchar(16) default month(d));
Query OK, 0 rows affected (0.58 sec)



 Comments   
Comment by Sergei Golubchik [ 2016-07-10 ]

This is tested in the default.test. Functions that depend on the session state (in particular, on @@lc_time_names variable) are not supported.

Comment by Elena Stepanova [ 2016-07-10 ]

VERSION() function is not allowed, which is strange, because @@version works. VERSION() is not in the default.test.

Generated at Thu Feb 08 07:41:34 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.