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

Added --compact to mysqlbinlog

Fixed output from mysqlbinlog when using --skip-comments
Fixed warnings from valgrind
Fixed ref_length when used with HEAP tables
More efficent need_conversion()
Fixed error handling in UPDATE with not updateable tables
Fixed bug in null handling in CAST to signed/unsigned



client/client_priv.h:
  cleanup & added OPT_COMPACT
client/mysqldump.c:
  Added option --compact to get a compact readable dump.
  Ensure that SET CHARACTER_SET_CLIENT is not done if we have not remembered the old character set
  Print optimization comments even if --skip-comments are given as these are not true comments. (Before these where only printed at end, which was a bug)
mysql-test/r/cast.result:
  More cast tests
mysql-test/r/derived.result:
  Removed warnings
mysql-test/r/mysqldump.result:
  Update results after fixing mysqlbinlog
mysql-test/r/query_cache.result:
  Make test usable with --extern
  more tests
mysql-test/r/rpl_until.result:
  Make test repeatable under valgrind
mysql-test/r/sql_mode.result:
  Fix test result
mysql-test/r/subselect.result:
  Make test smaller. Update wrong results
mysql-test/t/cast.test:
  More cast tests
mysql-test/t/derived.test:
  Removed warnings
mysql-test/t/query_cache.test:
  Make test usable with --extern
  more tests
mysql-test/t/rpl_until.test:
  fix for valgrind.  Becasue of unknown reason one got 'Slave_SQL_Running=yes' in this setup
mysql-test/t/subselect.test:
  Make test case smaller
sql/field.cc:
  Updated need_conversion() to use new arguments
sql/ha_heap.cc:
  Moved initialization of ref_length to right place. This fixed problem that we had a ref_length of 8 for heap tables, which was not efficent.
sql/item_func.cc:
  Cleanup
sql/item_func.h:
  Fixed bug in null_handling for cast to signed/unsigned
sql/item_strfunc.cc:
  Optimized/cleaned up Item_func_conv_charset3
sql/item_sum.cc:
  Cleanup.
  Ensure that some flag variables are cleared in cleanup()
sql/item_sum.h:
  Fixed references to uninitialized memory
sql/opt_range.cc:
  Fixed spelling error
sql/sql_class.cc:
  Fixed wrong return code, which could case protocol problems
sql/sql_class.h:
  After merge fix
sql/sql_prepare.cc:
  Added comments
sql/sql_show.cc:
  Cleanup
sql/sql_string.cc:
  Optimzed usage of need_conversion().
  - Removed not used argument
  - Save diff lenght in 'offset' to not have to recalculate length several times.
  Cleaned up comment
  Optimized copy_aligned() based on the knowledge that it's only called when you have wrong data
sql/sql_string.h:
  Updated need_conversion() and copy_aligned() to use new arguments
sql/sql_update.cc:
  Fixed error handling with non-updateable tables
sql/sql_yacc.yy:
  Ensure that lex->lock_options are set correctly (to get rid of warnings from valgrind)
  Ensure that cast_type sets lex->charset and lex->length. Without these CONVERT() didn't work properly
This commit is contained in:
unknown
2004-02-09 12:31:03 +01:00
parent 44289ba658
commit 35b1f54450
30 changed files with 327 additions and 284 deletions

View File

