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
1903b407
Commit
1903b407
authored
Jul 04, 2017
by
Eugene Kosov
Committed by
GitHub
Jul 04, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SQL: ignore columns WITHOUT VERSIONING [fixes #220]
parent
bdcce58f
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
45 additions
and
45 deletions
+45
-45
mysql-test/suite/versioning/r/create.result
mysql-test/suite/versioning/r/create.result
+0
-2
mysql-test/suite/versioning/t/create.test
mysql-test/suite/versioning/t/create.test
+0
-2
sql/handler.cc
sql/handler.cc
+30
-24
sql/handler.h
sql/handler.h
+8
-8
sql/sql_table.cc
sql/sql_table.cc
+3
-3
sql/sql_yacc.yy
sql/sql_yacc.yy
+2
-2
sql/unireg.cc
sql/unireg.cc
+2
-4
No files found.
mysql-test/suite/versioning/r/create.result
View file @
1903b407
...
...
@@ -211,7 +211,6 @@ create or replace table t1 (
A3 int,
B int without system versioning
);
ERROR HY000: Wrong parameters for `t1`: missing 'WITH SYSTEM VERSIONING'
create or replace table t1 (
A4 int,
B int without system versioning
...
...
@@ -254,7 +253,6 @@ t1 CREATE TABLE `t1` (
create or replace table t1 (
A7 int without system versioning
);
ERROR HY000: Wrong parameters for `t1`: missing 'WITH SYSTEM VERSIONING'
create or replace table t1 (
A8 int without system versioning
) with system versioning;
...
...
mysql-test/suite/versioning/t/create.test
View file @
1903b407
...
...
@@ -157,7 +157,6 @@ create or replace table t1 (
--
replace_result
InnoDB
INNODB_OR_MYISAM
MyISAM
INNODB_OR_MYISAM
"bigint(20) unsigned"
SYS_TRX_TYPE
timestamp
(
6
)
SYS_TRX_TYPE
show
create
table
t1
;
--
error
ER_VERS_WRONG_PARAMS
create
or
replace
table
t1
(
A3
int
,
B
int
without
system
versioning
...
...
@@ -184,7 +183,6 @@ create or replace table t1 (
--
replace_result
InnoDB
INNODB_OR_MYISAM
MyISAM
INNODB_OR_MYISAM
"bigint(20) unsigned"
SYS_TRX_TYPE
timestamp
(
6
)
SYS_TRX_TYPE
show
create
table
t1
;
--
error
ER_VERS_WRONG_PARAMS
create
or
replace
table
t1
(
A7
int
without
system
versioning
);
...
...
sql/handler.cc
View file @
1903b407
...
...
@@ -6584,12 +6584,12 @@ int del_global_index_stat(THD *thd, TABLE* table, KEY* key_info)
bool
Vers_parse_info
::
is_trx_start
(
const
char
*
name
)
const
{
DBUG_ASSERT
(
name
);
return
generated_as_row
.
start
&&
generated_
as_row
.
start
==
LString_i
(
name
);
return
as_row
.
start
&&
as_row
.
start
==
LString_i
(
name
);
}
bool
Vers_parse_info
::
is_trx_end
(
const
char
*
name
)
const
{
DBUG_ASSERT
(
name
);
return
generated_as_row
.
end
&&
generated_
as_row
.
end
==
LString_i
(
name
);
return
as_row
.
end
&&
as_row
.
end
==
LString_i
(
name
);
}
bool
Vers_parse_info
::
is_trx_start
(
const
Create_field
&
f
)
const
{
...
...
@@ -6638,8 +6638,7 @@ bool Vers_parse_info::fix_implicit(THD *thd, Alter_info *alter_info,
bool
integer_fields
)
{
// If user specified some of these he must specify the others too. Do nothing.
if
(
generated_as_row
.
start
||
generated_as_row
.
end
||
period_for_system_time
.
start
||
period_for_system_time
.
end
)
if
(
as_row
.
start
||
as_row
.
end
||
system_time
.
start
||
system_time
.
end
)
return
false
;
alter_info
->
flags
|=
Alter_info
::
ALTER_ADD_COLUMN
;
...
...
@@ -6647,8 +6646,8 @@ bool Vers_parse_info::fix_implicit(THD *thd, Alter_info *alter_info,
static
const
LString
sys_trx_start
=
"sys_trx_start"
;
static
const
LString
sys_trx_end
=
"sys_trx_end"
;
period_for_
system_time
=
start_end_t
(
sys_trx_start
,
sys_trx_end
);
generated_as_row
=
period_for_
system_time
;
system_time
=
start_end_t
(
sys_trx_start
,
sys_trx_end
);
as_row
=
system_time
;
return
vers_create_sys_field
(
thd
,
sys_trx_start
,
alter_info
,
VERS_SYS_START_FLAG
,
...
...
@@ -6703,6 +6702,13 @@ bool Vers_parse_info::check_and_fix_implicit(
if
(
!
need_check
())
return
false
;
if
(
!
versioned_fields
&&
unversioned_fields
&&
!
with_system_versioning
)
{
// All is correct but this table is not versioned.
create_info
->
options
&=
~
HA_VERSIONED_TABLE
;
return
false
;
}
if
(
without_system_versioning
)
{
my_error_as
(
ER_VERS_WRONG_PARAMS
,
ER_NOT_ALLOWED
,
MYF
(
0
),
table_name
,
...
...
@@ -6710,7 +6716,8 @@ bool Vers_parse_info::check_and_fix_implicit(
return
true
;
}
if
(
!
with_system_versioning
&&
!
versioned_fields
)
if
((
system_time
.
start
||
system_time
.
end
||
as_row
.
start
||
as_row
.
end
)
&&
!
with_system_versioning
)
{
my_error_as
(
ER_VERS_WRONG_PARAMS
,
ER_MISSING
,
MYF
(
0
),
table_name
,
"WITH SYSTEM VERSIONING"
);
...
...
@@ -6723,7 +6730,7 @@ bool Vers_parse_info::check_and_fix_implicit(
{
if
(
is_trx_start
(
*
f
))
{
if
(
!
generated_
as_row
.
start
)
// not inited in CREATE ... SELECT
if
(
!
as_row
.
start
)
// not inited in CREATE ... SELECT
{
DBUG_ASSERT
(
vers_tables
>
0
);
if
(
orig_table
&&
orig_table
!=
f
->
field
->
orig_table
)
...
...
@@ -6733,14 +6740,14 @@ bool Vers_parse_info::check_and_fix_implicit(
return
true
;
}
orig_table
=
f
->
field
->
orig_table
;
generated_
as_row
.
start
=
f
->
field_name
;
period_for_system_time
.
start
=
generated_
as_row
.
start
;
as_row
.
start
=
f
->
field_name
;
system_time
.
start
=
as_row
.
start
;
}
continue
;
}
if
(
is_trx_end
(
*
f
))
{
if
(
!
generated_
as_row
.
end
)
if
(
!
as_row
.
end
)
{
DBUG_ASSERT
(
vers_tables
>
0
);
if
(
orig_table
&&
orig_table
!=
f
->
field
->
orig_table
)
...
...
@@ -6748,8 +6755,8 @@ bool Vers_parse_info::check_and_fix_implicit(
goto
err_different_tables
;
}
orig_table
=
f
->
field
->
orig_table
;
generated_
as_row
.
end
=
f
->
field_name
;
period_for_system_time
.
end
=
generated_
as_row
.
end
;
as_row
.
end
=
f
->
field_name
;
system_time
.
end
=
as_row
.
end
;
}
continue
;
}
...
...
@@ -6782,8 +6789,7 @@ bool Vers_parse_info::check_and_fix_implicit(
}
bool
table_with_system_versioning
=
generated_as_row
.
start
||
generated_as_row
.
end
||
period_for_system_time
.
start
||
period_for_system_time
.
end
;
as_row
.
start
||
as_row
.
end
||
system_time
.
start
||
system_time
.
end
;
if
(
!
thd
->
lex
->
tmp_table
()
&&
// CREATE from SELECT (Create_fields are not yet added)
...
...
@@ -6853,8 +6859,8 @@ bool Vers_parse_info::check_and_fix_alter(THD *thd, Alter_info *alter_info,
const
char
*
end
=
share
->
vers_end_field
()
->
field_name
;
DBUG_ASSERT
(
start
&&
end
);
generated_
as_row
=
start_end_t
(
start
,
end
);
period_for_system_time
=
generated_
as_row
;
as_row
=
start_end_t
(
start
,
end
);
system_time
=
as_row
;
if
(
alter_info
->
create_list
.
elements
)
{
...
...
@@ -6945,8 +6951,8 @@ bool Vers_parse_info::fix_create_like(THD *thd, Alter_info *alter_info,
return
true
;
}
generated_
as_row
=
start_end_t
(
f_start
->
field_name
,
f_end
->
field_name
);
period_for_system_time
=
generated_
as_row
;
as_row
=
start_end_t
(
f_start
->
field_name
,
f_end
->
field_name
);
system_time
=
as_row
;
create_info
->
options
|=
HA_VERSIONED_TABLE
;
return
false
;
...
...
@@ -6955,28 +6961,28 @@ bool Vers_parse_info::fix_create_like(THD *thd, Alter_info *alter_info,
bool
Vers_parse_info
::
check_with_conditions
(
const
char
*
table_name
)
const
{
if
(
!
generated_as_row
.
start
||
!
generated_
as_row
.
end
)
if
(
!
as_row
.
start
||
!
as_row
.
end
)
{
my_error_as
(
ER_VERS_WRONG_PARAMS
,
ER_MISSING
,
MYF
(
0
),
table_name
,
generated_
as_row
.
start
?
"AS ROW END"
:
"AS ROW START"
);
as_row
.
start
?
"AS ROW END"
:
"AS ROW START"
);
return
true
;
}
if
(
!
period_for_system_time
.
start
||
!
period_for_
system_time
.
end
)
if
(
!
system_time
.
start
||
!
system_time
.
end
)
{
my_error_as
(
ER_VERS_WRONG_PARAMS
,
ER_MISSING
,
MYF
(
0
),
table_name
,
"PERIOD FOR SYSTEM_TIME"
);
return
true
;
}
if
(
generated_as_row
.
start
!=
period_for_
system_time
.
start
)
if
(
as_row
.
start
!=
system_time
.
start
)
{
my_error_as
(
ER_VERS_WRONG_PARAMS
,
ER_MISMATCH
,
MYF
(
0
),
table_name
,
"PERIOD FOR SYSTEM_TIME"
,
"AS ROW START"
);
return
true
;
}
if
(
generated_as_row
.
end
!=
period_for_
system_time
.
end
)
if
(
as_row
.
end
!=
system_time
.
end
)
{
my_error_as
(
ER_VERS_WRONG_PARAMS
,
ER_MISMATCH
,
MYF
(
0
),
table_name
,
"PERIOD FOR SYSTEM_TIME"
,
"AS ROW END"
);
...
...
sql/handler.h
View file @
1903b407
...
...
@@ -1694,13 +1694,13 @@ struct Vers_parse_info
LString_i
end
;
};
start_end_t
period_for_
system_time
;
start_end_t
generated_
as_row
;
start_end_t
system_time
;
start_end_t
as_row
;
void
set_period_for_system_time
(
LString
start
,
LString
end
)
{
period_for_
system_time
.
start
=
start
;
period_for_
system_time
.
end
=
end
;
system_time
.
start
=
start
;
system_time
.
end
=
end
;
}
private:
...
...
@@ -1716,10 +1716,10 @@ struct Vers_parse_info
unversioned_fields
||
with_system_versioning
||
without_system_versioning
||
period_for_system_time
.
start
.
str
||
period_for_system_time
.
end
.
str
||
generated_as_row
.
start
.
str
||
generated_as_row
.
end
.
str
;
system_time
.
start
||
system_time
.
end
||
as_row
.
start
||
as_row
.
end
;
}
bool
check_with_conditions
(
const
char
*
table_name
)
const
;
bool
check_generated_type
(
const
char
*
table_name
,
Alter_info
*
alter_info
,
...
...
sql/sql_table.cc
View file @
1903b407
...
...
@@ -4326,9 +4326,9 @@ vers_prepare_keys(THD *thd,
{
DBUG_ASSERT
(
create_info
->
versioned
());
const
char
*
row_start_field
=
create_info
->
vers_info
.
generated_
as_row
.
start
;
const
char
*
row_start_field
=
create_info
->
vers_info
.
as_row
.
start
;
DBUG_ASSERT
(
row_start_field
);
const
char
*
row_end_field
=
create_info
->
vers_info
.
generated_
as_row
.
end
;
const
char
*
row_end_field
=
create_info
->
vers_info
.
as_row
.
end
;
DBUG_ASSERT
(
row_end_field
);
List_iterator
<
Key
>
key_it
(
alter_info
->
key_list
);
...
...
@@ -4355,7 +4355,7 @@ vers_prepare_keys(THD *thd,
continue
;
// Key already contains Sys_start or Sys_end
Key_part_spec
*
key_part_sys_end_col
=
new
(
thd
->
mem_root
)
Key_part_spec
(
create_info
->
vers_info
.
generated_
as_row
.
end
,
0
);
new
(
thd
->
mem_root
)
Key_part_spec
(
create_info
->
vers_info
.
as_row
.
end
,
0
);
key
->
columns
.
push_back
(
key_part_sys_end_col
);
}
...
...
sql/sql_yacc.yy
View file @
1903b407
...
...
@@ -6305,12 +6305,12 @@ field_def:
switch ($4)
{
case 1:
p= &info.
generated_
as_row.start;
p= &info.as_row.start;
clause= "AS ROW START";
lex->last_field->flags|= VERS_SYS_START_FLAG;
break;
case 0:
p= &info.
generated_
as_row.end;
p= &info.as_row.end;
clause= "AS ROW END";
lex->last_field->flags|= VERS_SYS_END_FLAG;
break;
...
...
sql/unireg.cc
View file @
1903b407
...
...
@@ -99,10 +99,8 @@ vers_get_field(HA_CREATE_INFO *create_info, List<Create_field> &create_fields, b
List_iterator
<
Create_field
>
it
(
create_fields
);
Create_field
*
sql_field
=
NULL
;
const
char
*
row_field
=
row_start
?
create_info
->
vers_info
.
generated_as_row
.
start
:
create_info
->
vers_info
.
generated_as_row
.
end
;
const
char
*
row_field
=
row_start
?
create_info
->
vers_info
.
as_row
.
start
:
create_info
->
vers_info
.
as_row
.
end
;
DBUG_ASSERT
(
row_field
);
for
(
unsigned
field_no
=
0
;
(
sql_field
=
it
++
);
++
field_no
)
...
...
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