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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
7eebacad
Commit
7eebacad
authored
Jan 11, 2007
by
gkodinov/kgeorge@rakia.gmz
Browse files
Options
Browse Files
Download
Plain Diff
Merge gkodinov@bk-internal.mysql.com:/home/bk/mysql-5.0-opt
into rakia.gmz:/home/kgeorge/mysql/autopush/B25106-5.0-opt
parents
3ff9dff0
15bcf131
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
49 additions
and
0 deletions
+49
-0
mysql-test/r/join.result
mysql-test/r/join.result
+16
-0
mysql-test/t/join.test
mysql-test/t/join.test
+20
-0
sql/sql_base.cc
sql/sql_base.cc
+13
-0
No files found.
mysql-test/r/join.result
View file @
7eebacad
...
...
@@ -764,3 +764,19 @@ natural join t5;
y c b a z
1 3 2 1 4
drop table t1, t2, t3, t4, t5;
CREATE TABLE t1 (ID INTEGER, Name VARCHAR(50));
CREATE TABLE t2 (Test_ID INTEGER);
CREATE VIEW v1 (Test_ID, Description) AS SELECT ID, Name FROM t1;
CREATE TABLE tv1 SELECT Description AS Name FROM v1 JOIN t2
USING (Test_ID);
DESCRIBE tv1;
Field Type Null Key Default Extra
Name varchar(50) YES NULL
CREATE TABLE tv2 SELECT Description AS Name FROM v1 JOIN t2
ON v1.Test_ID = t2.Test_ID;
DESCRIBE tv2;
Field Type Null Key Default Extra
Name varchar(50) YES NULL
DROP VIEW v1;
DROP TABLE t1,t2,tv1,tv2;
End of 5.0 tests.
mysql-test/t/join.test
View file @
7eebacad
...
...
@@ -591,3 +591,23 @@ select * from ((t3 natural join (t1 natural join t2)) natural join t4)
drop
table
t1
,
t2
,
t3
,
t4
,
t5
;
# End of tests for WL#2486 - natural/using join
#
# BUG#25106: A USING clause in combination with a VIEW results in column
# aliases ignored
#
CREATE
TABLE
t1
(
ID
INTEGER
,
Name
VARCHAR
(
50
));
CREATE
TABLE
t2
(
Test_ID
INTEGER
);
CREATE
VIEW
v1
(
Test_ID
,
Description
)
AS
SELECT
ID
,
Name
FROM
t1
;
CREATE
TABLE
tv1
SELECT
Description
AS
Name
FROM
v1
JOIN
t2
USING
(
Test_ID
);
DESCRIBE
tv1
;
CREATE
TABLE
tv2
SELECT
Description
AS
Name
FROM
v1
JOIN
t2
ON
v1
.
Test_ID
=
t2
.
Test_ID
;
DESCRIBE
tv2
;
DROP
VIEW
v1
;
DROP
TABLE
t1
,
t2
,
tv1
,
tv2
;
--
echo
End
of
5.0
tests
.
sql/sql_base.cc
View file @
7eebacad
...
...
@@ -2975,6 +2975,19 @@ find_field_in_natural_join(THD *thd, TABLE_LIST *table_ref, const char *name,
column reference. See create_view_field() for details.
*/
item
=
nj_col
->
create_item
(
thd
);
/*
*ref != NULL means that *ref contains the item that we need to
replace. If the item was aliased by the user, set the alias to
the replacing item.
We need to set alias on both ref itself and on ref real item.
*/
if
(
*
ref
&&
!
(
*
ref
)
->
is_autogenerated_name
)
{
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
&&
arena
)
thd
->
restore_active_arena
(
arena
,
&
backup
);
...
...
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