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
1b3e95e1
Commit
1b3e95e1
authored
Nov 28, 2007
by
sergefp@foxhole.(none)
Browse files
Options
Browse Files
Download
Plain Diff
Merge spetrunia@bk-internal.mysql.com:/home/bk/mysql-5.1-opt
into mysql.com:/home/psergey/mysql-5.1-bug32772
parents
7d6d808b
3628a7af
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
109 additions
and
1 deletion
+109
-1
mysql-test/r/create.result
mysql-test/r/create.result
+38
-0
mysql-test/t/create.test
mysql-test/t/create.test
+13
-0
sql/sql_table.cc
sql/sql_table.cc
+58
-1
No files found.
mysql-test/r/create.result
View file @
1b3e95e1
...
@@ -1705,4 +1705,42 @@ create table t1 as select 1;
...
@@ -1705,4 +1705,42 @@ create table t1 as select 1;
create table t2 as select f1() from t1;
create table t2 as select f1() from t1;
drop table t1,t2;
drop table t1,t2;
drop function f1;
drop function f1;
create table t1 like information_schema.processlist;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`ID` bigint(4) NOT NULL DEFAULT '0',
`USER` varchar(16) NOT NULL DEFAULT '',
`HOST` varchar(64) NOT NULL DEFAULT '',
`DB` varchar(64) DEFAULT NULL,
`COMMAND` varchar(16) NOT NULL DEFAULT '',
`TIME` bigint(7) NOT NULL DEFAULT '0',
`STATE` varchar(64) DEFAULT NULL,
`INFO` longtext
) ENGINE=MyISAM DEFAULT CHARSET=utf8
drop table t1;
create temporary table t1 like information_schema.processlist;
show create table t1;
Table Create Table
t1 CREATE TEMPORARY TABLE `t1` (
`ID` bigint(4) NOT NULL DEFAULT '0',
`USER` varchar(16) NOT NULL DEFAULT '',
`HOST` varchar(64) NOT NULL DEFAULT '',
`DB` varchar(64) DEFAULT NULL,
`COMMAND` varchar(16) NOT NULL DEFAULT '',
`TIME` bigint(7) NOT NULL DEFAULT '0',
`STATE` varchar(64) DEFAULT NULL,
`INFO` longtext
) ENGINE=MyISAM DEFAULT CHARSET=utf8
drop table t1;
create table t1 like information_schema.character_sets;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`CHARACTER_SET_NAME` varchar(64) NOT NULL DEFAULT '',
`DEFAULT_COLLATE_NAME` varchar(64) NOT NULL DEFAULT '',
`DESCRIPTION` varchar(60) NOT NULL DEFAULT '',
`MAXLEN` bigint(3) NOT NULL DEFAULT '0'
) ENGINE=MEMORY DEFAULT CHARSET=utf8
drop table t1;
End of 5.1 tests
End of 5.1 tests
mysql-test/t/create.test
View file @
1b3e95e1
...
@@ -1328,4 +1328,17 @@ create table t2 as select f1() from t1;
...
@@ -1328,4 +1328,17 @@ create table t2 as select f1() from t1;
drop
table
t1
,
t2
;
drop
table
t1
,
t2
;
drop
function
f1
;
drop
function
f1
;
#
# Bug#25629 CREATE TABLE LIKE does not work with INFORMATION_SCHEMA
#
create
table
t1
like
information_schema
.
processlist
;
show
create
table
t1
;
drop
table
t1
;
create
temporary
table
t1
like
information_schema
.
processlist
;
show
create
table
t1
;
drop
table
t1
;
create
table
t1
like
information_schema
.
character_sets
;
show
create
table
t1
;
drop
table
t1
;
--
echo
End
of
5.1
tests
--
echo
End
of
5.1
tests
sql/sql_table.cc
View file @
1b3e95e1
...
@@ -4565,6 +4565,55 @@ bool mysql_preload_keys(THD* thd, TABLE_LIST* tables)
...
@@ -4565,6 +4565,55 @@ bool mysql_preload_keys(THD* thd, TABLE_LIST* tables)
}
}
/**
@brief Create frm file based on I_S table
@param[in] thd thread handler
@param[in] schema_table I_S table
@param[in] dst_path path where frm should be created
@param[in] create_info Create info
@return Operation status
@retval 0 success
@retval 1 error
*/
bool
mysql_create_like_schema_frm
(
THD
*
thd
,
TABLE_LIST
*
schema_table
,
char
*
dst_path
,
HA_CREATE_INFO
*
create_info
)
{
HA_CREATE_INFO
local_create_info
;
Alter_info
alter_info
;
bool
tmp_table
=
(
create_info
->
options
&
HA_LEX_CREATE_TMP_TABLE
);
uint
keys
=
schema_table
->
table
->
s
->
keys
;
uint
db_options
=
0
;
DBUG_ENTER
(
"mysql_create_like_schema_frm"
);
bzero
((
char
*
)
&
local_create_info
,
sizeof
(
local_create_info
));
local_create_info
.
db_type
=
schema_table
->
table
->
s
->
db_type
();
local_create_info
.
row_type
=
schema_table
->
table
->
s
->
row_type
;
local_create_info
.
default_table_charset
=
default_charset_info
;
alter_info
.
flags
=
(
ALTER_CHANGE_COLUMN
|
ALTER_RECREATE
);
schema_table
->
table
->
use_all_columns
();
if
(
mysql_prepare_alter_table
(
thd
,
schema_table
->
table
,
&
local_create_info
,
&
alter_info
))
DBUG_RETURN
(
1
);
if
(
mysql_prepare_create_table
(
thd
,
&
local_create_info
,
&
alter_info
,
tmp_table
,
&
db_options
,
schema_table
->
table
->
file
,
&
schema_table
->
table
->
s
->
key_info
,
&
keys
,
0
))
DBUG_RETURN
(
1
);
local_create_info
.
max_rows
=
0
;
if
(
mysql_create_frm
(
thd
,
dst_path
,
NullS
,
NullS
,
&
local_create_info
,
alter_info
.
create_list
,
keys
,
schema_table
->
table
->
s
->
key_info
,
schema_table
->
table
->
file
))
DBUG_RETURN
(
1
);
DBUG_RETURN
(
0
);
}
/*
/*
Create a table identical to the specified table
Create a table identical to the specified table
...
@@ -4668,7 +4717,15 @@ bool mysql_create_like_table(THD* thd, TABLE_LIST* table, TABLE_LIST* src_table,
...
@@ -4668,7 +4717,15 @@ bool mysql_create_like_table(THD* thd, TABLE_LIST* table, TABLE_LIST* src_table,
during the call to ha_create_table(). See bug #28614 for more info.
during the call to ha_create_table(). See bug #28614 for more info.
*/
*/
VOID
(
pthread_mutex_lock
(
&
LOCK_open
));
VOID
(
pthread_mutex_lock
(
&
LOCK_open
));
if
(
my_copy
(
src_path
,
dst_path
,
MYF
(
MY_DONT_OVERWRITE_FILE
)))
if
(
src_table
->
schema_table
)
{
if
(
mysql_create_like_schema_frm
(
thd
,
src_table
,
dst_path
,
create_info
))
{
VOID
(
pthread_mutex_unlock
(
&
LOCK_open
));
goto
err
;
}
}
else
if
(
my_copy
(
src_path
,
dst_path
,
MYF
(
MY_DONT_OVERWRITE_FILE
)))
{
{
if
(
my_errno
==
ENOENT
)
if
(
my_errno
==
ENOENT
)
my_error
(
ER_BAD_DB_ERROR
,
MYF
(
0
),
db
);
my_error
(
ER_BAD_DB_ERROR
,
MYF
(
0
),
db
);
...
...
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