Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
f3a49e70
Commit
f3a49e70
authored
Feb 08, 2018
by
Sergei Golubchik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Don't allow adding AS ROW START column to a not versioned table
parent
bc0ac28f
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
1 deletion
+12
-1
mysql-test/suite/versioning/r/alter.result
mysql-test/suite/versioning/r/alter.result
+2
-0
mysql-test/suite/versioning/t/alter.test
mysql-test/suite/versioning/t/alter.test
+3
-0
sql/sql_table.cc
sql/sql_table.cc
+7
-1
No files found.
mysql-test/suite/versioning/r/alter.result
View file @
f3a49e70
...
...
@@ -71,6 +71,8 @@ Table Create Table
t CREATE TABLE `t` (
`a` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
alter table t add column trx_start timestamp(6) as row start;
ERROR HY000: Table `t` is not system-versioned
alter table t add system versioning;
show create table t;
Table Create Table
...
...
mysql-test/suite/versioning/t/alter.test
View file @
f3a49e70
...
...
@@ -57,6 +57,9 @@ alter table t drop column trx_start, drop column trx_end;
alter
table
t
drop
system
versioning
;
show
create
table
t
;
--
error
ER_VERS_NOT_VERSIONED
alter
table
t
add
column
trx_start
timestamp
(
6
)
as
row
start
;
alter
table
t
add
system
versioning
;
show
create
table
t
;
...
...
sql/sql_table.cc
View file @
f3a49e70
...
...
@@ -3090,7 +3090,7 @@ void promote_first_timestamp_column(List<Create_field> *column_definitions)
column_definition
->
default_value
==
NULL
&&
// no constant default,
column_definition
->
unireg_check
==
Field
::
NONE
&&
// no function default
column_definition
->
vcol_info
==
NULL
&&
!
(
column_definition
->
flags
&
(
VERS_SYS_START_FLAG
|
VERS_SYS_END_FLAG
)
))
// column isn't generated
!
(
column_definition
->
flags
&
VERS_SYSTEM_FIELD
))
// column isn't generated
{
DBUG_PRINT
(
"info"
,
(
"First TIMESTAMP column '%s' was promoted to "
"DEFAULT CURRENT_TIMESTAMP ON UPDATE "
...
...
@@ -8079,6 +8079,12 @@ mysql_prepare_alter_table(THD *thd, TABLE *table,
alter_ctx
->
datetime_field
=
def
;
alter_ctx
->
error_if_not_empty
=
TRUE
;
}
if
(
def
->
flags
&
VERS_SYSTEM_FIELD
&&
!
(
alter_info
->
flags
&
Alter_info
::
ALTER_ADD_SYSTEM_VERSIONING
))
{
my_error
(
ER_VERS_NOT_VERSIONED
,
MYF
(
0
),
table
->
s
->
table_name
.
str
);
goto
err
;
}
if
(
!
def
->
after
.
str
)
new_create_list
.
push_back
(
def
,
thd
->
mem_root
);
else
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment