mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
Merge gleb.loc:/home/uchum/work/bk/5.0-opt
into gleb.loc:/home/uchum/work/bk/5.1-opt
This commit is contained in:
@ -886,6 +886,9 @@ AsText(a)
|
|||||||
POINT(1 1)
|
POINT(1 1)
|
||||||
LINESTRING(0 0,1 1,2 2)
|
LINESTRING(0 0,1 1,2 2)
|
||||||
drop table t1, t2;
|
drop table t1, t2;
|
||||||
|
SELECT 1;
|
||||||
|
1
|
||||||
|
1
|
||||||
End of 5.0 tests
|
End of 5.0 tests
|
||||||
create table t1 (f1 tinyint(1), f2 char(1), f3 varchar(1), f4 geometry, f5 datetime);
|
create table t1 (f1 tinyint(1), f2 char(1), f3 varchar(1), f4 geometry, f5 datetime);
|
||||||
create view v1 as select * from t1;
|
create view v1 as select * from t1;
|
||||||
|
@ -247,6 +247,20 @@ f1
|
|||||||
1
|
1
|
||||||
2
|
2
|
||||||
drop table t1,t2;
|
drop table t1,t2;
|
||||||
|
CREATE TABLE t1 (c1 INT, c2 TIMESTAMP, c3 REAL, c4 DOUBLE);
|
||||||
|
INSERT INTO t1 (c1, c2, c3, c4) VALUES (10, '1970-02-01 01:02:03', 1.1E-100, 1.1E+100);
|
||||||
|
SELECT * FROM t1;
|
||||||
|
c1 c2 c3 c4
|
||||||
|
10 1970-02-01 01:02:03 1.1e-100 1.1e+100
|
||||||
|
SELECT * INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/t1' FIELDS ENCLOSED BY '-' FROM t1;
|
||||||
|
-10- -1970\-02\-01 01:02:03- -1.1e\-100- -1.1e+100-
|
||||||
|
EOF
|
||||||
|
TRUNCATE t1;
|
||||||
|
LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/t1' INTO TABLE t1 FIELDS ENCLOSED BY '-';
|
||||||
|
SELECT * FROM t1;
|
||||||
|
c1 c2 c3 c4
|
||||||
|
10 1970-02-01 01:02:03 1.1e-100 1.1e+100
|
||||||
|
DROP TABLE t1;
|
||||||
CREATE TABLE t1 (a int);
|
CREATE TABLE t1 (a int);
|
||||||
INSERT INTO t1 VALUES (1);
|
INSERT INTO t1 VALUES (1);
|
||||||
SET NAMES latin1;
|
SET NAMES latin1;
|
||||||
|
@ -3497,6 +3497,53 @@ id select_type table type possible_keys key key_len ref rows Extra
|
|||||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using where
|
1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using where
|
||||||
DROP VIEW v1;
|
DROP VIEW v1;
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
|
CREATE TABLE t1 (
|
||||||
|
person_id int NOT NULL PRIMARY KEY,
|
||||||
|
username varchar(40) default NULL,
|
||||||
|
status_flg char(1) NOT NULL default 'A'
|
||||||
|
);
|
||||||
|
CREATE TABLE t2 (
|
||||||
|
person_role_id int NOT NULL auto_increment PRIMARY KEY,
|
||||||
|
role_id int NOT NULL,
|
||||||
|
person_id int NOT NULL,
|
||||||
|
INDEX idx_person_id (person_id),
|
||||||
|
INDEX idx_role_id (role_id)
|
||||||
|
);
|
||||||
|
CREATE TABLE t3 (
|
||||||
|
role_id int NOT NULL auto_increment PRIMARY KEY,
|
||||||
|
role_name varchar(100) default NULL,
|
||||||
|
app_name varchar(40) NOT NULL,
|
||||||
|
INDEX idx_app_name(app_name)
|
||||||
|
);
|
||||||
|
CREATE VIEW v1 AS
|
||||||
|
SELECT profile.person_id AS person_id
|
||||||
|
FROM t1 profile, t2 userrole, t3 role
|
||||||
|
WHERE userrole.person_id = profile.person_id AND
|
||||||
|
role.role_id = userrole.role_id AND
|
||||||
|
profile.status_flg = 'A'
|
||||||
|
ORDER BY profile.person_id,role.app_name,role.role_name;
|
||||||
|
INSERT INTO t1 VALUES
|
||||||
|
(6,'Sw','A'), (-1136332546,'ols','e'), (0,' *\n','0'),
|
||||||
|
(-717462680,'ENTS Ta','0'), (-904346964,'ndard SQL\n','0');
|
||||||
|
INSERT INTO t2 VALUES
|
||||||
|
(1,3,6),(2,4,7),(3,5,8),(4,6,9),(5,1,6),(6,1,7),(7,1,8),(8,1,9),(9,1,10);
|
||||||
|
INSERT INTO t3 VALUES
|
||||||
|
(1,'NUCANS_APP_USER','NUCANSAPP'),(2,'NUCANS_TRGAPP_USER','NUCANSAPP'),
|
||||||
|
(3,'IA_INTAKE_COORDINATOR','IACANS'),(4,'IA_SCREENER','IACANS'),
|
||||||
|
(5,'IA_SUPERVISOR','IACANS'),(6,'IA_READONLY','IACANS'),
|
||||||
|
(7,'SOC_USER','SOCCANS'),(8,'CAYIT_USER','CAYITCANS'),
|
||||||
|
(9,'RTOS_DCFSPOS_SUPERVISOR','RTOS');
|
||||||
|
EXPLAIN SELECT t.person_id AS a, t.person_id AS b FROM v1 t WHERE t.person_id=6;
|
||||||
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
|
1 SIMPLE profile const PRIMARY PRIMARY 4 const 1 Using temporary; Using filesort
|
||||||
|
1 SIMPLE userrole ref idx_person_id,idx_role_id idx_person_id 4 const 2
|
||||||
|
1 SIMPLE role eq_ref PRIMARY PRIMARY 4 test.userrole.role_id 1
|
||||||
|
SELECT t.person_id AS a, t.person_id AS b FROM v1 t WHERE t.person_id=6;
|
||||||
|
a b
|
||||||
|
6 6
|
||||||
|
6 6
|
||||||
|
DROP VIEW v1;
|
||||||
|
DROP TABLE t1,t2,t3;
|
||||||
End of 5.0 tests.
|
End of 5.0 tests.
|
||||||
DROP DATABASE IF EXISTS `d-1`;
|
DROP DATABASE IF EXISTS `d-1`;
|
||||||
CREATE DATABASE `d-1`;
|
CREATE DATABASE `d-1`;
|
||||||
|
@ -571,6 +571,26 @@ create table t2 as select f2 as a from t1 union select f3 from t1;
|
|||||||
desc t2;
|
desc t2;
|
||||||
select AsText(a) from t2;
|
select AsText(a) from t2;
|
||||||
drop table t1, t2;
|
drop table t1, t2;
|
||||||
|
|
||||||
|
#
|
||||||
|
# Bug #29166: MYsql crash when query is run
|
||||||
|
#
|
||||||
|
|
||||||
|
# The test query itself is not logged : too large output.
|
||||||
|
# The real test is the second query : see if the first hasn't crashed the
|
||||||
|
# server
|
||||||
|
--disable_query_log
|
||||||
|
--disable_result_log
|
||||||
|
SELECT AsText(GeometryFromText(CONCAT(
|
||||||
|
'MULTIPOLYGON(((',
|
||||||
|
REPEAT ('-0.00000000001234567890123456789012 -0.123456789012345678,', 1000),
|
||||||
|
'-0.00000000001234567890123456789012 -0.123456789012345678',
|
||||||
|
')))'
|
||||||
|
))) AS a;
|
||||||
|
--enable_result_log
|
||||||
|
--enable_query_log
|
||||||
|
SELECT 1;
|
||||||
|
|
||||||
--echo End of 5.0 tests
|
--echo End of 5.0 tests
|
||||||
|
|
||||||
|
|
||||||
|
@ -217,6 +217,31 @@ select f1 from t1 where f2 <> '0000-00-00 00:00:00' order by f1;
|
|||||||
--exec rm $MYSQLTEST_VARDIR/tmp/t2
|
--exec rm $MYSQLTEST_VARDIR/tmp/t2
|
||||||
drop table t1,t2;
|
drop table t1,t2;
|
||||||
|
|
||||||
|
#
|
||||||
|
# Bug#29442: SELECT INTO OUTFILE FIELDS ENCLOSED BY digit, minus sign etc
|
||||||
|
# corrupts non-string fields containing this character.
|
||||||
|
#
|
||||||
|
|
||||||
|
CREATE TABLE t1 (c1 INT, c2 TIMESTAMP, c3 REAL, c4 DOUBLE);
|
||||||
|
|
||||||
|
INSERT INTO t1 (c1, c2, c3, c4) VALUES (10, '1970-02-01 01:02:03', 1.1E-100, 1.1E+100);
|
||||||
|
SELECT * FROM t1;
|
||||||
|
|
||||||
|
--exec rm -f $MYSQLTEST_VARDIR/tmp/t1
|
||||||
|
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
|
||||||
|
eval SELECT * INTO OUTFILE '$MYSQLTEST_VARDIR/tmp/t1' FIELDS ENCLOSED BY '-' FROM t1;
|
||||||
|
--exec cat $MYSQLTEST_VARDIR/tmp/t1
|
||||||
|
--exec echo EOF
|
||||||
|
|
||||||
|
TRUNCATE t1;
|
||||||
|
|
||||||
|
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
|
||||||
|
eval LOAD DATA INFILE '$MYSQLTEST_VARDIR/tmp/t1' INTO TABLE t1 FIELDS ENCLOSED BY '-';
|
||||||
|
SELECT * FROM t1;
|
||||||
|
|
||||||
|
--exec rm $MYSQLTEST_VARDIR/tmp/t1
|
||||||
|
DROP TABLE t1;
|
||||||
|
|
||||||
# End of 5.0 tests
|
# End of 5.0 tests
|
||||||
|
|
||||||
|
|
||||||
|
@ -3348,6 +3348,60 @@ EXPLAIN SELECT a, SUM(b) FROM v1 WHERE a=1 GROUP BY a;
|
|||||||
DROP VIEW v1;
|
DROP VIEW v1;
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
|
|
||||||
|
#
|
||||||
|
# Bug #29392: SELECT over a multi-table view with ORDER BY
|
||||||
|
# selecting the same view column with two different aliases
|
||||||
|
#
|
||||||
|
|
||||||
|
CREATE TABLE t1 (
|
||||||
|
person_id int NOT NULL PRIMARY KEY,
|
||||||
|
username varchar(40) default NULL,
|
||||||
|
status_flg char(1) NOT NULL default 'A'
|
||||||
|
);
|
||||||
|
|
||||||
|
CREATE TABLE t2 (
|
||||||
|
person_role_id int NOT NULL auto_increment PRIMARY KEY,
|
||||||
|
role_id int NOT NULL,
|
||||||
|
person_id int NOT NULL,
|
||||||
|
INDEX idx_person_id (person_id),
|
||||||
|
INDEX idx_role_id (role_id)
|
||||||
|
);
|
||||||
|
|
||||||
|
CREATE TABLE t3 (
|
||||||
|
role_id int NOT NULL auto_increment PRIMARY KEY,
|
||||||
|
role_name varchar(100) default NULL,
|
||||||
|
app_name varchar(40) NOT NULL,
|
||||||
|
INDEX idx_app_name(app_name)
|
||||||
|
);
|
||||||
|
|
||||||
|
CREATE VIEW v1 AS
|
||||||
|
SELECT profile.person_id AS person_id
|
||||||
|
FROM t1 profile, t2 userrole, t3 role
|
||||||
|
WHERE userrole.person_id = profile.person_id AND
|
||||||
|
role.role_id = userrole.role_id AND
|
||||||
|
profile.status_flg = 'A'
|
||||||
|
ORDER BY profile.person_id,role.app_name,role.role_name;
|
||||||
|
|
||||||
|
INSERT INTO t1 VALUES
|
||||||
|
(6,'Sw','A'), (-1136332546,'ols','e'), (0,' *\n','0'),
|
||||||
|
(-717462680,'ENTS Ta','0'), (-904346964,'ndard SQL\n','0');
|
||||||
|
|
||||||
|
INSERT INTO t2 VALUES
|
||||||
|
(1,3,6),(2,4,7),(3,5,8),(4,6,9),(5,1,6),(6,1,7),(7,1,8),(8,1,9),(9,1,10);
|
||||||
|
|
||||||
|
INSERT INTO t3 VALUES
|
||||||
|
(1,'NUCANS_APP_USER','NUCANSAPP'),(2,'NUCANS_TRGAPP_USER','NUCANSAPP'),
|
||||||
|
(3,'IA_INTAKE_COORDINATOR','IACANS'),(4,'IA_SCREENER','IACANS'),
|
||||||
|
(5,'IA_SUPERVISOR','IACANS'),(6,'IA_READONLY','IACANS'),
|
||||||
|
(7,'SOC_USER','SOCCANS'),(8,'CAYIT_USER','CAYITCANS'),
|
||||||
|
(9,'RTOS_DCFSPOS_SUPERVISOR','RTOS');
|
||||||
|
|
||||||
|
EXPLAIN SELECT t.person_id AS a, t.person_id AS b FROM v1 t WHERE t.person_id=6;
|
||||||
|
SELECT t.person_id AS a, t.person_id AS b FROM v1 t WHERE t.person_id=6;
|
||||||
|
|
||||||
|
DROP VIEW v1;
|
||||||
|
DROP TABLE t1,t2,t3;
|
||||||
|
|
||||||
--echo End of 5.0 tests.
|
--echo End of 5.0 tests.
|
||||||
|
|
||||||
#
|
#
|
||||||
|
@ -2115,6 +2115,12 @@ public:
|
|||||||
|
|
||||||
bool fix_fields(THD *, Item **);
|
bool fix_fields(THD *, Item **);
|
||||||
bool eq(const Item *item, bool binary_cmp) const;
|
bool eq(const Item *item, bool binary_cmp) const;
|
||||||
|
Item *get_tmp_table_item(THD *thd)
|
||||||
|
{
|
||||||
|
Item *item= Item_ref::get_tmp_table_item(thd);
|
||||||
|
item->name= name;
|
||||||
|
return item;
|
||||||
|
}
|
||||||
virtual Ref_Type ref_type() { return VIEW_REF; }
|
virtual Ref_Type ref_type() { return VIEW_REF; }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -17,7 +17,28 @@
|
|||||||
|
|
||||||
#ifdef HAVE_SPATIAL
|
#ifdef HAVE_SPATIAL
|
||||||
|
|
||||||
#define MAX_DIGITS_IN_DOUBLE 16
|
/*
|
||||||
|
exponential notation :
|
||||||
|
1 sign
|
||||||
|
1 number before the decimal point
|
||||||
|
1 decimal point
|
||||||
|
14 number of significant digits (see String::qs_append(double))
|
||||||
|
1 'e' sign
|
||||||
|
1 exponent sign
|
||||||
|
3 exponent digits
|
||||||
|
==
|
||||||
|
22
|
||||||
|
|
||||||
|
"f" notation :
|
||||||
|
1 optional 0
|
||||||
|
1 sign
|
||||||
|
14 number significant digits (see String::qs_append(double) )
|
||||||
|
1 decimal point
|
||||||
|
==
|
||||||
|
17
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define MAX_DIGITS_IN_DOUBLE 22
|
||||||
|
|
||||||
/***************************** Gis_class_info *******************************/
|
/***************************** Gis_class_info *******************************/
|
||||||
|
|
||||||
|
@ -1446,6 +1446,7 @@ select_export::prepare(List<Item> &list, SELECT_LEX_UNIT *u)
|
|||||||
field_term_length ? (*exchange->field_term)[0] : INT_MAX);
|
field_term_length ? (*exchange->field_term)[0] : INT_MAX);
|
||||||
escape_char= (exchange->escaped->length() ? (*exchange->escaped)[0] : -1);
|
escape_char= (exchange->escaped->length() ? (*exchange->escaped)[0] : -1);
|
||||||
is_ambiguous_field_sep= test(strchr(ESCAPE_CHARS, field_sep_char));
|
is_ambiguous_field_sep= test(strchr(ESCAPE_CHARS, field_sep_char));
|
||||||
|
is_unsafe_field_sep= test(strchr(NUMERIC_CHARS, field_sep_char));
|
||||||
line_sep_char= (exchange->line_term->length() ?
|
line_sep_char= (exchange->line_term->length() ?
|
||||||
(*exchange->line_term)[0] : INT_MAX);
|
(*exchange->line_term)[0] : INT_MAX);
|
||||||
if (!field_term_length)
|
if (!field_term_length)
|
||||||
@ -1520,7 +1521,8 @@ bool select_export::send_data(List<Item> &items)
|
|||||||
used_length=min(res->length(),item->max_length);
|
used_length=min(res->length(),item->max_length);
|
||||||
else
|
else
|
||||||
used_length=res->length();
|
used_length=res->length();
|
||||||
if (result_type == STRING_RESULT && escape_char != -1)
|
if ((result_type == STRING_RESULT || is_unsafe_field_sep) &&
|
||||||
|
escape_char != -1)
|
||||||
{
|
{
|
||||||
char *pos, *start, *end;
|
char *pos, *start, *end;
|
||||||
CHARSET_INFO *res_charset= res->charset();
|
CHARSET_INFO *res_charset= res->charset();
|
||||||
|
@ -1952,6 +1952,12 @@ public:
|
|||||||
#define ESCAPE_CHARS "ntrb0ZN" // keep synchronous with READ_INFO::unescape
|
#define ESCAPE_CHARS "ntrb0ZN" // keep synchronous with READ_INFO::unescape
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
List of all possible characters of a numeric value text representation.
|
||||||
|
*/
|
||||||
|
#define NUMERIC_CHARS ".0123456789e+-"
|
||||||
|
|
||||||
|
|
||||||
class select_export :public select_to_file {
|
class select_export :public select_to_file {
|
||||||
uint field_term_length;
|
uint field_term_length;
|
||||||
int field_sep_char,escape_char,line_sep_char;
|
int field_sep_char,escape_char,line_sep_char;
|
||||||
@ -1961,6 +1967,12 @@ class select_export :public select_to_file {
|
|||||||
(see the READ_INFO::unescape method and the ESCAPE_CHARS constant value).
|
(see the READ_INFO::unescape method and the ESCAPE_CHARS constant value).
|
||||||
*/
|
*/
|
||||||
bool is_ambiguous_field_sep;
|
bool is_ambiguous_field_sep;
|
||||||
|
/*
|
||||||
|
The is_unsafe_field_sep field is true if a value of the field_sep_char
|
||||||
|
field is one of the '0'..'9', '+', '-', '.' and 'e' characters
|
||||||
|
(see the NUMERIC_CHARS constant value).
|
||||||
|
*/
|
||||||
|
bool is_unsafe_field_sep;
|
||||||
bool fixed_row_size;
|
bool fixed_row_size;
|
||||||
public:
|
public:
|
||||||
select_export(sql_exchange *ex) :select_to_file(ex) {}
|
select_export(sql_exchange *ex) :select_to_file(ex) {}
|
||||||
|
Reference in New Issue
Block a user