@ -24,6 +24,12 @@ Note 1003 select high_priority ~(5) AS `~5`,cast(~(5) as signed) AS `cast(~5 as
select cast(5 as unsigned) -6.0;
cast(5 as unsigned) -6.0
-1.0
select cast(NULL as signed), cast(1/0 as signed);
cast(NULL as signed) cast(1/0 as signed)
NULL NULL
select cast(NULL as unsigned), cast(1/0 as unsigned);
cast(NULL as unsigned) cast(1/0 as unsigned)
NULL NULL
select cast("A" as binary) = "a", cast(BINARY "a" as CHAR) = "A";
cast("A" as binary) = "a" cast(BINARY "a" as CHAR) = "A"
0 1
@ -36,6 +42,21 @@ cast("1:2:3" as TIME)
select CONVERT("2004-01-22 21:45:33",DATE);
CONVERT("2004-01-22 21:45:33",DATE)
2004-01-22
select CONVERT(DATE "2004-01-22 21:45:33" USING latin1);
CONVERT(DATE "2004-01-22 21:45:33" USING latin1)
2004-01-22 21:45:33
select CONVERT(DATE "2004-01-22 21:45:33",CHAR);
CONVERT(DATE "2004-01-22 21:45:33",CHAR)
2004-01-22 21:45:33
select CONVERT(DATE "2004-01-22 21:45:33",CHAR(4));
CONVERT(DATE "2004-01-22 21:45:33",CHAR(4))
2004
select CONVERT(DATE "2004-01-22 21:45:33",CHAR(4) BINARY);
CONVERT(DATE "2004-01-22 21:45:33",CHAR(4) BINARY)
2004
select CAST(DATE "2004-01-22 21:45:33" AS CHAR(4) BINARY);
CAST(DATE "2004-01-22 21:45:33" AS CHAR(4) BINARY)
2004
set names binary;
select cast(_latin1'test' as char character set latin2);
cast(_latin1'test' as char character set latin2)
@ -43,6 +64,12 @@ test
select cast(_koi8r'<27><><EFBFBD><EFBFBD>' as char character set cp1251);
cast(_koi8r'<27><><EFBFBD><EFBFBD>' as char character set cp1251)
<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
select convert(_latin1'test', "latin1_german1_ci", "latin1_swedish_ci");
convert(_latin1'test', "latin1_german1_ci", "latin1_swedish_ci")
test
select convert(_koi8r'<27><><EFBFBD><EFBFBD>', "koi8r_general_ci", "cp1251_general_ci");
convert(_koi8r'<27><><EFBFBD><EFBFBD>', "koi8r_general_ci", "cp1251_general_ci")
<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
create table t1 select cast(_koi8r'<27><><EFBFBD><EFBFBD>' as char character set cp1251) as t;
show create table t1;
Table Create Table

View File

@ -252,9 +252,7 @@ drop table t1;
CREATE TABLE `t1` (
`N` int(11) unsigned NOT NULL default '0',
`M` tinyint(1) default '0',
) TYPE=MyISAM DEFAULT CHARSET=latin1;
Warnings:
Warning 1286 'TYPE=storage_engine' is deprecated. Use 'ENGINE=storage_engine' instead.
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
INSERT INTO `t1` (N, M) VALUES (1, 0),(1, 0),(1, 0),(2, 0),(2, 0),(3, 0);
UPDATE `t1` AS P1 INNER JOIN (SELECT N FROM `t1` GROUP BY N HAVING Count(M) > 1) AS P2 ON P1.N = P2.N SET P1.M = 2;
select * from t1;
@ -279,9 +277,7 @@ OBJECTID int(11) NOT NULL default '0',
SORTORDER int(11) NOT NULL auto_increment,
KEY t1_SortIndex (SORTORDER),
KEY t1_IdIndex (OBJECTID)
) TYPE=MyISAM DEFAULT CHARSET=latin1;
Warnings:
Warning 1286 'TYPE=storage_engine' is deprecated. Use 'ENGINE=storage_engine' instead.
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
CREATE TABLE t2 (
ID int(11) default NULL,
PARID int(11) default NULL,

View File

@ -21,6 +21,11 @@ DROP TABLE t1;
CREATE TABLE t1 (a decimal(240, 20));
INSERT INTO t1 VALUES ("1234567890123456789012345678901234567890"),
("0987654321098765432109876543210987654321");
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT, CHARACTER_SET_CLIENT=utf8 */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE=NO_AUTO_VALUE_ON_ZERO */;
DROP TABLE IF EXISTS `t1`;
CREATE TABLE `t1` (
`a` decimal(240,20) default NULL
@ -41,6 +46,11 @@ UNLOCK TABLES;
DROP TABLE t1;
CREATE TABLE t1 (a double);
INSERT INTO t1 VALUES (-9e999999);
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT, CHARACTER_SET_CLIENT=utf8 */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE=NO_AUTO_VALUE_ON_ZERO */;
DROP TABLE IF EXISTS `t1`;
CREATE TABLE `t1` (
`a` double default NULL
@ -105,6 +115,11 @@ INSERT INTO t1 VALUES ("1\""), ("\"2");
DROP TABLE t1;
CREATE TABLE t1 (a VARCHAR(255)) DEFAULT CHARSET koi8r;
INSERT INTO t1 VALUES (_koi8r x'C1C2C3C4C5');
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT, CHARACTER_SET_CLIENT=utf8 */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE=NO_AUTO_VALUE_ON_ZERO */;
DROP TABLE IF EXISTS `t1`;
CREATE TABLE `t1` (
`a` varchar(255) default NULL
@ -125,6 +140,9 @@ UNLOCK TABLES;
DROP TABLE t1;
CREATE TABLE t1 (a int) ENGINE=MYISAM;
INSERT INTO t1 VALUES (1), (2);
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE=NO_AUTO_VALUE_ON_ZERO */;
DROP TABLE IF EXISTS `t1`;
CREATE TABLE `t1` (
`a` int(11) default NULL
@ -140,8 +158,10 @@ UNLOCK TABLES;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE=NO_AUTO_VALUE_ON_ZERO */;
DROP TABLE IF EXISTS `t1`;
CREATE TABLE `t1` (
`a` int(11) default NULL
@ -157,6 +177,5 @@ UNLOCK TABLES;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
DROP TABLE t1;

View File

@ -696,17 +696,22 @@ word
show status like "Qcache_queries_in_cache";
Variable_name Value
Qcache_queries_in_cache 1
load data infile '../../std_data/words.dat' into table t1;
load data infile 'TEST_DIR/std_data/words.dat' into table t1;
show status like "Qcache_queries_in_cache";
Variable_name Value
Qcache_queries_in_cache 0
select count(*) from t1;
count(*)
70
drop table t1;
create table t1 (a int);
insert into t1 values (1),(2),(3);
show status like "Qcache_queries_in_cache";
Variable_name Value
Qcache_queries_in_cache 0
select * from t1 into outfile "query_caceh.out.file";
select * from t1 into outfile "query_cache.out.file";
select * from t1 into outfile "query_cache.out.file";
ERROR HY000: File 'query_cache.out.file' already exists
select * from t1 limit 1 into dumpfile "query_cache.dump.file";
show status like "Qcache_queries_in_cache";
Variable_name Value

View File

@ -55,7 +55,7 @@ stop slave;
start slave until master_log_file='master-bin.000001', master_log_pos=561;
show slave status;
Slave_IO_State Master_Host Master_User Master_Port Connect_Retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_Do_DB Replicate_Ignore_DB Replicate_Do_Table Replicate_Ignore_Table Replicate_Wild_Do_Table Replicate_Wild_Ignore_Table Last_Errno Last_Error Skip_Counter Exec_Master_Log_Pos Relay_Log_Space Until_Condition Until_Log_File Until_Log_Pos Master_SSL_Allowed Master_SSL_CA_File Master_SSL_CA_Path Master_SSL_Cert Master_SSL_Cipher Master_SSL_Key Seconds_Behind_Master
# 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 561 slave-relay-bin.000002 # master-bin.000001 Yes No 0 0 561 # Master master-bin.000001 561 No #
# 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 561 slave-relay-bin.000002 # master-bin.000001 Yes # 0 0 561 # Master master-bin.000001 561 No #
start slave until master_log_file='master-bin', master_log_pos=561;
ERROR HY000: Wrong parameter or combination of parameters for START SLAVE UNTIL
start slave until master_log_file='master-bin.000001', master_log_pos=561, relay_log_pos=12;

View File

@ -70,7 +70,7 @@ t1 CREATE TABLE `t1` (
`email` varchar(60) NOT NULL default '',
PRIMARY KEY (`a`),
UNIQUE KEY `email` (`email`)
) ENGINE=HEAP ROW_FORMAT=DYNAMIC
) TYPE=HEAP ROW_FORMAT=DYNAMIC
set sql_mode="postgresql,oracle,mssql,db2,maxdb";
select @@sql_mode;
@@sql_mode

View File

@ -1578,50 +1578,28 @@ select * from t1;
a b
1 0.123
drop table t1;
CREATE TABLE t1 (
id int(11) NOT NULL auto_increment,
ts timestamp NOT NULL,
id_cns tinyint(3) unsigned NOT NULL default '0',
id_desc_nota int(11) NOT NULL default '1',
id_publ_uff int(11) NOT NULL default '0',
tipo enum('','UNO','DUE') NOT NULL default '',
f_aggiunte set('TRE','TRETRE','QUATTRO','CINQUE','SEI','SETTE') NOT NULL
default '',
anno_dep smallint(4) unsigned zerofill NOT NULL default '0000',
data_dep smallint(4) unsigned zerofill NOT NULL default '0000',
particolare mediumint(8) unsigned NOT NULL default '0',
generale mediumint(8) unsigned NOT NULL default '0',
bis tinyint(3) unsigned NOT NULL default '0',
PRIMARY KEY(id),
UNIQUE KEY idx_cns_gen_anno (anno_dep,id_cns,generale,particolare),
UNIQUE KEY idx_cns_par_anno (id_cns,anno_dep,tipo,particolare,bis)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 PACK_KEYS=1;
INSERT INTO t1 (id, ts, id_cns, id_desc_nota, id_publ_uff, tipo, f_aggiunte,
anno_dep, data_dep, particolare, generale, bis) VALUES
(NULL, NULL, 16, 29, 622, 'UNO', '', 1987, 1218, 2048, 9681, 0),
(NULL, NULL, 50, 23, 1717, 'UNO', '', 1987, 1126, 1536, 13987, 0),
(NULL, NULL, 16, 123, 123, 'UNO', '', 1987, 1221, 2432, 14594, 0),
(NULL, NULL, 16, 124, 124, 'UNO', '', 1987, 1201, 1792, 13422, 0),
(NULL, NULL, 16, 125, 125, 'UNO', '', 1987, 0723, 1025, 10240, 0),
(NULL, NULL, 16, 126, 126, 'UNO', '', 1987, 1204, 1026, 7089, 0);
CREATE TABLE t2 (
id tinyint(3) unsigned NOT NULL auto_increment,
descr varchar(40) NOT NULL default '',
f_servizi set('UNO','DUE') NOT NULL default '',
data_uno_min int(8) unsigned NOT NULL default '0',
data_due_min int(8) unsigned NOT NULL default '0',
max_anno_dep smallint(6) unsigned NOT NULL default '0',
data_agg int(8) unsigned NOT NULL default '0',
PRIMARY KEY (id)
CREATE TABLE `t1` (
`id` int(11) NOT NULL auto_increment,
`id_cns` tinyint(3) unsigned NOT NULL default '0',
`tipo` enum('','UNO','DUE') NOT NULL default '',
`anno_dep` smallint(4) unsigned zerofill NOT NULL default '0000',
`particolare` mediumint(8) unsigned NOT NULL default '0',
`generale` mediumint(8) unsigned NOT NULL default '0',
`bis` tinyint(3) unsigned NOT NULL default '0',
PRIMARY KEY (`id`),
UNIQUE KEY `idx_cns_gen_anno` (`anno_dep`,`id_cns`,`generale`,`particolare`),
UNIQUE KEY `idx_cns_par_anno` (`id_cns`,`anno_dep`,`tipo`,`particolare`,`bis`)
);
INSERT INTO t2 (id, descr, f_servizi, data_uno_min, data_due_min,
max_anno_dep, data_agg) VALUES
(16, 'C_UNO', 'UNO,DUE', 19000000, 30000000, 1987, 0),
(50, 'C_TRE', 'UNO', 19000000, 30000000, 1990, 0);
SELECT cns.max_anno_dep = (SELECT s.anno_dep FROM t1 AS s WHERE
s.id_cns = cns.id ORDER BY s.anno_dep DESC LIMIT 1) AS PIPPO FROM
t2 AS cns;
PIPPO
1
NULL
INSERT INTO `t1` VALUES (1,16,'UNO',1987,2048,9681,0),(2,50,'UNO',1987,1536,13987,0),(3,16,'UNO',1987,2432,14594,0),(4,16,'UNO',1987,1792,13422,0),(5,16,'UNO',1987,1025,10240,0),(6,16,'UNO',1987,1026,7089,0);
CREATE TABLE `t2` (
`id` tinyint(3) unsigned NOT NULL auto_increment,
`max_anno_dep` smallint(6) unsigned NOT NULL default '0',
PRIMARY KEY (`id`)
);
INSERT INTO `t2` VALUES (16,1987),(50,1990),(51,1990);
SELECT cns.id, cns.max_anno_dep, cns.max_anno_dep = (SELECT s.anno_dep FROM t1 AS s WHERE s.id_cns = cns.id ORDER BY s.anno_dep DESC LIMIT 1) AS PIPPO FROM t2 AS cns;
id max_anno_dep PIPPO
16 1987 1
50 1990 0
51 1990 NULL
DROP TABLE t1, t2;

View File

@ -10,10 +10,17 @@ select cast(-5 as unsigned) -1, cast(-5 as unsigned) + 1;
select ~5, cast(~5 as signed);
explain extended select ~5, cast(~5 as signed);
select cast(5 as unsigned) -6.0;
select cast(NULL as signed), cast(1/0 as signed);
select cast(NULL as unsigned), cast(1/0 as unsigned);
select cast("A" as binary) = "a", cast(BINARY "a" as CHAR) = "A";
select cast("2001-1-1" as DATE), cast("2001-1-1" as DATETIME);
select cast("1:2:3" as TIME);
select CONVERT("2004-01-22 21:45:33",DATE);
select CONVERT(DATE "2004-01-22 21:45:33" USING latin1);
select CONVERT(DATE "2004-01-22 21:45:33",CHAR);
select CONVERT(DATE "2004-01-22 21:45:33",CHAR(4));
select CONVERT(DATE "2004-01-22 21:45:33",CHAR(4) BINARY);
select CAST(DATE "2004-01-22 21:45:33" AS CHAR(4) BINARY);
#
# Character set convertion
@ -21,6 +28,8 @@ select CONVERT("2004-01-22 21:45:33",DATE);
set names binary;
select cast(_latin1'test' as char character set latin2);
select cast(_koi8r'<27><><EFBFBD><EFBFBD>' as char character set cp1251);
select convert(_latin1'test', "latin1_german1_ci", "latin1_swedish_ci");
select convert(_koi8r'<27><><EFBFBD><EFBFBD>', "koi8r_general_ci", "cp1251_general_ci");
create table t1 select cast(_koi8r'<27><><EFBFBD><EFBFBD>' as char character set cp1251) as t;
show create table t1;
drop table t1;

View File

@ -147,7 +147,7 @@ drop table t1;
CREATE TABLE `t1` (
`N` int(11) unsigned NOT NULL default '0',
`M` tinyint(1) default '0',
) TYPE=MyISAM DEFAULT CHARSET=latin1;
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
INSERT INTO `t1` (N, M) VALUES (1, 0),(1, 0),(1, 0),(2, 0),(2, 0),(3, 0);
UPDATE `t1` AS P1 INNER JOIN (SELECT N FROM `t1` GROUP BY N HAVING Count(M) > 1) AS P2 ON P1.N = P2.N SET P1.M = 2;
select * from t1;
@ -167,7 +167,7 @@ CREATE TABLE t1 (
SORTORDER int(11) NOT NULL auto_increment,
KEY t1_SortIndex (SORTORDER),
KEY t1_IdIndex (OBJECTID)
) TYPE=MyISAM DEFAULT CHARSET=latin1;
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
CREATE TABLE t2 (
ID int(11) default NULL,
PARID int(11) default NULL,

View File

@ -466,8 +466,10 @@ select * from t1 where id=2;
create table t1 (word char(20) not null);
select * from t1;
show status like "Qcache_queries_in_cache";
load data infile '../../std_data/words.dat' into table t1;
--replace_result $MYSQL_TEST_DIR TEST_DIR
eval load data infile '$MYSQL_TEST_DIR/std_data/words.dat' into table t1;
show status like "Qcache_queries_in_cache";
select count(*) from t1;
drop table t1;
#
@ -476,7 +478,9 @@ drop table t1;
create table t1 (a int);
insert into t1 values (1),(2),(3);
show status like "Qcache_queries_in_cache";
select * from t1 into outfile "query_caceh.out.file";
select * from t1 into outfile "query_cache.out.file";
--error 1086
select * from t1 into outfile "query_cache.out.file";
select * from t1 limit 1 into dumpfile "query_cache.dump.file";
show status like "Qcache_queries_in_cache";
drop table t1;

View File

@ -59,10 +59,11 @@ stop slave;
# this should stop immideately
start slave until master_log_file='master-bin.000001', master_log_pos=561;
--real-sleep 2;
# 2 is not enough when running with valgrind
--real-sleep 4;
# here the sql slave thread should be stopped
--replace_result $MASTER_MYPORT MASTER_MYPORT bin.000005 bin.000004 bin.000006 bin.000004 bin.000007 bin.000004
--replace_column 1 # 9 # 23 # 33 #
--replace_column 1 # 9 # 12 # 23 # 33 #
show slave status;
#testing various error conditions

View File

@ -1026,52 +1026,26 @@ drop table t1;
# Bug 2479
#
CREATE TABLE t1 (
id int(11) NOT NULL auto_increment,
ts timestamp NOT NULL,
id_cns tinyint(3) unsigned NOT NULL default '0',
id_desc_nota int(11) NOT NULL default '1',
id_publ_uff int(11) NOT NULL default '0',
tipo enum('','UNO','DUE') NOT NULL default '',
f_aggiunte set('TRE','TRETRE','QUATTRO','CINQUE','SEI','SETTE') NOT NULL
default '',
anno_dep smallint(4) unsigned zerofill NOT NULL default '0000',
data_dep smallint(4) unsigned zerofill NOT NULL default '0000',
particolare mediumint(8) unsigned NOT NULL default '0',
generale mediumint(8) unsigned NOT NULL default '0',
bis tinyint(3) unsigned NOT NULL default '0',
PRIMARY KEY(id),
UNIQUE KEY idx_cns_gen_anno (anno_dep,id_cns,generale,particolare),
UNIQUE KEY idx_cns_par_anno (id_cns,anno_dep,tipo,particolare,bis)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 PACK_KEYS=1;
INSERT INTO t1 (id, ts, id_cns, id_desc_nota, id_publ_uff, tipo, f_aggiunte,
anno_dep, data_dep, particolare, generale, bis) VALUES
(NULL, NULL, 16, 29, 622, 'UNO', '', 1987, 1218, 2048, 9681, 0),
(NULL, NULL, 50, 23, 1717, 'UNO', '', 1987, 1126, 1536, 13987, 0),
(NULL, NULL, 16, 123, 123, 'UNO', '', 1987, 1221, 2432, 14594, 0),
(NULL, NULL, 16, 124, 124, 'UNO', '', 1987, 1201, 1792, 13422, 0),
(NULL, NULL, 16, 125, 125, 'UNO', '', 1987, 0723, 1025, 10240, 0),
(NULL, NULL, 16, 126, 126, 'UNO', '', 1987, 1204, 1026, 7089, 0);
CREATE TABLE t2 (
id tinyint(3) unsigned NOT NULL auto_increment,
descr varchar(40) NOT NULL default '',
f_servizi set('UNO','DUE') NOT NULL default '',
data_uno_min int(8) unsigned NOT NULL default '0',
data_due_min int(8) unsigned NOT NULL default '0',
max_anno_dep smallint(6) unsigned NOT NULL default '0',
data_agg int(8) unsigned NOT NULL default '0',
PRIMARY KEY (id)
CREATE TABLE `t1` (
`id` int(11) NOT NULL auto_increment,
`id_cns` tinyint(3) unsigned NOT NULL default '0',
`tipo` enum('','UNO','DUE') NOT NULL default '',
`anno_dep` smallint(4) unsigned zerofill NOT NULL default '0000',
`particolare` mediumint(8) unsigned NOT NULL default '0',
`generale` mediumint(8) unsigned NOT NULL default '0',
`bis` tinyint(3) unsigned NOT NULL default '0',
PRIMARY KEY (`id`),
UNIQUE KEY `idx_cns_gen_anno` (`anno_dep`,`id_cns`,`generale`,`particolare`),
UNIQUE KEY `idx_cns_par_anno` (`id_cns`,`anno_dep`,`tipo`,`particolare`,`bis`)
);
INSERT INTO `t1` VALUES (1,16,'UNO',1987,2048,9681,0),(2,50,'UNO',1987,1536,13987,0),(3,16,'UNO',1987,2432,14594,0),(4,16,'UNO',1987,1792,13422,0),(5,16,'UNO',1987,1025,10240,0),(6,16,'UNO',1987,1026,7089,0);
CREATE TABLE `t2` (
`id` tinyint(3) unsigned NOT NULL auto_increment,
`max_anno_dep` smallint(6) unsigned NOT NULL default '0',
PRIMARY KEY (`id`)
);
INSERT INTO `t2` VALUES (16,1987),(50,1990),(51,1990);
INSERT INTO t2 (id, descr, f_servizi, data_uno_min, data_due_min,
max_anno_dep, data_agg) VALUES
(16, 'C_UNO', 'UNO,DUE', 19000000, 30000000, 1987, 0),
(50, 'C_TRE', 'UNO', 19000000, 30000000, 1990, 0);
SELECT cns.max_anno_dep = (SELECT s.anno_dep FROM t1 AS s WHERE
s.id_cns = cns.id ORDER BY s.anno_dep DESC LIMIT 1) AS PIPPO FROM
t2 AS cns;
SELECT cns.id, cns.max_anno_dep, cns.max_anno_dep = (SELECT s.anno_dep FROM t1 AS s WHERE s.id_cns = cns.id ORDER BY s.anno_dep DESC LIMIT 1) AS PIPPO FROM t2 AS cns;
DROP TABLE t1, t2;