Commit 3818bbb0 authored by unknown's avatar unknown

Adding mariadb-version on the view creation to view frm. (MDEV-6916 followup)

parent 260727ad
...@@ -5396,6 +5396,8 @@ SELECT `f1`(1); ...@@ -5396,6 +5396,8 @@ SELECT `f1`(1);
DROP FUNCTION f1; DROP FUNCTION f1;
DROP VIEW v1; DROP VIEW v1;
DROP TABLE t1, t2; DROP TABLE t1, t2;
create view v1 as select 1;
drop view v1;
# ----------------------------------------------------------------- # -----------------------------------------------------------------
# -- End of 5.5 tests. # -- End of 5.5 tests.
# ----------------------------------------------------------------- # -----------------------------------------------------------------
......
...@@ -5335,6 +5335,16 @@ DROP FUNCTION f1; ...@@ -5335,6 +5335,16 @@ DROP FUNCTION f1;
DROP VIEW v1; DROP VIEW v1;
DROP TABLE t1, t2; DROP TABLE t1, t2;
create view v1 as select 1;
--let $MYSQLD_DATADIR= `select @@datadir`
--let SEARCH_FILE= $MYSQLD_DATADIR/test/v1.frm
--let SEARCH_PATTERN=mariadb-version
--source include/search_pattern_in_file.inc
drop view v1;
--echo # ----------------------------------------------------------------- --echo # -----------------------------------------------------------------
--echo # -- End of 5.5 tests. --echo # -- End of 5.5 tests.
--echo # ----------------------------------------------------------------- --echo # -----------------------------------------------------------------
......
...@@ -730,7 +730,7 @@ bool mysql_create_view(THD *thd, TABLE_LIST *views, ...@@ -730,7 +730,7 @@ bool mysql_create_view(THD *thd, TABLE_LIST *views,
/* number of required parameters for making view */ /* number of required parameters for making view */
static const int required_view_parameters= 14; static const int required_view_parameters= 15;
/* /*
table of VIEW .frm field descriptors table of VIEW .frm field descriptors
...@@ -781,6 +781,9 @@ static File_option view_parameters[]= ...@@ -781,6 +781,9 @@ static File_option view_parameters[]=
{{(char*) STRING_WITH_LEN("view_body_utf8")}, {{(char*) STRING_WITH_LEN("view_body_utf8")},
my_offsetof(TABLE_LIST, view_body_utf8), my_offsetof(TABLE_LIST, view_body_utf8),
FILE_OPTIONS_ESTRING}, FILE_OPTIONS_ESTRING},
{{ C_STRING_WITH_LEN("mariadb-version")},
my_offsetof(TABLE_LIST, mariadb_version),
FILE_OPTIONS_ULONGLONG},
{{NullS, 0}, 0, {{NullS, 0}, 0,
FILE_OPTIONS_STRING} FILE_OPTIONS_STRING}
}; };
...@@ -877,6 +880,7 @@ static int mysql_register_view(THD *thd, TABLE_LIST *view, ...@@ -877,6 +880,7 @@ static int mysql_register_view(THD *thd, TABLE_LIST *view,
} }
view->file_version= 1; view->file_version= 1;
view->mariadb_version= MYSQL_VERSION_ID;
view->calc_md5(md5); view->calc_md5(md5);
if (!(view->md5.str= (char*) thd->memdup(md5, 32))) if (!(view->md5.str= (char*) thd->memdup(md5, 32)))
{ {
......
...@@ -1807,6 +1807,7 @@ struct TABLE_LIST ...@@ -1807,6 +1807,7 @@ struct TABLE_LIST
LEX_STRING timestamp; /* GMT time stamp of last operation */ LEX_STRING timestamp; /* GMT time stamp of last operation */
st_lex_user definer; /* definer of view */ st_lex_user definer; /* definer of view */
ulonglong file_version; /* version of file's field set */ ulonglong file_version; /* version of file's field set */
ulonglong mariadb_version; /* version of server on creation */
ulonglong updatable_view; /* VIEW can be updated */ ulonglong updatable_view; /* VIEW can be updated */
/** /**
@brief The declared algorithm, if this is a view. @brief The declared algorithm, if this is a view.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment