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
8ba06032
Commit
8ba06032
authored
Dec 19, 2017
by
Eugene Kosov
Committed by
GitHub
Dec 19, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MDEV-14684 Assertion `table' failed in mysql_delete
SQL: disable TRUNCATE table_name TO statement for VIEWs
parent
04bed58a
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
37 additions
and
1 deletion
+37
-1
mysql-test/suite/versioning/r/truncate.result
mysql-test/suite/versioning/r/truncate.result
+12
-0
mysql-test/suite/versioning/t/truncate.test
mysql-test/suite/versioning/t/truncate.test
+14
-0
sql/share/errmsg-utf8.txt
sql/share/errmsg-utf8.txt
+3
-0
sql/sql_delete.cc
sql/sql_delete.cc
+8
-1
No files found.
mysql-test/suite/versioning/r/truncate.result
View file @
8ba06032
...
...
@@ -43,4 +43,16 @@ partition p0 history,
partition pn current);
truncate table t to system_time current_timestamp;
ERROR 42000: The used command is not allowed with this MariaDB version
create or replace table t (i int) with system versioning;
truncate t to system_time now();
create or replace view v as select * from t;
truncate v to system_time now();
ERROR HY000: TRUNCATE table_name TO doesn't work with VIEWs
create or replace table t (i int);
truncate t to system_time now();
ERROR HY000: System versioning required: t
create or replace view v as select * from t;
truncate v to system_time now();
ERROR HY000: TRUNCATE table_name TO doesn't work with VIEWs
drop table t;
drop view v;
mysql-test/suite/versioning/t/truncate.test
View file @
8ba06032
...
...
@@ -40,4 +40,18 @@ partition by system_time (
--
error
ER_NOT_ALLOWED_COMMAND
truncate
table
t
to
system_time
current_timestamp
;
create
or
replace
table
t
(
i
int
)
with
system
versioning
;
truncate
t
to
system_time
now
();
create
or
replace
view
v
as
select
*
from
t
;
--
error
ER_VERS_TRUNCATE_TO_VIEW
truncate
v
to
system_time
now
();
create
or
replace
table
t
(
i
int
);
--
error
ER_VERSIONING_REQUIRED
truncate
t
to
system_time
now
();
create
or
replace
view
v
as
select
*
from
t
;
--
error
ER_VERS_TRUNCATE_TO_VIEW
truncate
v
to
system_time
now
();
drop
table
t
;
drop
view
v
;
sql/share/errmsg-utf8.txt
View file @
8ba06032
...
...
@@ -7931,3 +7931,6 @@ ER_VERS_ALREADY_VERSIONED
WARN_VERS_TRT_EXPERIMENTAL
eng "Transaction-based system versioning is EXPERIMENTAL and is subject to change in future."
ER_VERS_TRUNCATE_TO_VIEW
eng "TRUNCATE table_name TO doesn't work with VIEWs"
sql/sql_delete.cc
View file @
8ba06032
...
...
@@ -312,6 +312,12 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds,
bool
truncate_history
=
table_list
->
vers_conditions
;
if
(
truncate_history
)
{
if
(
table_list
->
is_view_or_derived
())
{
my_error
(
ER_VERS_TRUNCATE_TO_VIEW
,
MYF
(
0
));
DBUG_RETURN
(
true
);
}
TABLE
*
table
=
table_list
->
table
;
DBUG_ASSERT
(
table
);
...
...
@@ -328,7 +334,8 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds,
DBUG_RETURN
(
TRUE
);
// trx_sees() in InnoDB reads sys_trx_start
if
(
!
table
->
versioned
(
VERS_TIMESTAMP
))
{
if
(
!
table
->
versioned
(
VERS_TIMESTAMP
))
{
DBUG_ASSERT
(
table_list
->
vers_conditions
.
type
==
SYSTEM_TIME_BEFORE
);
bitmap_set_bit
(
table
->
read_set
,
table
->
vers_end_field
()
->
field_index
);
}
...
...
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