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
abba11e6
Commit
abba11e6
authored
May 19, 2017
by
Aleksey Midenkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SQL: fix fix_create_like()
parent
ec0002e9
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
32 additions
and
15 deletions
+32
-15
sql/handler.cc
sql/handler.cc
+30
-13
sql/handler.h
sql/handler.h
+1
-1
sql/sql_table.cc
sql/sql_table.cc
+1
-1
No files found.
sql/handler.cc
View file @
abba11e6
...
...
@@ -6926,28 +6926,45 @@ bool Vers_parse_info::check_and_fix_alter(THD *thd, Alter_info *alter_info,
}
bool
Vers_parse_info
::
fix_create_like
(
THD
*
thd
,
Alter_info
*
alter_info
,
HA_CREATE_INFO
*
create_info
)
HA_CREATE_INFO
*
create_info
,
TABLE_LIST
*
table
)
{
List_iterator
<
Create_field
>
it
(
alter_info
->
create_list
);
Create_field
*
f
=
NULL
;
Create_field
*
f
,
*
f_start
=
NULL
,
*
f_end
=
NULL
;
DBUG_ASSERT
(
alter_info
->
create_list
.
elements
>
2
);
for
(
uint
i
=
0
;
i
<
alter_info
->
create_list
.
elements
-
1
;
++
i
)
f
=
it
++
;
DBUG_ASSERT
(
f
->
flags
&
VERS_SYS_START_FLAG
);
if
(
create_string
(
thd
->
mem_root
,
&
generated_as_row
.
start
,
f
->
field_name
)
||
create_string
(
thd
->
mem_root
,
&
period_for_system_time
.
start
,
f
->
field_name
))
while
((
f
=
it
++
))
{
if
(
f
->
flags
&
VERS_SYS_START_FLAG
)
{
f_start
=
f
;
if
(
f_end
)
break
;
}
else
if
(
f
->
flags
&
VERS_SYS_END_FLAG
)
{
f_end
=
f
;
if
(
f_start
)
break
;
}
}
if
(
!
f_start
||
!
f_end
)
{
my_error
(
ER_VERS_WRONG_PARAMS
,
MYF
(
0
),
table
->
table_name
,
"Missed one of system versioning fields from source"
);
return
true
;
}
f
=
it
++
;
DBUG_ASSERT
(
f
->
flags
&
VERS_SYS_END_FLAG
);
if
(
create_string
(
thd
->
mem_root
,
&
generated_as_row
.
end
,
f
->
field_name
)
||
create_string
(
thd
->
mem_root
,
&
period_for_system_time
.
end
,
f
->
field_name
))
if
(
create_string
(
thd
->
mem_root
,
&
generated_as_row
.
start
,
f_start
->
field_name
)
||
create_string
(
thd
->
mem_root
,
&
period_for_system_time
.
start
,
f_start
->
field_name
)
||
create_string
(
thd
->
mem_root
,
&
generated_as_row
.
end
,
f_end
->
field_name
)
||
create_string
(
thd
->
mem_root
,
&
period_for_system_time
.
end
,
f_end
->
field_name
))
{
sql_print_error
(
"Failed to allocate memory for Vers_parse_info::fix_create_like()"
);
return
true
;
}
create_info
->
options
|=
HA_VERSIONED_TABLE
;
return
false
;
}
...
...
sql/handler.h
View file @
abba11e6
...
...
@@ -1728,7 +1728,7 @@ struct Vers_parse_info
bool
check_and_fix_alter
(
THD
*
thd
,
Alter_info
*
alter_info
,
HA_CREATE_INFO
*
create_info
,
TABLE_SHARE
*
share
);
bool
fix_create_like
(
THD
*
thd
,
Alter_info
*
alter_info
,
HA_CREATE_INFO
*
create_info
);
HA_CREATE_INFO
*
create_info
,
TABLE_LIST
*
table
);
/** User has added 'WITH SYSTEM VERSIONING' to table definition */
bool
declared_with_system_versioning
:
1
;
...
...
sql/sql_table.cc
View file @
abba11e6
...
...
@@ -5459,7 +5459,7 @@ bool mysql_create_like_table(THD* thd, TABLE_LIST* table,
if
(
src_table
->
table
->
versioned
()
&&
local_create_info
.
vers_info
.
fix_create_like
(
thd
,
&
local_alter_info
,
&
local_create_info
))
&
local_create_info
,
src_table
))
{
goto
err
;
}
...
...
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