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
0be7e703
Commit
0be7e703
authored
Nov 09, 2006
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/B20191-5.0-opt
parents
129fbca2
e7ff881c
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
66 additions
and
2 deletions
+66
-2
mysql-test/r/metadata.result
mysql-test/r/metadata.result
+34
-0
mysql-test/t/metadata.test
mysql-test/t/metadata.test
+19
-0
sql/item.cc
sql/item.cc
+4
-0
sql/sql_select.cc
sql/sql_select.cc
+9
-2
No files found.
mysql-test/r/metadata.result
View file @
0be7e703
...
...
@@ -96,3 +96,37 @@ i
2
affected rows: 1
affected rows: 0
create table t1 (id int(10));
insert into t1 values (1);
CREATE VIEW v1 AS select t1.id as id from t1;
CREATE VIEW v2 AS select t1.id as renamed from t1;
CREATE VIEW v3 AS select t1.id + 12 as renamed from t1;
select * from v1 group by id limit 1;
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
def test t1 v1 id id 3 10 1 Y 32768 0 63
id
1
select * from v1 group by id limit 0;
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
def test t1 v1 id id 3 10 0 Y 32768 0 63
id
select * from v1 where id=1000 group by id;
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
def test t1 v1 id id 3 10 0 Y 32768 0 63
id
select * from v1 where id=1 group by id;
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
def test t1 v1 id id 3 10 1 Y 32768 0 63
id
1
select * from v2 where renamed=1 group by renamed;
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
def test t1 v2 id renamed 3 10 1 Y 32768 0 63
renamed
1
select * from v3 where renamed=1 group by renamed;
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
def v3 renamed 8 12 0 Y 32896 0 63
renamed
drop table t1;
drop view v1,v2,v3;
mysql-test/t/metadata.test
View file @
0be7e703
...
...
@@ -61,4 +61,23 @@ drop table t1;//
delimiter
;
//
--
disable_info
#
# Bug #20191: getTableName gives wrong or inconsistent result when using VIEWs
#
--
enable_metadata
create
table
t1
(
id
int
(
10
));
insert
into
t1
values
(
1
);
CREATE
VIEW
v1
AS
select
t1
.
id
as
id
from
t1
;
CREATE
VIEW
v2
AS
select
t1
.
id
as
renamed
from
t1
;
CREATE
VIEW
v3
AS
select
t1
.
id
+
12
as
renamed
from
t1
;
select
*
from
v1
group
by
id
limit
1
;
select
*
from
v1
group
by
id
limit
0
;
select
*
from
v1
where
id
=
1000
group
by
id
;
select
*
from
v1
where
id
=
1
group
by
id
;
select
*
from
v2
where
renamed
=
1
group
by
renamed
;
select
*
from
v3
where
renamed
=
1
group
by
renamed
;
drop
table
t1
;
drop
view
v1
,
v2
,
v3
;
--
disable_metadata
# End of 4.1 tests
sql/item.cc
View file @
0be7e703
...
...
@@ -4202,6 +4202,10 @@ void Item_field::make_field(Send_field *tmp_field)
DBUG_ASSERT
(
tmp_field
->
table_name
!=
0
);
if
(
name
)
tmp_field
->
col_name
=
name
;
// Use user supplied name
if
(
table_name
)
tmp_field
->
table_name
=
table_name
;
if
(
db_name
)
tmp_field
->
db_name
=
db_name
;
}
...
...
sql/sql_select.cc
View file @
0be7e703
...
...
@@ -13596,9 +13596,16 @@ setup_copy_fields(THD *thd, TMP_TABLE_PARAM *param,
if
(
real_pos
->
type
()
==
Item
::
FIELD_ITEM
)
{
Item_field
*
item
;
pos
=
real_pos
;
if
(
!
(
item
=
new
Item_field
(
thd
,
((
Item_field
*
)
pos
))))
if
(
!
(
item
=
new
Item_field
(
thd
,
((
Item_field
*
)
real_pos
))))
goto
err
;
if
(
pos
->
type
()
==
Item
::
REF_ITEM
)
{
/* preserve the names of the ref when dereferncing */
Item_ref
*
ref
=
(
Item_ref
*
)
pos
;
item
->
db_name
=
ref
->
db_name
;
item
->
table_name
=
ref
->
table_name
;
item
->
name
=
ref
->
name
;
}
pos
=
item
;
if
(
item
->
field
->
flags
&
BLOB_FLAG
)
{
...
...
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