I want to create a table with default value set to the current year
CREATE TABLE Date
(
"year" smallint NOT NULL DEFAULT extract(year from current_time)
);
It throws an error:
!42000!syntax error, unexpected YEAR in: "select year"
The same command if I run using mclient it works fine.
sql>select extract(year from current_date);
+---------------------+
| second_current_date |
+=====================+
| 2015 |
+---------------------+
1 tuple (0.130ms)
sql>
sql>select "year"(NOW());
+-------------------+
| current_timestamp |
+===================+
| 2015 |
+-------------------+
1 tuple (0.380ms)
I only want the year. Is there any way to do it?