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
f8b62569
Commit
f8b62569
authored
Jul 15, 2017
by
Eugene Kosov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SQL: disallow ALTER CHANGE of system fields [fixes #213]
parent
909867d0
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
43 additions
and
0 deletions
+43
-0
mysql-test/suite/versioning/r/alter.result
mysql-test/suite/versioning/r/alter.result
+16
-0
mysql-test/suite/versioning/t/alter.test
mysql-test/suite/versioning/t/alter.test
+18
-0
sql/handler.cc
sql/handler.cc
+6
-0
sql/share/errmsg-utf8.txt
sql/share/errmsg-utf8.txt
+3
-0
No files found.
mysql-test/suite/versioning/r/alter.result
View file @
f8b62569
...
@@ -495,6 +495,22 @@ alter table t without system versioning, algorithm=inplace;
...
@@ -495,6 +495,22 @@ alter table t without system versioning, algorithm=inplace;
select * from t;
select * from t;
a b
a b
2 NULL
2 NULL
create or replace table t (
a int,
sys_trx_start bigint(20) unsigned generated always as row start,
sys_trx_end bigint(20) unsigned generated always as row end,
period for system_time(sys_trx_start, sys_trx_end)
) with system versioning engine innodb;
alter table t change column sys_trx_start asdf bigint unsigned;
ERROR HY000: Can not change system versioning field 'sys_trx_start'
create or replace table t (
a int,
sys_trx_start timestamp(6) generated always as row start,
sys_trx_end timestamp(6) generated always as row end,
period for system_time(sys_trx_start, sys_trx_end)
) with system versioning engine myisam;
alter table t change column sys_trx_start asdf timestamp(6);
ERROR HY000: Can not change system versioning field 'sys_trx_start'
call verify_vtq;
call verify_vtq;
No A B C D
No A B C D
1 1 1 1 1
1 1 1 1 1
...
...
mysql-test/suite/versioning/t/alter.test
View file @
f8b62569
...
@@ -220,6 +220,24 @@ select * from t for system_time all;
...
@@ -220,6 +220,24 @@ select * from t for system_time all;
alter
table
t
without
system
versioning
,
algorithm
=
inplace
;
alter
table
t
without
system
versioning
,
algorithm
=
inplace
;
select
*
from
t
;
select
*
from
t
;
create
or
replace
table
t
(
a
int
,
sys_trx_start
bigint
(
20
)
unsigned
generated
always
as
row
start
,
sys_trx_end
bigint
(
20
)
unsigned
generated
always
as
row
end
,
period
for
system_time
(
sys_trx_start
,
sys_trx_end
)
)
with
system
versioning
engine
innodb
;
--
error
ER_VERS_ALTER_SYSTEM_FIELD
alter
table
t
change
column
sys_trx_start
asdf
bigint
unsigned
;
create
or
replace
table
t
(
a
int
,
sys_trx_start
timestamp
(
6
)
generated
always
as
row
start
,
sys_trx_end
timestamp
(
6
)
generated
always
as
row
end
,
period
for
system_time
(
sys_trx_start
,
sys_trx_end
)
)
with
system
versioning
engine
myisam
;
--
error
ER_VERS_ALTER_SYSTEM_FIELD
alter
table
t
change
column
sys_trx_start
asdf
timestamp
(
6
);
call
verify_vtq
;
call
verify_vtq
;
drop
table
t
;
drop
table
t
;
...
...
sql/handler.cc
View file @
f8b62569
...
@@ -6869,6 +6869,12 @@ bool Vers_parse_info::check_and_fix_alter(THD *thd, Alter_info *alter_info,
...
@@ -6869,6 +6869,12 @@ bool Vers_parse_info::check_and_fix_alter(THD *thd, Alter_info *alter_info,
{
{
if
(
f
->
versioning
==
Column_definition
::
WITHOUT_VERSIONING
)
if
(
f
->
versioning
==
Column_definition
::
WITHOUT_VERSIONING
)
f
->
flags
|=
VERS_OPTIMIZED_UPDATE_FLAG
;
f
->
flags
|=
VERS_OPTIMIZED_UPDATE_FLAG
;
if
(
f
->
change
&&
(
!
strcmp
(
f
->
change
,
start
)
||
!
strcmp
(
f
->
change
,
end
)))
{
my_error
(
ER_VERS_ALTER_SYSTEM_FIELD
,
MYF
(
0
),
f
->
change
);
return
true
;
}
}
}
}
}
...
...
sql/share/errmsg-utf8.txt
View file @
f8b62569
...
@@ -7591,3 +7591,6 @@ ER_VERS_HISTORY_LOCK
...
@@ -7591,3 +7591,6 @@ ER_VERS_HISTORY_LOCK
ER_WRONG_TABLESPACE_NAME 42000
ER_WRONG_TABLESPACE_NAME 42000
eng "Incorrect tablespace name `%-.192s`"
eng "Incorrect tablespace name `%-.192s`"
ER_VERS_ALTER_SYSTEM_FIELD
eng "Can not change system versioning field '%s'"
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