summaryrefslogtreecommitdiff
path: root/sql/sql_table.cc
diff options
context:
space:
mode:
authorAlexander Barkov <bar@mariadb.org>2015-08-10 11:46:41 +0400
committerAlexander Barkov <bar@mariadb.org>2015-08-10 11:46:41 +0400
commit86a3613d4e981c341e38291c9eeec5dc9f836fae (patch)
treecd6568883dd79830971854c8d6bf6274030ba2d3 /sql/sql_table.cc
parent840aefc6a34a57c572fc6c37ea16648e8dd6a1e6 (diff)
downloadmariadb-git-86a3613d4e981c341e38291c9eeec5dc9f836fae.tar.gz
MDEV-8441 Bad SHOW CREATE TABLE output for a table with a virtual column
Diffstat (limited to 'sql/sql_table.cc')
-rw-r--r--sql/sql_table.cc6
1 files changed, 5 insertions, 1 deletions
diff --git a/sql/sql_table.cc b/sql/sql_table.cc
index 019650ae0c2..fa14204110a 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -3061,6 +3061,9 @@ CHARSET_INFO* get_sql_field_charset(Create_field *sql_field,
Modifies the first column definition whose SQL type is TIMESTAMP
by adding the features DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP.
+ If the first TIMESTAMP column appears to be nullable, or to have an
+ explicit default, or to be a virtual column, then no promition is done.
+
@param column_definitions The list of column definitions, in the physical
order in which they appear in the table.
*/
@@ -3076,7 +3079,8 @@ void promote_first_timestamp_column(List<Create_field> *column_definitions)
{
if ((column_definition->flags & NOT_NULL_FLAG) != 0 && // NOT NULL,
column_definition->def == NULL && // no constant default,
- column_definition->unireg_check == Field::NONE) // no function default
+ column_definition->unireg_check == Field::NONE && // no function default
+ column_definition->vcol_info == NULL)
{
DBUG_PRINT("info", ("First TIMESTAMP column '%s' was promoted to "
"DEFAULT CURRENT_TIMESTAMP ON UPDATE "