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
66744f45
Commit
66744f45
authored
Jan 14, 2017
by
Vicențiu Ciorbaru
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch '5.5' into 10.0
parents
939d1255
20ca1bcf
Changes
12
Show whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
58 additions
and
38 deletions
+58
-38
mysql-test/suite/vcol/inc/vcol_trigger_sp.inc
mysql-test/suite/vcol/inc/vcol_trigger_sp.inc
+8
-1
mysql-test/suite/vcol/r/vcol_misc.result
mysql-test/suite/vcol/r/vcol_misc.result
+7
-0
mysql-test/suite/vcol/r/vcol_trigger_sp_innodb.result
mysql-test/suite/vcol/r/vcol_trigger_sp_innodb.result
+7
-1
mysql-test/suite/vcol/r/vcol_trigger_sp_myisam.result
mysql-test/suite/vcol/r/vcol_trigger_sp_myisam.result
+7
-1
mysql-test/suite/vcol/t/vcol_misc.test
mysql-test/suite/vcol/t/vcol_misc.test
+11
-0
sql/sql_base.cc
sql/sql_base.cc
+4
-12
sql/sql_delete.cc
sql/sql_delete.cc
+1
-4
sql/sql_table.cc
sql/sql_table.cc
+1
-1
sql/sql_trigger.cc
sql/sql_trigger.cc
+3
-0
sql/sql_update.cc
sql/sql_update.cc
+3
-8
sql/table.cc
sql/table.cc
+5
-8
sql/table.h
sql/table.h
+1
-2
No files found.
mysql-test/suite/vcol/inc/vcol_trigger_sp.inc
View file @
66744f45
...
@@ -110,7 +110,7 @@ drop table t1,t2;
...
@@ -110,7 +110,7 @@ drop table t1,t2;
drop
procedure
p1
;
drop
procedure
p1
;
--
echo
#
--
echo
#
--
echo
#
Bug mdev-3845:
values of virtual columns are not computed for triggers
--
echo
#
MDEV-3845
values of virtual columns are not computed for triggers
--
echo
#
--
echo
#
CREATE
TABLE
t1
(
CREATE
TABLE
t1
(
...
@@ -149,3 +149,10 @@ DROP TRIGGER t1_ins_aft;
...
@@ -149,3 +149,10 @@ DROP TRIGGER t1_ins_aft;
DROP
TRIGGER
t1_del_bef
;
DROP
TRIGGER
t1_del_bef
;
DROP
TABLE
t1
,
t2
;
DROP
TABLE
t1
,
t2
;
#
# MDEV-11706 Assertion `is_stat_field || !table || (!table->write_set || bitmap_is_set(table->write_set, field_index) || (table->vcol_set && bitmap_is_set(table->vcol_set, field_index)))' failed in Field_time::store_TIME_with_warning
#
create
table
t1
(
i
int
,
t
time
not
null
,
vt
time
(
4
)
as
(
t
)
virtual
);
create
trigger
trg
before
update
on
t1
for
each
row
set
@
a
=
1
;
insert
ignore
into
t1
(
i
)
values
(
1
);
drop
table
t1
;
mysql-test/suite/vcol/r/vcol_misc.result
View file @
66744f45
...
@@ -330,3 +330,10 @@ t1 CREATE TABLE `t1` (
...
@@ -330,3 +330,10 @@ t1 CREATE TABLE `t1` (
`c1` varchar(50) COLLATE latin1_general_ci DEFAULT NULL
`c1` varchar(50) COLLATE latin1_general_ci DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci
drop table t1;
drop table t1;
set sql_mode='no_zero_date';
create table t1 (
ts timestamp not null default current_timestamp,
tsv timestamp as (adddate(ts, interval 1 day)) virtual
);
drop table t1;
set sql_mode=default;
mysql-test/suite/vcol/r/vcol_trigger_sp_innodb.result
View file @
66744f45
...
@@ -86,7 +86,7 @@ a b c
...
@@ -86,7 +86,7 @@ a b c
drop table t1,t2;
drop table t1,t2;
drop procedure p1;
drop procedure p1;
#
#
#
Bug mdev-3845:
values of virtual columns are not computed for triggers
#
MDEV-3845
values of virtual columns are not computed for triggers
#
#
CREATE TABLE t1 (
CREATE TABLE t1 (
a INTEGER UNSIGNED NULL DEFAULT NULL,
a INTEGER UNSIGNED NULL DEFAULT NULL,
...
@@ -125,3 +125,9 @@ c
...
@@ -125,3 +125,9 @@ c
DROP TRIGGER t1_ins_aft;
DROP TRIGGER t1_ins_aft;
DROP TRIGGER t1_del_bef;
DROP TRIGGER t1_del_bef;
DROP TABLE t1,t2;
DROP TABLE t1,t2;
create table t1 (i int, t time not null, vt time(4) as (t) virtual);
create trigger trg before update on t1 for each row set @a = 1;
insert ignore into t1 (i) values (1);
Warnings:
Warning 1364 Field 't' doesn't have a default value
drop table t1;
mysql-test/suite/vcol/r/vcol_trigger_sp_myisam.result
View file @
66744f45
...
@@ -86,7 +86,7 @@ a b c
...
@@ -86,7 +86,7 @@ a b c
drop table t1,t2;
drop table t1,t2;
drop procedure p1;
drop procedure p1;
#
#
#
Bug mdev-3845:
values of virtual columns are not computed for triggers
#
MDEV-3845
values of virtual columns are not computed for triggers
#
#
CREATE TABLE t1 (
CREATE TABLE t1 (
a INTEGER UNSIGNED NULL DEFAULT NULL,
a INTEGER UNSIGNED NULL DEFAULT NULL,
...
@@ -125,3 +125,9 @@ c
...
@@ -125,3 +125,9 @@ c
DROP TRIGGER t1_ins_aft;
DROP TRIGGER t1_ins_aft;
DROP TRIGGER t1_del_bef;
DROP TRIGGER t1_del_bef;
DROP TABLE t1,t2;
DROP TABLE t1,t2;
create table t1 (i int, t time not null, vt time(4) as (t) virtual);
create trigger trg before update on t1 for each row set @a = 1;
insert ignore into t1 (i) values (1);
Warnings:
Warning 1364 Field 't' doesn't have a default value
drop table t1;
mysql-test/suite/vcol/t/vcol_misc.test
View file @
66744f45
...
@@ -290,3 +290,14 @@ create table t1 (a int, b int as (b is null) virtual);
...
@@ -290,3 +290,14 @@ create table t1 (a int, b int as (b is null) virtual);
create
table
t1
(
v1
varchar
(
255
)
as
(
c1
)
persistent
,
c1
varchar
(
50
))
collate
=
latin1_general_ci
;
create
table
t1
(
v1
varchar
(
255
)
as
(
c1
)
persistent
,
c1
varchar
(
50
))
collate
=
latin1_general_ci
;
show
create
table
t1
;
show
create
table
t1
;
drop
table
t1
;
drop
table
t1
;
#
# MDEV-11527 Virtual columns do not get along well with NO_ZERO_DATE
#
set
sql_mode
=
'no_zero_date'
;
create
table
t1
(
ts
timestamp
not
null
default
current_timestamp
,
tsv
timestamp
as
(
adddate
(
ts
,
interval
1
day
))
virtual
);
drop
table
t1
;
set
sql_mode
=
default
;
sql/sql_base.cc
View file @
66744f45
...
@@ -8714,9 +8714,7 @@ fill_record(THD * thd, TABLE *table_arg, List<Item> &fields, List<Item> &values,
...
@@ -8714,9 +8714,7 @@ fill_record(THD * thd, TABLE *table_arg, List<Item> &fields, List<Item> &values,
/* Update virtual fields*/
/* Update virtual fields*/
thd
->
abort_on_warning
=
FALSE
;
thd
->
abort_on_warning
=
FALSE
;
if
(
vcol_table
&&
vcol_table
->
vfield
&&
if
(
vcol_table
&&
vcol_table
->
vfield
&&
update_virtual_fields
(
thd
,
vcol_table
,
update_virtual_fields
(
thd
,
vcol_table
,
VCOL_UPDATE_FOR_WRITE
))
vcol_table
->
triggers
?
VCOL_UPDATE_ALL
:
VCOL_UPDATE_FOR_WRITE
))
goto
err
;
goto
err
;
thd
->
abort_on_warning
=
save_abort_on_warning
;
thd
->
abort_on_warning
=
save_abort_on_warning
;
thd
->
no_errors
=
save_no_errors
;
thd
->
no_errors
=
save_no_errors
;
...
@@ -8777,9 +8775,7 @@ fill_record_n_invoke_before_triggers(THD *thd, TABLE *table, List<Item> &fields,
...
@@ -8777,9 +8775,7 @@ fill_record_n_invoke_before_triggers(THD *thd, TABLE *table, List<Item> &fields,
if
(
item_field
&&
item_field
->
field
&&
table
&&
table
->
vfield
)
if
(
item_field
&&
item_field
->
field
&&
table
&&
table
->
vfield
)
{
{
DBUG_ASSERT
(
table
==
item_field
->
field
->
table
);
DBUG_ASSERT
(
table
==
item_field
->
field
->
table
);
result
=
update_virtual_fields
(
thd
,
table
,
result
=
update_virtual_fields
(
thd
,
table
,
VCOL_UPDATE_FOR_WRITE
);
table
->
triggers
?
VCOL_UPDATE_ALL
:
VCOL_UPDATE_FOR_WRITE
);
}
}
}
}
}
}
...
@@ -8864,9 +8860,7 @@ fill_record(THD *thd, TABLE *table, Field **ptr, List<Item> &values,
...
@@ -8864,9 +8860,7 @@ fill_record(THD *thd, TABLE *table, Field **ptr, List<Item> &values,
/* Update virtual fields*/
/* Update virtual fields*/
thd
->
abort_on_warning
=
FALSE
;
thd
->
abort_on_warning
=
FALSE
;
if
(
table
->
vfield
&&
if
(
table
->
vfield
&&
update_virtual_fields
(
thd
,
table
,
update_virtual_fields
(
thd
,
table
,
VCOL_UPDATE_FOR_WRITE
))
table
->
triggers
?
VCOL_UPDATE_ALL
:
VCOL_UPDATE_FOR_WRITE
))
goto
err
;
goto
err
;
thd
->
abort_on_warning
=
abort_on_warning_saved
;
thd
->
abort_on_warning
=
abort_on_warning_saved
;
DBUG_RETURN
(
thd
->
is_error
());
DBUG_RETURN
(
thd
->
is_error
());
...
@@ -8917,9 +8911,7 @@ fill_record_n_invoke_before_triggers(THD *thd, TABLE *table, Field **ptr,
...
@@ -8917,9 +8911,7 @@ fill_record_n_invoke_before_triggers(THD *thd, TABLE *table, Field **ptr,
{
{
DBUG_ASSERT
(
table
==
(
*
ptr
)
->
table
);
DBUG_ASSERT
(
table
==
(
*
ptr
)
->
table
);
if
(
table
->
vfield
)
if
(
table
->
vfield
)
result
=
update_virtual_fields
(
thd
,
table
,
result
=
update_virtual_fields
(
thd
,
table
,
VCOL_UPDATE_FOR_WRITE
);
table
->
triggers
?
VCOL_UPDATE_ALL
:
VCOL_UPDATE_FOR_WRITE
);
}
}
return
result
;
return
result
;
...
...
sql/sql_delete.cc
View file @
66744f45
...
@@ -548,9 +548,7 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds,
...
@@ -548,9 +548,7 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds,
!
thd
->
is_error
())
!
thd
->
is_error
())
{
{
if
(
table
->
vfield
)
if
(
table
->
vfield
)
update_virtual_fields
(
thd
,
table
,
update_virtual_fields
(
thd
,
table
,
VCOL_UPDATE_FOR_READ
);
table
->
triggers
?
VCOL_UPDATE_ALL
:
VCOL_UPDATE_FOR_READ
);
thd
->
inc_examined_row_count
(
1
);
thd
->
inc_examined_row_count
(
1
);
// thd->is_error() is tested to disallow delete row on error
// thd->is_error() is tested to disallow delete row on error
if
(
!
select
||
select
->
skip_record
(
thd
)
>
0
)
if
(
!
select
||
select
->
skip_record
(
thd
)
>
0
)
...
@@ -1297,4 +1295,3 @@ bool multi_delete::send_eof()
...
@@ -1297,4 +1295,3 @@ bool multi_delete::send_eof()
}
}
return
0
;
return
0
;
}
}
sql/sql_table.cc
View file @
66744f45
...
@@ -4149,7 +4149,7 @@ mysql_prepare_create_table(THD *thd, HA_CREATE_INFO *create_info,
...
@@ -4149,7 +4149,7 @@ mysql_prepare_create_table(THD *thd, HA_CREATE_INFO *create_info,
Field
::
utype
type
=
(
Field
::
utype
)
MTYP_TYPENR
(
sql_field
->
unireg_check
);
Field
::
utype
type
=
(
Field
::
utype
)
MTYP_TYPENR
(
sql_field
->
unireg_check
);
if
(
thd
->
variables
.
sql_mode
&
MODE_NO_ZERO_DATE
&&
if
(
thd
->
variables
.
sql_mode
&
MODE_NO_ZERO_DATE
&&
!
sql_field
->
def
&&
!
sql_field
->
def
&&
!
sql_field
->
vcol_info
&&
is_timestamp_type
(
sql_field
->
sql_type
)
&&
is_timestamp_type
(
sql_field
->
sql_type
)
&&
(
sql_field
->
flags
&
NOT_NULL_FLAG
)
&&
(
sql_field
->
flags
&
NOT_NULL_FLAG
)
&&
(
type
==
Field
::
NONE
||
type
==
Field
::
TIMESTAMP_UN_FIELD
))
(
type
==
Field
::
NONE
||
type
==
Field
::
TIMESTAMP_UN_FIELD
))
...
...
sql/sql_trigger.cc
View file @
66744f45
...
@@ -2224,6 +2224,9 @@ void Table_triggers_list::mark_fields_used(trg_event_type event)
...
@@ -2224,6 +2224,9 @@ void Table_triggers_list::mark_fields_used(trg_event_type event)
bitmap_set_bit
(
trigger_table
->
read_set
,
trg_field
->
field_idx
);
bitmap_set_bit
(
trigger_table
->
read_set
,
trg_field
->
field_idx
);
if
(
trg_field
->
get_settable_routine_parameter
())
if
(
trg_field
->
get_settable_routine_parameter
())
bitmap_set_bit
(
trigger_table
->
write_set
,
trg_field
->
field_idx
);
bitmap_set_bit
(
trigger_table
->
write_set
,
trg_field
->
field_idx
);
if
(
trigger_table
->
field
[
trg_field
->
field_idx
]
->
vcol_info
)
trigger_table
->
mark_virtual_col
(
trigger_table
->
field
[
trg_field
->
field_idx
]);
}
}
}
}
}
}
...
...
sql/sql_update.cc
View file @
66744f45
...
@@ -629,9 +629,7 @@ int mysql_update(THD *thd,
...
@@ -629,9 +629,7 @@ int mysql_update(THD *thd,
while
(
!
(
error
=
info
.
read_record
(
&
info
))
&&
!
thd
->
killed
)
while
(
!
(
error
=
info
.
read_record
(
&
info
))
&&
!
thd
->
killed
)
{
{
if
(
table
->
vfield
)
if
(
table
->
vfield
)
update_virtual_fields
(
thd
,
table
,
update_virtual_fields
(
thd
,
table
,
VCOL_UPDATE_FOR_READ
);
table
->
triggers
?
VCOL_UPDATE_ALL
:
VCOL_UPDATE_FOR_READ
);
thd
->
inc_examined_row_count
(
1
);
thd
->
inc_examined_row_count
(
1
);
if
(
!
select
||
(
error
=
select
->
skip_record
(
thd
))
>
0
)
if
(
!
select
||
(
error
=
select
->
skip_record
(
thd
))
>
0
)
{
{
...
@@ -744,9 +742,7 @@ int mysql_update(THD *thd,
...
@@ -744,9 +742,7 @@ int mysql_update(THD *thd,
while
(
!
(
error
=
info
.
read_record
(
&
info
))
&&
!
thd
->
killed
)
while
(
!
(
error
=
info
.
read_record
(
&
info
))
&&
!
thd
->
killed
)
{
{
if
(
table
->
vfield
)
if
(
table
->
vfield
)
update_virtual_fields
(
thd
,
table
,
update_virtual_fields
(
thd
,
table
,
VCOL_UPDATE_FOR_READ
);
table
->
triggers
?
VCOL_UPDATE_ALL
:
VCOL_UPDATE_FOR_READ
);
thd
->
inc_examined_row_count
(
1
);
thd
->
inc_examined_row_count
(
1
);
if
(
!
select
||
select
->
skip_record
(
thd
)
>
0
)
if
(
!
select
||
select
->
skip_record
(
thd
)
>
0
)
{
{
...
@@ -2399,8 +2395,7 @@ int multi_update::do_updates()
...
@@ -2399,8 +2395,7 @@ int multi_update::do_updates()
if
(
table
->
default_field
&&
(
error
=
table
->
update_default_fields
()))
if
(
table
->
default_field
&&
(
error
=
table
->
update_default_fields
()))
goto
err2
;
goto
err2
;
if
(
table
->
vfield
&&
if
(
table
->
vfield
&&
update_virtual_fields
(
thd
,
table
,
update_virtual_fields
(
thd
,
table
,
VCOL_UPDATE_FOR_WRITE
))
(
table
->
triggers
?
VCOL_UPDATE_ALL
:
VCOL_UPDATE_FOR_WRITE
)))
goto
err2
;
goto
err2
;
if
((
error
=
cur_table
->
view_check_option
(
thd
,
ignore
))
!=
if
((
error
=
cur_table
->
view_check_option
(
thd
,
ignore
))
!=
VIEW_CHECK_OK
)
VIEW_CHECK_OK
)
...
...
sql/table.cc
View file @
66744f45
...
@@ -6686,11 +6686,9 @@ bool is_simple_order(ORDER *order)
...
@@ -6686,11 +6686,9 @@ bool is_simple_order(ORDER *order)
@details
@details
The function computes the values of the virtual columns of the table and
The function computes the values of the virtual columns of the table and
stores them in the table record buffer.
stores them in the table record buffer.
If vcol_update_mode is set to VCOL_UPDATE_ALL then all virtual column are
Only fields from vcol_set are computed: all of them, if vcol_update_mode is
computed. Otherwise, only fields from vcol_set are computed: all of them,
set to VCOL_UPDATE_FOR_WRITE, and, only those with the stored_in_db flag
if vcol_update_mode is set to VCOL_UPDATE_FOR_WRITE, and, only those with
set to false, if vcol_update_mode is equal to VCOL_UPDATE_FOR_READ.
the stored_in_db flag set to false, if vcol_update_mode is equal to
VCOL_UPDATE_FOR_READ.
@retval
@retval
0 Success
0 Success
...
@@ -6712,9 +6710,8 @@ int update_virtual_fields(THD *thd, TABLE *table,
...
@@ -6712,9 +6710,8 @@ int update_virtual_fields(THD *thd, TABLE *table,
{
{
vfield
=
(
*
vfield_ptr
);
vfield
=
(
*
vfield_ptr
);
DBUG_ASSERT
(
vfield
->
vcol_info
&&
vfield
->
vcol_info
->
expr_item
);
DBUG_ASSERT
(
vfield
->
vcol_info
&&
vfield
->
vcol_info
->
expr_item
);
if
((
bitmap_is_set
(
table
->
vcol_set
,
vfield
->
field_index
)
&&
if
(
bitmap_is_set
(
table
->
vcol_set
,
vfield
->
field_index
)
&&
(
vcol_update_mode
==
VCOL_UPDATE_FOR_WRITE
||
!
vfield
->
stored_in_db
))
||
(
vcol_update_mode
==
VCOL_UPDATE_FOR_WRITE
||
!
vfield
->
stored_in_db
))
vcol_update_mode
==
VCOL_UPDATE_ALL
)
{
{
/* Compute the actual value of the virtual fields */
/* Compute the actual value of the virtual fields */
error
=
vfield
->
vcol_info
->
expr_item
->
save_in_field
(
vfield
,
0
);
error
=
vfield
->
vcol_info
->
expr_item
->
save_in_field
(
vfield
,
0
);
...
...
sql/table.h
View file @
66744f45
...
@@ -315,8 +315,7 @@ enum release_type { RELEASE_NORMAL, RELEASE_WAIT_FOR_DROP };
...
@@ -315,8 +315,7 @@ enum release_type { RELEASE_NORMAL, RELEASE_WAIT_FOR_DROP };
enum
enum_vcol_update_mode
enum
enum_vcol_update_mode
{
{
VCOL_UPDATE_FOR_READ
=
0
,
VCOL_UPDATE_FOR_READ
=
0
,
VCOL_UPDATE_FOR_WRITE
,
VCOL_UPDATE_FOR_WRITE
VCOL_UPDATE_ALL
};
};
class
Filesort_info
class
Filesort_info
...
...
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