1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

Added test to show bug in current union implementation

After merge fixes
Portability fixes


client/mysqltest.c:
  Fixed that unget() is done properly (needed for QNX where one can't do many ungetc() in a row)
include/errmsg.h:
  After merge fixes
mysql-test/mysql-test-run.sh:
  merge fix
mysql-test/r/system_mysql_db.result:
  Updated results for 4.1
mysql-test/r/union.result:
  Added new test
mysql-test/t/derived.test:
  Portability fix (for Mac OS X)
mysql-test/t/system_mysql_db_refs.test:
  Remove warnings
mysql-test/t/union.test:
  Added test to show bug in current union implementation (to be fixed in 4.1)
scripts/mysql_create_system_tables.sh:
  Fix wrong column define
scripts/mysql_fix_privilege_tables.sh:
  Fix for mysql-test-run
scripts/mysql_fix_privilege_tables.sql:
  Merge with 4.0 to get comments.
  Updated so that it works with privilege tables for MySQL 3.23.
sql/repl_failsafe.cc:
  After merge fix
This commit is contained in:
unknown
2004-03-19 18:33:38 +02:00
parent 67ea8aac5e
commit 28813a9ea9
12 changed files with 204 additions and 83 deletions

View File

@ -511,7 +511,7 @@ fi
MYSQL_DUMP="$MYSQL_DUMP --no-defaults -uroot --socket=$MASTER_MYSOCK --password=$DBPASSWD $EXTRA_MYSQLDUMP_OPT"
MYSQL_BINLOG="$MYSQL_BINLOG --no-defaults --local-load=$MYSQL_TMP_DIR $EXTRA_MYSQLBINLOG_OPT"
MYSQL_FIX_SYSTEM_TABLES="$MYSQL_FIX_SYSTEM_TABLES --host=localhost --port=$MASTER_MYPORT --socket=$MASTER_MYSOCK --user=root --password=$DBPASSWD --bindir=$CLIENT_BINDIR"
MYSQL_FIX_SYSTEM_TABLES="$MYSQL_FIX_SYSTEM_TABLES --host=localhost --port=$MASTER_MYPORT --socket=$MASTER_MYSOCK --user=root --password=$DBPASSWD --basedir=$BASEDIR --bindir=$CLIENT_BINDIR --verbose=1"
MYSQL="$MYSQL --host=localhost --port=$MASTER_MYPORT --socket=$MASTER_MYSOCK --user=root --password=$DBPASSWD"
export MYSQL MYSQL_DUMP MYSQL_BINLOG MYSQL_FIX_SYSTEM_TABLES CLIENT_BINDIR

View File

@ -3,6 +3,10 @@ Tables_in_db
columns_priv
db
func
help_category
help_keyword
help_relation
help_topic
host
tables_priv
user
@ -26,7 +30,7 @@ db CREATE TABLE `db` (
`Lock_tables_priv` enum('N','Y') NOT NULL default 'N',
PRIMARY KEY (`Host`,`Db`,`User`),
KEY `User` (`User`)
) TYPE=MyISAM COMMENT='Database privileges'
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='Database privileges'
show create table host;
Table Create Table
host CREATE TABLE `host` (
@ -45,13 +49,13 @@ host CREATE TABLE `host` (
`Create_tmp_table_priv` enum('N','Y') NOT NULL default 'N',
`Lock_tables_priv` enum('N','Y') NOT NULL default 'N',
PRIMARY KEY (`Host`,`Db`)
) TYPE=MyISAM COMMENT='Host privileges; Merged with database privileges'
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='Host privileges; Merged with database privileges'
show create table user;
Table Create Table
user CREATE TABLE `user` (
`Host` varchar(60) binary NOT NULL default '',
`User` varchar(16) binary NOT NULL default '',
`Password` varchar(16) binary NOT NULL default '',
`Password` varchar(41) binary NOT NULL default '',
`Select_priv` enum('N','Y') NOT NULL default 'N',
`Insert_priv` enum('N','Y') NOT NULL default 'N',
`Update_priv` enum('N','Y') NOT NULL default 'N',
@ -81,16 +85,16 @@ user CREATE TABLE `user` (
`max_updates` int(11) unsigned NOT NULL default '0',
`max_connections` int(11) unsigned NOT NULL default '0',
PRIMARY KEY (`Host`,`User`)
) TYPE=MyISAM COMMENT='Users and global privileges'
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='Users and global privileges'
show create table func;
Table Create Table
func CREATE TABLE `func` (
`name` char(64) NOT NULL default '',
`name` char(64) binary NOT NULL default '',
`ret` tinyint(1) NOT NULL default '0',
`dl` char(128) NOT NULL default '',
`type` enum('function','aggregate') NOT NULL default 'function',
PRIMARY KEY (`name`)
) TYPE=MyISAM COMMENT='User defined functions'
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='User defined functions'
show create table tables_priv;
Table Create Table
tables_priv CREATE TABLE `tables_priv` (
@ -99,12 +103,12 @@ tables_priv CREATE TABLE `tables_priv` (
`User` char(16) binary NOT NULL default '',
`Table_name` char(64) binary NOT NULL default '',
`Grantor` char(77) NOT NULL default '',
`Timestamp` timestamp(14) NOT NULL,
`Timestamp` timestamp NOT NULL,
`Table_priv` set('Select','Insert','Update','Delete','Create','Drop','Grant','References','Index','Alter') NOT NULL default '',
`Column_priv` set('Select','Insert','Update','References') NOT NULL default '',
PRIMARY KEY (`Host`,`Db`,`User`,`Table_name`),
KEY `Grantor` (`Grantor`)
) TYPE=MyISAM COMMENT='Table privileges'
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='Table privileges'
show create table columns_priv;
Table Create Table
columns_priv CREATE TABLE `columns_priv` (
@ -113,7 +117,7 @@ columns_priv CREATE TABLE `columns_priv` (
`User` char(16) binary NOT NULL default '',
`Table_name` char(64) binary NOT NULL default '',
`Column_name` char(64) binary NOT NULL default '',
`Timestamp` timestamp(14) NOT NULL,
`Timestamp` timestamp NOT NULL,
`Column_priv` set('Select','Insert','Update','References') NOT NULL default '',
PRIMARY KEY (`Host`,`Db`,`User`,`Table_name`,`Column_name`)
) TYPE=MyISAM COMMENT='Column privileges'
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='Column privileges'

View File

@ -907,3 +907,18 @@ n
9
10
drop table t1;
create table t1 (i int);
insert into t1 values (1);
select * from t1 UNION select * from t1;
i
1
select * from t1 UNION ALL select * from t1;
i
1
1
select * from t1 UNION select * from t1 UNION ALL select * from t1;
i
1
1
1
drop table t1;

View File

@ -157,7 +157,8 @@ UPDATE `t1` AS P1 INNER JOIN (SELECT N FROM `t1` GROUP BY N HAVING Count(M) > 1)
UPDATE `t1` AS P1 INNER JOIN (SELECT aaaa FROM `t1` GROUP BY N HAVING Count(M) > 1) AS P2 ON P1.N = P2.N SET P1.M = 2;
delete P1.* from `t1` AS P1 INNER JOIN (SELECT N FROM `t1` GROUP BY N HAVING Count(M) > 1) AS P2 ON P1.N = P2.N;
select * from t1;
-- error 1288
--error 1288
--replace_result P2 p2
delete P1.*,P2.* from `t1` AS P1 INNER JOIN (SELECT N FROM `t1` GROUP BY N HAVING Count(M) > 1) AS P2 ON P1.N = P2.N;
-- error 1054
delete P1.* from `t1` AS P1 INNER JOIN (SELECT aaa FROM `t1` GROUP BY N HAVING Count(M) > 1) AS P2 ON P1.N = P2.N;

View File

@ -10,27 +10,39 @@ set @name="This is a very long string, that mustn't find room in a system field
create table test_db select * from mysql.db;
delete from test_db;
--disable_warnings
insert into test_db (Host,Db,User) values (@name,@name,@name);
--enable_warnings
create table test_host select * from mysql.host;
delete from test_host;
--disable_warnings
insert into test_host (Host,Db) values (@name,@name);
--enable_warnings
create table test_user select * from mysql.user;
delete from test_user;
--disable_warnings
insert into test_user (Host,User) values (@name,@name);
--enable_warnings
create table test_func select * from mysql.func;
delete from test_func;
--disable_warnings
insert into test_func (name) values (@name);
--enable_warnings
create table test_tables_priv select * from mysql.tables_priv;
delete from test_tables_priv;
--disable_warnings
insert into test_tables_priv (Host,Db,User,Table_name) values (@name,@name,@name,@name);
--enable_warnings
create table test_columns_priv select * from mysql.columns_priv;
delete from test_columns_priv;
--disable_warnings
insert into test_columns_priv (Host,Db,User,Table_name,Column_name) values (@name,@name,@name,@name,@name);
--enable_warnings
# 'Host' field must be the same for all the tables:

View File

@ -483,3 +483,16 @@ select col1 n from t1 union select col2 n from t1 order by n;
alter table t1 add index myindex (col2);
select col1 n from t1 union select col2 n from t1 order by n;
drop table t1;
#
# Bug #1428, incorrect handling of UNION ALL
# NOTE: The current result is wrong, needs to be fixed!
#
create table t1 (i int);
insert into t1 values (1);
select * from t1 UNION select * from t1;
select * from t1 UNION ALL select * from t1;
# The following should return 2 lines
select * from t1 UNION select * from t1 UNION ALL select * from t1;
drop table t1;