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
c1feaf8d
Commit
c1feaf8d
authored
Apr 06, 2012
by
Igor Babaev
Browse files
Options
Browse Files
Download
Plain Diff
Merge.
parents
545377ab
4ca9b8eb
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
82 additions
and
9 deletions
+82
-9
mysql-test/r/view.result
mysql-test/r/view.result
+20
-0
mysql-test/t/view.test
mysql-test/t/view.test
+29
-0
sql/item.cc
sql/item.cc
+15
-0
sql/item.h
sql/item.h
+2
-0
sql/sql_base.cc
sql/sql_base.cc
+16
-9
No files found.
mysql-test/r/view.result
View file @
c1feaf8d
...
...
@@ -4433,6 +4433,26 @@ NULL NULL 1 0
NULL NULL 1 0
DROP VIEW v2;
DROP TABLE t1, t2, t3;
#
# BUG#915222: Valgrind complains or crashes with INSERT SELECT
# within a trigger that uses a view
#
CREATE TABLE t1 (a char(1));
CREATE TABLE t2 (d int, e char(1));
INSERT INTO t2 VALUES (13,'z');
CREATE TRIGGER tr AFTER UPDATE ON t2
FOR EACH ROW
REPLACE INTO t3
SELECT f, a AS alias FROM t3, v;
CREATE TABLE t3 (f int, g char(8));
CREATE VIEW v AS SELECT a, e FROM t2, t1;
UPDATE t2 SET d=7;
UPDATE t2 SET d=7;
UPDATE t2 SET d=7;
UPDATE t2 SET d=7;
DROP TRIGGER tr;
DROP VIEW v;
DROP TABLE t1,t2,t3;
# -----------------------------------------------------------------
# -- End of 5.3 tests.
# -----------------------------------------------------------------
...
...
mysql-test/t/view.test
View file @
c1feaf8d
...
...
@@ -4365,6 +4365,35 @@ SELECT * FROM t1 RIGHT JOIN v2 ON ( v2.a = t1.a ) WHERE v2.b IN ( SELECT b FROM
DROP
VIEW
v2
;
DROP
TABLE
t1
,
t2
,
t3
;
--
echo
#
--
echo
# BUG#915222: Valgrind complains or crashes with INSERT SELECT
--
echo
# within a trigger that uses a view
--
echo
#
CREATE
TABLE
t1
(
a
char
(
1
));
CREATE
TABLE
t2
(
d
int
,
e
char
(
1
));
INSERT
INTO
t2
VALUES
(
13
,
'z'
);
CREATE
TRIGGER
tr
AFTER
UPDATE
ON
t2
FOR
EACH
ROW
REPLACE
INTO
t3
SELECT
f
,
a
AS
alias
FROM
t3
,
v
;
CREATE
TABLE
t3
(
f
int
,
g
char
(
8
));
CREATE
VIEW
v
AS
SELECT
a
,
e
FROM
t2
,
t1
;
UPDATE
t2
SET
d
=
7
;
UPDATE
t2
SET
d
=
7
;
UPDATE
t2
SET
d
=
7
;
UPDATE
t2
SET
d
=
7
;
DROP
TRIGGER
tr
;
DROP
VIEW
v
;
DROP
TABLE
t1
,
t2
,
t3
;
--
echo
# -----------------------------------------------------------------
--
echo
# -- End of 5.3 tests.
--
echo
# -----------------------------------------------------------------
...
...
sql/item.cc
View file @
c1feaf8d
...
...
@@ -951,6 +951,21 @@ void Item::set_name(const char *str, uint length, CHARSET_INFO *cs)
}
void
Item
::
set_name_for_rollback
(
THD
*
thd
,
const
char
*
str
,
uint
length
,
CHARSET_INFO
*
cs
)
{
char
*
old_name
,
*
new_name
;
old_name
=
name
;
set_name
(
str
,
length
,
cs
);
new_name
=
name
;
if
(
old_name
!=
new_name
)
{
name
=
old_name
;
thd
->
change_item_tree
((
Item
**
)
&
name
,
(
Item
*
)
new_name
);
}
}
/**
@details
This function is called when:
...
...
sql/item.h
View file @
c1feaf8d
...
...
@@ -620,6 +620,8 @@ class Item {
#endif
}
/*lint -e1509 */
void
set_name
(
const
char
*
str
,
uint
length
,
CHARSET_INFO
*
cs
);
void
set_name_for_rollback
(
THD
*
thd
,
const
char
*
str
,
uint
length
,
CHARSET_INFO
*
cs
);
void
rename
(
char
*
new_name
);
void
init_make_field
(
Send_field
*
tmp_field
,
enum
enum_field_types
type
);
virtual
void
cleanup
();
...
...
sql/sql_base.cc
View file @
c1feaf8d
...
...
@@ -5988,15 +5988,22 @@ find_field_in_view(THD *thd, TABLE_LIST *table_list,
*/
if
(
*
ref
&&
!
(
*
ref
)
->
is_autogenerated_name
)
{
if
(
register_tree_change
&&
thd
->
stmt_arena
->
is_stmt_prepare_or_first_stmt_execute
())
arena
=
thd
->
activate_stmt_arena_if_needed
(
&
backup
);
item
->
set_name
((
*
ref
)
->
name
,
(
*
ref
)
->
name_length
,
system_charset_info
);
item
->
real_item
()
->
set_name
((
*
ref
)
->
name
,
(
*
ref
)
->
name_length
,
system_charset_info
);
if
(
arena
)
thd
->
restore_active_arena
(
arena
,
&
backup
);
if
(
register_tree_change
)
{
item
->
set_name_for_rollback
(
thd
,
(
*
ref
)
->
name
,
(
*
ref
)
->
name_length
,
system_charset_info
);
item
->
real_item
()
->
set_name_for_rollback
(
thd
,
(
*
ref
)
->
name
,
(
*
ref
)
->
name_length
,
system_charset_info
);
}
else
{
item
->
set_name
((
*
ref
)
->
name
,
(
*
ref
)
->
name_length
,
system_charset_info
);
item
->
real_item
()
->
set_name
((
*
ref
)
->
name
,
(
*
ref
)
->
name_length
,
system_charset_info
);
}
}
if
(
register_tree_change
)
thd
->
change_item_tree
(
ref
,
item
);
...
...
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