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
f077477d
Commit
f077477d
authored
Sep 07, 2005
by
gluh@eagle.intranet.mysql.r18.ru
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix for bug#12905 show fields from view behaving erratically with current database
use saved view db name in case of view
parent
01afb339
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
43 additions
and
3 deletions
+43
-3
mysql-test/r/information_schema.result
mysql-test/r/information_schema.result
+11
-0
mysql-test/t/information_schema.test
mysql-test/t/information_schema.test
+13
-1
sql/sql_show.cc
sql/sql_show.cc
+19
-2
No files found.
mysql-test/r/information_schema.result
View file @
f077477d
...
@@ -979,3 +979,14 @@ WHERE TABLE_SCHEMA='test' AND TABLE_TYPE='BASE TABLE');
...
@@ -979,3 +979,14 @@ WHERE TABLE_SCHEMA='test' AND TABLE_TYPE='BASE TABLE');
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
t1 MyISAM 10 Fixed 0 0 0 # 1024 0 NULL # # NULL latin1_swedish_ci NULL
t1 MyISAM 10 Fixed 0 0 0 # 1024 0 NULL # # NULL latin1_swedish_ci NULL
t2 MyISAM 10 Fixed 0 0 0 # 1024 0 NULL # # NULL latin1_swedish_ci NULL
t2 MyISAM 10 Fixed 0 0 0 # 1024 0 NULL # # NULL latin1_swedish_ci NULL
DROP TABLE t1,t2;
create table t1(f1 int);
create view v1 (c) as select f1 from t1;
select database();
database()
NULL
show fields from test.v1;
Field Type Null Key Default Extra
c int(11) YES NULL
drop view v1;
drop table t1;
mysql-test/t/information_schema.test
View file @
f077477d
...
@@ -665,4 +665,16 @@ SHOW TABLE STATUS FROM test
...
@@ -665,4 +665,16 @@ SHOW TABLE STATUS FROM test
WHERE
name
IN
(
SELECT
TABLE_NAME
FROM
INFORMATION_SCHEMA
.
TABLES
WHERE
name
IN
(
SELECT
TABLE_NAME
FROM
INFORMATION_SCHEMA
.
TABLES
WHERE
TABLE_SCHEMA
=
'test'
AND
TABLE_TYPE
=
'BASE TABLE'
);
WHERE
TABLE_SCHEMA
=
'test'
AND
TABLE_TYPE
=
'BASE TABLE'
);
DROP
TABLE
t1
,
t2
DROP
TABLE
t1
,
t2
;
#
# Bug #12905 show fields from view behaving erratically with current database
#
create
table
t1
(
f1
int
);
create
view
v1
(
c
)
as
select
f1
from
t1
;
connect
(
con5
,
localhost
,
root
,,
*
NO
-
ONE
*
);
select
database
();
show
fields
from
test
.
v1
;
connection
default
;
drop
view
v1
;
drop
table
t1
;
sql/sql_show.cc
View file @
f077477d
...
@@ -1988,10 +1988,20 @@ int get_all_tables(THD *thd, TABLE_LIST *tables, COND *cond)
...
@@ -1988,10 +1988,20 @@ int get_all_tables(THD *thd, TABLE_LIST *tables, COND *cond)
/*
/*
get_all_tables() returns 1 on failure and 0 on success thus
get_all_tables() returns 1 on failure and 0 on success thus
return only these and not the result code of ::process_table()
return only these and not the result code of ::process_table()
We should use show_table_list->alias instead of
show_table_list->table_name because table_name
could be changed during opening of I_S tables. It's safe
to use alias because alias contains original table name
in this case(this part of code is used only for
'show columns' & 'show statistics' commands).
*/
*/
error
=
test
(
schema_table
->
process_table
(
thd
,
show_table_list
,
error
=
test
(
schema_table
->
process_table
(
thd
,
show_table_list
,
table
,
res
,
show_table_list
->
db
,
table
,
res
,
show_table_list
->
alias
));
(
show_table_list
->
view
?
show_table_list
->
view_db
.
str
:
show_table_list
->
db
),
show_table_list
->
alias
));
close_thread_tables
(
thd
);
close_thread_tables
(
thd
);
show_table_list
->
table
=
0
;
show_table_list
->
table
=
0
;
goto
err
;
goto
err
;
...
@@ -2092,6 +2102,13 @@ int get_all_tables(THD *thd, TABLE_LIST *tables, COND *cond)
...
@@ -2092,6 +2102,13 @@ int get_all_tables(THD *thd, TABLE_LIST *tables, COND *cond)
lex
->
derived_tables
=
0
;
lex
->
derived_tables
=
0
;
res
=
open_normal_and_derived_tables
(
thd
,
show_table_list
,
res
=
open_normal_and_derived_tables
(
thd
,
show_table_list
,
MYSQL_LOCK_IGNORE_FLUSH
);
MYSQL_LOCK_IGNORE_FLUSH
);
/*
We should use show_table_list->alias instead of
show_table_list->table_name because table_name
could be changed during opening of I_S tables. It's safe
to use alias because alias contains original table name
in this case.
*/
res
=
schema_table
->
process_table
(
thd
,
show_table_list
,
table
,
res
=
schema_table
->
process_table
(
thd
,
show_table_list
,
table
,
res
,
base_name
,
res
,
base_name
,
show_table_list
->
alias
);
show_table_list
->
alias
);
...
...
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