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
075a7303
Commit
075a7303
authored
May 20, 2005
by
gluh@gluh.mysql.r18.ru
Browse files
Options
Browse Files
Download
Plain Diff
Merge gluh.mysql.r18.ru:/home/gluh/release/mysql-5.0-build
into gluh.mysql.r18.ru:/home/gluh/release/mysql-5.0
parents
ed674271
68317fcb
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
42 additions
and
16 deletions
+42
-16
mysql-test/r/information_schema.result
mysql-test/r/information_schema.result
+6
-6
mysql-test/r/information_schema_inno.result
mysql-test/r/information_schema_inno.result
+14
-7
mysql-test/t/information_schema_inno.test
mysql-test/t/information_schema_inno.test
+6
-2
sql/sql_show.cc
sql/sql_show.cc
+16
-1
No files found.
mysql-test/r/information_schema.result
View file @
075a7303
...
...
@@ -412,11 +412,11 @@ NULL test key_1 test t1 UNIQUE
NULL test key_2 test t1 UNIQUE
select * from information_schema.KEY_COLUMN_USAGE where
TABLE_SCHEMA= "test";
CONSTRAINT_CATALOG CONSTRAINT_SCHEMA CONSTRAINT_NAME TABLE_CATALOG TABLE_SCHEMA TABLE_NAME COLUMN_NAME ORDINAL_POSITION POSITION_IN_UNIQUE_CONSTRAINT
NULL test PRIMARY NULL test t1 a 1 NULL
NULL test constraint_1 NULL test t1 a 1 NULL
NULL test key_1 NULL test t1 a 1 NULL
NULL test key_2 NULL test t1 a 1 NULL
CONSTRAINT_CATALOG CONSTRAINT_SCHEMA CONSTRAINT_NAME TABLE_CATALOG TABLE_SCHEMA TABLE_NAME COLUMN_NAME ORDINAL_POSITION POSITION_IN_UNIQUE_CONSTRAINT
REFERENCED_TABLE_SCHEMA REFERENCED_TABLE_NAME REFERENCED_COLUMN_NAME
NULL test PRIMARY NULL test t1 a 1 NULL
NULL NULL NULL
NULL test constraint_1 NULL test t1 a 1 NULL
NULL NULL NULL
NULL test key_1 NULL test t1 a 1 NULL
NULL NULL NULL
NULL test key_2 NULL test t1 a 1 NULL
NULL NULL NULL
select table_name from information_schema.TABLES where table_schema like "test%";
table_name
t1
...
...
@@ -560,7 +560,7 @@ TABLE_NAME= "vo";
CONSTRAINT_CATALOG CONSTRAINT_SCHEMA CONSTRAINT_NAME TABLE_SCHEMA TABLE_NAME CONSTRAINT_TYPE
select * from information_schema.KEY_COLUMN_USAGE where
TABLE_NAME= "vo";
CONSTRAINT_CATALOG CONSTRAINT_SCHEMA CONSTRAINT_NAME TABLE_CATALOG TABLE_SCHEMA TABLE_NAME COLUMN_NAME ORDINAL_POSITION POSITION_IN_UNIQUE_CONSTRAINT
CONSTRAINT_CATALOG CONSTRAINT_SCHEMA CONSTRAINT_NAME TABLE_CATALOG TABLE_SCHEMA TABLE_NAME COLUMN_NAME ORDINAL_POSITION POSITION_IN_UNIQUE_CONSTRAINT
REFERENCED_TABLE_SCHEMA REFERENCED_TABLE_NAME REFERENCED_COLUMN_NAME
drop view vo;
select TABLE_NAME,TABLE_TYPE,ENGINE
from information_schema.tables
...
...
mysql-test/r/information_schema_inno.result
View file @
075a7303
DROP TABLE IF EXISTS t1,t2;
CREATE TABLE t1 (id INT NOT NULL, PRIMARY KEY (id)) ENGINE=INNODB;
CREATE TABLE t2 (id INT PRIMARY KEY, t1_id INT, INDEX par_ind (t1_id),
CREATE TABLE t2 (id INT PRIMARY KEY, t1_id INT, INDEX par_ind (t1_id
, id
),
FOREIGN KEY (t1_id) REFERENCES t1(id) ON DELETE CASCADE,
FOREIGN KEY (t1_id) REFERENCES t1(id) ON UPDATE CASCADE) ENGINE=INNODB;
CREATE TABLE t3 (id INT PRIMARY KEY, t2_id INT, INDEX par_ind (t2_id),
FOREIGN KEY (id, t2_id) REFERENCES t2(t1_id, id) ON DELETE CASCADE) ENGINE=INNODB;
select * from information_schema.TABLE_CONSTRAINTS where
TABLE_SCHEMA= "test";
CONSTRAINT_CATALOG CONSTRAINT_SCHEMA CONSTRAINT_NAME TABLE_SCHEMA TABLE_NAME CONSTRAINT_TYPE
...
...
@@ -10,11 +12,16 @@ NULL test PRIMARY test t1 PRIMARY KEY
NULL test PRIMARY test t2 PRIMARY KEY
NULL test t2_ibfk_1 test t2 FOREIGN KEY
NULL test t2_ibfk_2 test t2 FOREIGN KEY
NULL test PRIMARY test t3 PRIMARY KEY
NULL test t3_ibfk_1 test t3 FOREIGN KEY
select * from information_schema.KEY_COLUMN_USAGE where
TABLE_SCHEMA= "test";
CONSTRAINT_CATALOG CONSTRAINT_SCHEMA CONSTRAINT_NAME TABLE_CATALOG TABLE_SCHEMA TABLE_NAME COLUMN_NAME ORDINAL_POSITION POSITION_IN_UNIQUE_CONSTRAINT
NULL test PRIMARY NULL test t1 id 1 NULL
NULL test PRIMARY NULL test t2 id 1 NULL
NULL test t2_ibfk_1 NULL test t2 t1_id 1 1
NULL test t2_ibfk_2 NULL test t2 t1_id 1 1
drop table t2, t1;
CONSTRAINT_CATALOG CONSTRAINT_SCHEMA CONSTRAINT_NAME TABLE_CATALOG TABLE_SCHEMA TABLE_NAME COLUMN_NAME ORDINAL_POSITION POSITION_IN_UNIQUE_CONSTRAINT REFERENCED_TABLE_SCHEMA REFERENCED_TABLE_NAME REFERENCED_COLUMN_NAME
NULL test PRIMARY NULL test t1 id 1 NULL NULL NULL NULL
NULL test PRIMARY NULL test t2 id 1 NULL NULL NULL NULL
NULL test t2_ibfk_1 NULL test t2 t1_id 1 1 test t1 id
NULL test t2_ibfk_2 NULL test t2 t1_id 1 1 test t1 id
NULL test PRIMARY NULL test t3 id 1 NULL NULL NULL NULL
NULL test t3_ibfk_1 NULL test t3 id 1 1 test t2 t1_id
NULL test t3_ibfk_1 NULL test t3 t2_id 2 2 test t2 id
drop table t3, t2, t1;
mysql-test/t/information_schema_inno.test
View file @
075a7303
...
...
@@ -8,12 +8,16 @@ DROP TABLE IF EXISTS t1,t2;
#
CREATE
TABLE
t1
(
id
INT
NOT
NULL
,
PRIMARY
KEY
(
id
))
ENGINE
=
INNODB
;
CREATE
TABLE
t2
(
id
INT
PRIMARY
KEY
,
t1_id
INT
,
INDEX
par_ind
(
t1_id
),
CREATE
TABLE
t2
(
id
INT
PRIMARY
KEY
,
t1_id
INT
,
INDEX
par_ind
(
t1_id
,
id
),
FOREIGN
KEY
(
t1_id
)
REFERENCES
t1
(
id
)
ON
DELETE
CASCADE
,
FOREIGN
KEY
(
t1_id
)
REFERENCES
t1
(
id
)
ON
UPDATE
CASCADE
)
ENGINE
=
INNODB
;
CREATE
TABLE
t3
(
id
INT
PRIMARY
KEY
,
t2_id
INT
,
INDEX
par_ind
(
t2_id
),
FOREIGN
KEY
(
id
,
t2_id
)
REFERENCES
t2
(
t1_id
,
id
)
ON
DELETE
CASCADE
)
ENGINE
=
INNODB
;
select
*
from
information_schema
.
TABLE_CONSTRAINTS
where
TABLE_SCHEMA
=
"test"
;
select
*
from
information_schema
.
KEY_COLUMN_USAGE
where
TABLE_SCHEMA
=
"test"
;
drop
table
t2
,
t1
;
drop
table
t
3
,
t
2
,
t1
;
sql/sql_show.cc
View file @
075a7303
...
...
@@ -3009,12 +3009,13 @@ static int get_schema_key_column_usage_record(THD *thd,
while
((
f_key_info
=
it
++
))
{
LEX_STRING
*
f_info
;
LEX_STRING
*
r_info
;
List_iterator_fast
<
LEX_STRING
>
it
(
f_key_info
->
foreign_fields
),
it1
(
f_key_info
->
referenced_fields
);
uint
f_idx
=
0
;
while
((
f_info
=
it
++
))
{
it1
++
;
// Ignore r_info
r_info
=
it1
++
;
f_idx
++
;
restore_record
(
table
,
s
->
default_values
);
store_key_column_usage
(
table
,
base_name
,
file_name
,
...
...
@@ -3024,6 +3025,17 @@ static int get_schema_key_column_usage_record(THD *thd,
(
longlong
)
f_idx
);
table
->
field
[
8
]
->
store
((
longlong
)
f_idx
);
table
->
field
[
8
]
->
set_notnull
();
table
->
field
[
9
]
->
store
(
f_key_info
->
referenced_db
->
str
,
f_key_info
->
referenced_db
->
length
,
system_charset_info
);
table
->
field
[
9
]
->
set_notnull
();
table
->
field
[
10
]
->
store
(
f_key_info
->
referenced_table
->
str
,
f_key_info
->
referenced_table
->
length
,
system_charset_info
);
table
->
field
[
10
]
->
set_notnull
();
table
->
field
[
11
]
->
store
(
r_info
->
str
,
r_info
->
length
,
system_charset_info
);
table
->
field
[
11
]
->
set_notnull
();
if
(
schema_table_store_record
(
thd
,
table
))
DBUG_RETURN
(
1
);
}
...
...
@@ -3771,6 +3783,9 @@ ST_FIELD_INFO key_column_usage_fields_info[]=
{
"COLUMN_NAME"
,
NAME_LEN
,
MYSQL_TYPE_STRING
,
0
,
0
,
0
},
{
"ORDINAL_POSITION"
,
10
,
MYSQL_TYPE_LONG
,
0
,
0
,
0
},
{
"POSITION_IN_UNIQUE_CONSTRAINT"
,
10
,
MYSQL_TYPE_LONG
,
0
,
1
,
0
},
{
"REFERENCED_TABLE_SCHEMA"
,
NAME_LEN
,
MYSQL_TYPE_STRING
,
0
,
1
,
0
},
{
"REFERENCED_TABLE_NAME"
,
NAME_LEN
,
MYSQL_TYPE_STRING
,
0
,
1
,
0
},
{
"REFERENCED_COLUMN_NAME"
,
NAME_LEN
,
MYSQL_TYPE_STRING
,
0
,
1
,
0
},
{
0
,
0
,
MYSQL_TYPE_STRING
,
0
,
0
,
0
}
};
...
...
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