summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
authorunknown <gshchepa/uchum@gleb.loc>2007-10-26 18:05:46 +0500
committerunknown <gshchepa/uchum@gleb.loc>2007-10-26 18:05:46 +0500
commit0e076d4bb96b80c39bc9588d82566166afbfaed3 (patch)
tree89a767a9921239f50bf52cb8dd7248f0f29817c9 /mysql-test
parentf78be6c8e997a2e5c5e971749d35ef4e44e425e2 (diff)
parent46b03c598dde0df5536bda3b981996219cb2d48a (diff)
downloadmariadb-git-0e076d4bb96b80c39bc9588d82566166afbfaed3.tar.gz
Merge gleb.loc:/home/uchum/work/bk/5.0-opt
into gleb.loc:/home/uchum/work/bk/5.1-opt mysql-test/r/select.result: Auto merged mysql-test/r/type_decimal.result: Auto merged mysql-test/t/select.test: Auto merged mysql-test/t/type_decimal.test: Auto merged sql/item.cc: Auto merged sql/sql_class.cc: Auto merged sql/sql_class.h: Auto merged sql/sql_yacc.yy: Auto merged sql/share/errmsg.txt: Merge with 5.0-opt
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/r/outfile_loaddata.result85
-rw-r--r--mysql-test/r/select.result26
-rw-r--r--mysql-test/r/type_decimal.result10
-rw-r--r--mysql-test/t/outfile_loaddata.test89
-rw-r--r--mysql-test/t/select.test23
-rw-r--r--mysql-test/t/type_decimal.test15
6 files changed, 226 insertions, 22 deletions
diff --git a/mysql-test/r/outfile_loaddata.result b/mysql-test/r/outfile_loaddata.result
new file mode 100644
index 00000000000..1bcaf308b7c
--- /dev/null
+++ b/mysql-test/r/outfile_loaddata.result
@@ -0,0 +1,85 @@
+DROP TABLE IF EXISTS t1, t2;
+#
+# Bug#31663 FIELDS TERMINATED BY special character
+#
+CREATE TABLE t1 (i1 int, i2 int, c1 VARCHAR(256), c2 VARCHAR(256));
+INSERT INTO t1 VALUES (101, 202, '-r-', '=raker=');
+# FIELDS TERMINATED BY 'raker', warning:
+SELECT * INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/bug31663.txt' FIELDS TERMINATED BY 'raker' FROM t1;
+Warnings:
+Warning 1475 First character of the FIELDS TERMINATED string is ambiguous; please use non-optional and non-empty FIELDS ENCLOSED BY
+SELECT LOAD_FILE('MYSQLTEST_VARDIR/tmp/bug31663.txt');
+LOAD_FILE('MYSQLTEST_VARDIR/tmp/bug31663.txt')
+101raker202raker-r-raker=raker=
+
+CREATE TABLE t2 SELECT * FROM t1;
+LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/bug31663.txt' INTO TABLE t2 FIELDS TERMINATED BY 'raker';
+Warnings:
+Warning 1262 Row 1 was truncated; it contained more data than there were input columns
+SELECT * FROM t2;
+i1 i2 c1 c2
+101 202 -r- =raker=
+101 202 -r- =
+DROP TABLE t2;
+# Only numeric fields, FIELDS TERMINATED BY 'r', no warnings:
+SELECT i1, i2 INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/bug31663.txt' FIELDS TERMINATED BY 'r' FROM t1;
+SELECT LOAD_FILE('MYSQLTEST_VARDIR/tmp/bug31663.txt');
+LOAD_FILE('MYSQLTEST_VARDIR/tmp/bug31663.txt')
+101r202
+
+CREATE TABLE t2 SELECT i1, i2 FROM t1;
+LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/bug31663.txt' INTO TABLE t2 FIELDS TERMINATED BY 'r';
+SELECT i1, i2 FROM t2;
+i1 i2
+101 202
+101 202
+DROP TABLE t2;
+# FIELDS TERMINATED BY '0', warning:
+SELECT * INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/bug31663.txt' FIELDS TERMINATED BY '0' FROM t1;
+Warnings:
+Warning 1475 First character of the FIELDS TERMINATED string is ambiguous; please use non-optional and non-empty FIELDS ENCLOSED BY
+SELECT LOAD_FILE('MYSQLTEST_VARDIR/tmp/bug31663.txt');
+LOAD_FILE('MYSQLTEST_VARDIR/tmp/bug31663.txt')
+10102020-r-0=raker=
+
+CREATE TABLE t2 SELECT * FROM t1;
+LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/bug31663.txt' INTO TABLE t2 FIELDS TERMINATED BY '0';
+Warnings:
+Warning 1262 Row 1 was truncated; it contained more data than there were input columns
+SELECT * FROM t2;
+i1 i2 c1 c2
+101 202 -r- =raker=
+1 1 2 2
+DROP TABLE t2;
+# FIELDS OPTIONALLY ENCLOSED BY '"' TERMINATED BY '0', warning:
+SELECT * INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/bug31663.txt' FIELDS OPTIONALLY ENCLOSED BY '"' TERMINATED BY '0' FROM t1;
+Warnings:
+Warning 1475 First character of the FIELDS TERMINATED string is ambiguous; please use non-optional and non-empty FIELDS ENCLOSED BY
+SELECT LOAD_FILE('MYSQLTEST_VARDIR/tmp/bug31663.txt');
+LOAD_FILE('MYSQLTEST_VARDIR/tmp/bug31663.txt')
+10102020"-r-"0"=raker="
+
+CREATE TABLE t2 SELECT * FROM t1;
+LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/bug31663.txt' INTO TABLE t2 FIELDS OPTIONALLY ENCLOSED BY '"' TERMINATED BY '0';
+Warnings:
+Warning 1262 Row 1 was truncated; it contained more data than there were input columns
+SELECT * FROM t2;
+i1 i2 c1 c2
+101 202 -r- =raker=
+1 1 2 2
+DROP TABLE t2;
+# Only string fields, FIELDS OPTIONALLY ENCLOSED BY '"' TERMINATED BY '0', no warnings:
+SELECT c1, c2 INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/bug31663.txt' FIELDS OPTIONALLY ENCLOSED BY '"' TERMINATED BY '0' FROM t1;
+SELECT LOAD_FILE('MYSQLTEST_VARDIR/tmp/bug31663.txt');
+LOAD_FILE('MYSQLTEST_VARDIR/tmp/bug31663.txt')
+"-r-"0"=raker="
+
+CREATE TABLE t2 SELECT c1, c2 FROM t1;
+LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/bug31663.txt' INTO TABLE t2 FIELDS OPTIONALLY ENCLOSED BY '"' TERMINATED BY '0';
+SELECT c1, c2 FROM t2;
+c1 c2
+-r- =raker=
+-r- =raker=
+DROP TABLE t2;
+DROP TABLE t1;
+# End of 5.0 tests.
diff --git a/mysql-test/r/select.result b/mysql-test/r/select.result
index d1d85aef0ec..f09266422ff 100644
--- a/mysql-test/r/select.result
+++ b/mysql-test/r/select.result
@@ -4062,25 +4062,23 @@ x
1
Warnings:
Warning 1466 Leading spaces are removed from name ' x'
+CREATE VIEW v1 AS SELECT 1 AS ``;
+ERROR 42000: Incorrect column name ''
CREATE VIEW v1 AS SELECT 1 AS ` `;
-Warnings:
-Warning 1474 Name ' ' has become ''
-SELECT `` FROM v1;
-
-1
-CREATE VIEW v2 AS SELECT 1 AS ` `;
-Warnings:
-Warning 1474 Name ' ' has become ''
-SELECT `` FROM v2;
-
-1
-CREATE VIEW v3 AS SELECT 1 AS ` x`;
+ERROR 42000: Incorrect column name ' '
+CREATE VIEW v1 AS SELECT 1 AS ` `;
+ERROR 42000: Incorrect column name ' '
+CREATE VIEW v1 AS SELECT (SELECT 1 AS ` `);
+ERROR 42000: Incorrect column name ' '
+CREATE VIEW v1 AS SELECT 1 AS ` x`;
Warnings:
Warning 1466 Leading spaces are removed from name ' x'
-SELECT `x` FROM v3;
+SELECT `x` FROM v1;
x
1
-DROP VIEW v1, v2, v3;
+ALTER VIEW v1 AS SELECT 1 AS ` `;
+ERROR 42000: Incorrect column name ' '
+DROP VIEW v1;
End of 5.0 tests
create table t1(a INT, KEY (a));
INSERT INTO t1 VALUES (1),(2),(3),(4),(5);
diff --git a/mysql-test/r/type_decimal.result b/mysql-test/r/type_decimal.result
index 42276a004bb..cd7902c8ae9 100644
--- a/mysql-test/r/type_decimal.result
+++ b/mysql-test/r/type_decimal.result
@@ -812,4 +812,14 @@ select group_concat(f1),group_concat(f2) from t1;
group_concat(f1) group_concat(f2)
-0.123456 0.123456
drop table t1;
+create table t1 (
+ua_id decimal(22,0) not null,
+ua_invited_by_id decimal(22,0) default NULL,
+primary key(ua_id)
+);
+insert into t1 values (123, NULL), (456, NULL);
+this must not produce error 1048:
+select * from t1 where ua_invited_by_id not in (select ua_id from t1);
+ua_id ua_invited_by_id
+drop table t1;
End of 5.0 tests
diff --git a/mysql-test/t/outfile_loaddata.test b/mysql-test/t/outfile_loaddata.test
new file mode 100644
index 00000000000..2f6ac998b3d
--- /dev/null
+++ b/mysql-test/t/outfile_loaddata.test
@@ -0,0 +1,89 @@
+--disable_warnings
+DROP TABLE IF EXISTS t1, t2;
+--enable_warnings
+
+--echo #
+--echo # Bug#31663 FIELDS TERMINATED BY special character
+--echo #
+
+CREATE TABLE t1 (i1 int, i2 int, c1 VARCHAR(256), c2 VARCHAR(256));
+INSERT INTO t1 VALUES (101, 202, '-r-', '=raker=');
+
+--let $fields=*
+--let $clauses=FIELDS TERMINATED BY 'raker'
+--echo # $clauses, warning:
+
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+--eval SELECT $fields INTO OUTFILE '$MYSQLTEST_VARDIR/tmp/bug31663.txt' $clauses FROM t1
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+--eval SELECT LOAD_FILE('$MYSQLTEST_VARDIR/tmp/bug31663.txt')
+--eval CREATE TABLE t2 SELECT $fields FROM t1
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+--eval LOAD DATA INFILE '$MYSQLTEST_VARDIR/tmp/bug31663.txt' INTO TABLE t2 $clauses
+--eval SELECT $fields FROM t2
+--remove_file $MYSQLTEST_VARDIR/tmp/bug31663.txt
+DROP TABLE t2;
+
+--let $fields=i1, i2
+--let $clauses=FIELDS TERMINATED BY 'r'
+--echo # Only numeric fields, $clauses, no warnings:
+
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+--eval SELECT $fields INTO OUTFILE '$MYSQLTEST_VARDIR/tmp/bug31663.txt' $clauses FROM t1
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+--eval SELECT LOAD_FILE('$MYSQLTEST_VARDIR/tmp/bug31663.txt')
+--eval CREATE TABLE t2 SELECT $fields FROM t1
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+--eval LOAD DATA INFILE '$MYSQLTEST_VARDIR/tmp/bug31663.txt' INTO TABLE t2 $clauses
+--eval SELECT $fields FROM t2
+--remove_file $MYSQLTEST_VARDIR/tmp/bug31663.txt
+DROP TABLE t2;
+
+--let $fields=*
+--let $clauses=FIELDS TERMINATED BY '0'
+--echo # $clauses, warning:
+
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+--eval SELECT $fields INTO OUTFILE '$MYSQLTEST_VARDIR/tmp/bug31663.txt' $clauses FROM t1
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+--eval SELECT LOAD_FILE('$MYSQLTEST_VARDIR/tmp/bug31663.txt')
+--eval CREATE TABLE t2 SELECT $fields FROM t1
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+--eval LOAD DATA INFILE '$MYSQLTEST_VARDIR/tmp/bug31663.txt' INTO TABLE t2 $clauses
+--eval SELECT $fields FROM t2
+--remove_file $MYSQLTEST_VARDIR/tmp/bug31663.txt
+DROP TABLE t2;
+
+--let $fields=*
+--let $clauses=FIELDS OPTIONALLY ENCLOSED BY '"' TERMINATED BY '0'
+--echo # $clauses, warning:
+
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+--eval SELECT $fields INTO OUTFILE '$MYSQLTEST_VARDIR/tmp/bug31663.txt' $clauses FROM t1
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+--eval SELECT LOAD_FILE('$MYSQLTEST_VARDIR/tmp/bug31663.txt')
+--eval CREATE TABLE t2 SELECT $fields FROM t1
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+--eval LOAD DATA INFILE '$MYSQLTEST_VARDIR/tmp/bug31663.txt' INTO TABLE t2 $clauses
+--eval SELECT $fields FROM t2
+--remove_file $MYSQLTEST_VARDIR/tmp/bug31663.txt
+DROP TABLE t2;
+
+--let $fields=c1, c2
+--let $clauses=FIELDS OPTIONALLY ENCLOSED BY '"' TERMINATED BY '0'
+--echo # Only string fields, $clauses, no warnings:
+
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+--eval SELECT $fields INTO OUTFILE '$MYSQLTEST_VARDIR/tmp/bug31663.txt' $clauses FROM t1
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+--eval SELECT LOAD_FILE('$MYSQLTEST_VARDIR/tmp/bug31663.txt')
+--eval CREATE TABLE t2 SELECT $fields FROM t1
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+--eval LOAD DATA INFILE '$MYSQLTEST_VARDIR/tmp/bug31663.txt' INTO TABLE t2 $clauses
+--eval SELECT $fields FROM t2
+--remove_file $MYSQLTEST_VARDIR/tmp/bug31663.txt
+DROP TABLE t2;
+
+DROP TABLE t1;
+
+--echo # End of 5.0 tests.
diff --git a/mysql-test/t/select.test b/mysql-test/t/select.test
index 76a66cc4783..ceb920c6ce4 100644
--- a/mysql-test/t/select.test
+++ b/mysql-test/t/select.test
@@ -3455,23 +3455,30 @@ DROP TABLE t1;
#
--disable_ps_protocol
-
SELECT 1 AS ` `;
SELECT 1 AS ` `;
SELECT 1 AS ` x`;
+--enable_ps_protocol
+
+--error 1166
+CREATE VIEW v1 AS SELECT 1 AS ``;
+--error 1166
CREATE VIEW v1 AS SELECT 1 AS ` `;
-SELECT `` FROM v1;
-CREATE VIEW v2 AS SELECT 1 AS ` `;
-SELECT `` FROM v2;
+--error 1166
+CREATE VIEW v1 AS SELECT 1 AS ` `;
-CREATE VIEW v3 AS SELECT 1 AS ` x`;
-SELECT `x` FROM v3;
+--error 1166
+CREATE VIEW v1 AS SELECT (SELECT 1 AS ` `);
-DROP VIEW v1, v2, v3;
+CREATE VIEW v1 AS SELECT 1 AS ` x`;
+SELECT `x` FROM v1;
---enable_ps_protocol
+--error 1166
+ALTER VIEW v1 AS SELECT 1 AS ` `;
+
+DROP VIEW v1;
--echo End of 5.0 tests
diff --git a/mysql-test/t/type_decimal.test b/mysql-test/t/type_decimal.test
index 4d61350a613..12d4398dd57 100644
--- a/mysql-test/t/type_decimal.test
+++ b/mysql-test/t/type_decimal.test
@@ -425,5 +425,20 @@ insert into t1 values (-0.123456,0.123456);
select group_concat(f1),group_concat(f2) from t1;
drop table t1;
+#
+# BUG#31450 "Query causes error 1048"
+#
+create table t1 (
+ ua_id decimal(22,0) not null,
+ ua_invited_by_id decimal(22,0) default NULL,
+ primary key(ua_id)
+);
+insert into t1 values (123, NULL), (456, NULL);
+
+--echo this must not produce error 1048:
+select * from t1 where ua_invited_by_id not in (select ua_id from t1);
+
+drop table t1;
+
--echo End of 5.0 tests