Commit 4d1c68f8 authored by unknown's avatar unknown

Merge acurtis@bk-internal.mysql.com:/home/bk/mysql-4.0

into ltantony.mysql.com:/usr/home/antony/work2/megapatch-4.0


BitKeeper/etc/logging_ok:
  auto-union
parents 1cdcc4f6 cdfc786f
-- require r/have_outfile.require
disable_query_log;
select load_file(concat(@tmpdir,"/outfile.test"));
--exec rm $MYSQL_TEST_DIR/var/tmp/outfile.test
enable_query_log;
eval select "Outfile OK" into outfile "$MYSQL_TEST_DIR/var/tmp/outfile.test";
......@@ -386,3 +386,23 @@ Incorrect table name 't1\\'
rename table t1 to `t1\\`;
Incorrect table name 't1\\'
drop table t1;
drop table if exists t1, t2;
create table t1 ( a varchar(10) not null primary key ) engine=myisam;
create table t2 ( a varchar(10) not null primary key ) engine=merge union=(t1);
flush tables;
alter table t1 modify a varchar(10);
show create table t2;
Table Create Table
t2 CREATE TABLE `t2` (
`a` varchar(10) NOT NULL default '',
PRIMARY KEY (`a`)
) TYPE=MRG_MyISAM UNION=(t1)
flush tables;
alter table t1 modify a varchar(10) not null;
show create table t2;
Table Create Table
t2 CREATE TABLE `t2` (
`a` varchar(10) NOT NULL default '',
PRIMARY KEY (`a`)
) TYPE=MRG_MyISAM UNION=(t1)
drop table if exists t1, t2;
load_file(concat(@tmpdir,"/outfile.test"))
Outfile OK
......@@ -254,3 +254,16 @@ alter table t1 rename to `t1\\`;
rename table t1 to `t1\\`;
drop table t1;
#
# BUG#6236 - ALTER TABLE MODIFY should set implicit NOT NULL on PK columns
#
drop table if exists t1, t2;
create table t1 ( a varchar(10) not null primary key ) engine=myisam;
create table t2 ( a varchar(10) not null primary key ) engine=merge union=(t1);
flush tables;
alter table t1 modify a varchar(10);
show create table t2;
flush tables;
alter table t1 modify a varchar(10) not null;
show create table t2;
drop table if exists t1, t2;
disable_query_log;
-- source include/test_outfile.inc
eval set @tmpdir="$MYSQL_TEST_DIR/var/tmp";
enable_query_log;
-- source include/have_outfile.inc
#
# test of into outfile|dumpfile
#
# We need to check that we have 'file' privilege.
drop table if exists t1;
create table t1 (`a` blob);
insert into t1 values("hello world"),("Hello mars"),(NULL);
disable_query_log;
eval select * into outfile "$MYSQL_TEST_DIR/var/tmp/outfile-test.1" from t1;
enable_query_log;
select load_file(concat(@tmpdir,"/outfile-test.1"));
disable_query_log;
eval select * into dumpfile "$MYSQL_TEST_DIR/var/tmp/outfile-test.2" from t1 limit 1;
enable_query_log;
select load_file(concat(@tmpdir,"/outfile-test.2"));
disable_query_log;
eval select * into dumpfile "$MYSQL_TEST_DIR/var/tmp/outfile-test.3" from t1 where a is null;
enable_query_log;
select load_file(concat(@tmpdir,"/outfile-test.3"));
#drop table if exists t1;
#create table t1 (`a` blob);
#insert into t1 values("hello world"),("Hello mars"),(NULL);
#select * into outfile "/tmp/select-test.1" from t1;
#select load_file("/tmp/select-test.1");
#select * into dumpfile "/tmp/select-test.2" from t1 limit 1;
#select load_file("/tmp/select-test.2");
#select * into dumpfile "/tmp/select-test.3" from t1 where a is null;
#select load_file("/tmp/select-test.3");
#
## the following should give errors
#
#select * into outfile "/tmp/select-test.1" from t1;
#select * into dumpfile "/tmp/select-test.1" from t1;
#select * into dumpfile "/tmp/select-test.99" from t1;
#select load_file("/tmp/select-test.not-exist");
#drop table t1;
# the following should give errors
disable_query_log;
--error 1086
eval select * into outfile "$MYSQL_TEST_DIR/var/tmp/outfile-test.1" from t1;
--error 1086
eval select * into dumpfile "$MYSQL_TEST_DIR/var/tmp/outfile-test.2" from t1;
--error 1086
eval select * into dumpfile "$MYSQL_TEST_DIR/var/tmp/outfile-test.3" from t1;
enable_query_log;
select load_file(concat(@tmpdir,"/outfile-test.not-exist"));
--exec rm $MYSQL_TEST_DIR/var/tmp/outfile-test.1
--exec rm $MYSQL_TEST_DIR/var/tmp/outfile-test.2
--exec rm $MYSQL_TEST_DIR/var/tmp/outfile-test.3
drop table t1;
# Bug#8191
disable_query_log;
eval select 1 into outfile "$MYSQL_TEST_DIR/var/tmp/outfile-test.4";
enable_query_log;
select load_file(concat(@tmpdir,"/outfile-test.4"));
--exec rm $MYSQL_TEST_DIR/var/tmp/outfile-test.4
......@@ -1795,6 +1795,11 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name,
}
KEY_PART_INFO *key_part= key_info->key_part;
enum Key::Keytype key_type= key_info->flags & HA_NOSAME ?
(!my_strcasecmp(key_name, "PRIMARY") ?
Key::PRIMARY : Key::UNIQUE) :
(key_info->flags & HA_FULLTEXT ?
Key::FULLTEXT : Key::MULTIPLE);
key_parts.empty();
for (uint j=0 ; j < key_info->key_parts ; j++,key_part++)
{
......@@ -1824,16 +1829,22 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name,
cfield->pack_length <= key_part_length))
key_part_length=0; // Use whole field
}
if (!(cfield->flags & NOT_NULL_FLAG))
{
if (key_type == Key::PRIMARY)
{
/* Implicitly set primary key fields to NOT NULL for ISO conf. */
cfield->flags|= NOT_NULL_FLAG;
cfield->pack_flag&= ~FIELDFLAG_MAYBE_NULL;
}
else
key_info->flags|= HA_NULL_PART_KEY;
}
key_parts.push_back(new key_part_spec(cfield->field_name,
key_part_length));
}
if (key_parts.elements)
key_list.push_back(new Key(key_info->flags & HA_NOSAME ?
(!my_strcasecmp(key_name, "PRIMARY") ?
Key::PRIMARY : Key::UNIQUE) :
(key_info->flags & HA_FULLTEXT ?
Key::FULLTEXT : Key::MULTIPLE),
key_name,key_parts));
key_list.push_back(new Key(key_type,key_name,key_parts));
}
key_it.rewind();
{
......
......@@ -1537,9 +1537,10 @@ select_part2:
select_into:
limit_clause {}
| into
| select_from
| opt_into select_from
| select_from opt_into;
| into select_from
| select_from into;
select_from:
FROM join_table_list where_clause group_clause having_clause opt_order_clause limit_clause procedure_clause;
......@@ -2507,7 +2508,7 @@ procedure_item:
$2->set_name($1,(uint) ((char*) lex->tok_end - $1));
};
opt_into:
into:
INTO OUTFILE TEXT_STRING
{
THD *thd= current_thd;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment