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
e9c4b7c4
Commit
e9c4b7c4
authored
Oct 27, 2011
by
Igor Babaev
Browse files
Options
Browse Files
Download
Plain Diff
Merge.
parents
d26ee172
afcda65b
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
52 additions
and
1 deletion
+52
-1
mysql-test/r/derived_view.result
mysql-test/r/derived_view.result
+23
-0
mysql-test/t/derived_view.test
mysql-test/t/derived_view.test
+24
-0
sql/item.cc
sql/item.cc
+5
-1
No files found.
mysql-test/r/derived_view.result
View file @
e9c4b7c4
...
...
@@ -1764,4 +1764,27 @@ x
set optimizer_switch= @save_optimizer_switch;
DROP VIEW v3;
DROP TABLE t1,t2,t3;
#
# Bug #874035: view as an inner table of a materialized derived
#
CREATE TABLE t2 (a int NOT NULL);
INSERT INTO t2 VALUES (7), (4);
CREATE TABLE t1 (b int NOT NULL);
INSERT INTO t1 VALUES (5), (7);
CREATE ALGORITHM=MERGE VIEW v1 AS SELECT * FROM t1;
SET SESSION optimizer_switch='derived_merge=off';
PREPARE st1 FROM
'SELECT * FROM (SELECT * FROM t2 LEFT JOIN v1 ON t2.a = v1.b) AS t';
EXECUTE st1;
a b
7 7
4 NULL
EXECUTE st1;
a b
7 7
4 NULL
DEALLOCATE PREPARE st1;
DROP VIEW v1;
DROP TABLE t1,t2;
SET SESSION optimizer_switch='derived_merge=on';
set optimizer_switch=@exit_optimizer_switch;
mysql-test/t/derived_view.test
View file @
e9c4b7c4
...
...
@@ -1166,5 +1166,29 @@ set optimizer_switch= @save_optimizer_switch;
DROP
VIEW
v3
;
DROP
TABLE
t1
,
t2
,
t3
;
--
echo
#
--
echo
# Bug #874035: view as an inner table of a materialized derived
--
echo
#
CREATE
TABLE
t2
(
a
int
NOT
NULL
);
INSERT
INTO
t2
VALUES
(
7
),
(
4
);
CREATE
TABLE
t1
(
b
int
NOT
NULL
);
INSERT
INTO
t1
VALUES
(
5
),
(
7
);
CREATE
ALGORITHM
=
MERGE
VIEW
v1
AS
SELECT
*
FROM
t1
;
SET
SESSION
optimizer_switch
=
'derived_merge=off'
;
PREPARE
st1
FROM
'SELECT * FROM (SELECT * FROM t2 LEFT JOIN v1 ON t2.a = v1.b) AS t'
;
EXECUTE
st1
;
EXECUTE
st1
;
DEALLOCATE
PREPARE
st1
;
DROP
VIEW
v1
;
DROP
TABLE
t1
,
t2
;
SET
SESSION
optimizer_switch
=
'derived_merge=on'
;
# The following command must be the last one the file
set
optimizer_switch
=@
exit_optimizer_switch
;
sql/item.cc
View file @
e9c4b7c4
...
...
@@ -7321,7 +7321,11 @@ bool Item_direct_view_ref::fix_fields(THD *thd, Item **reference)
((
*
ref
)
->
fix_fields
(
thd
,
ref
)))
return
TRUE
;
return
Item_direct_ref
::
fix_fields
(
thd
,
reference
);
if
(
Item_direct_ref
::
fix_fields
(
thd
,
reference
))
return
TRUE
;
if
(
view
->
table
&&
view
->
table
->
maybe_null
)
maybe_null
=
TRUE
;
return
FALSE
;
}
/*
...
...
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