Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mariadb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
2cd4abeb
Commit
2cd4abeb
authored
Jun 24, 2007
by
gshchepa/uchum@gleb.loc
Browse files
Options
Browse Files
Download
Plain Diff
Merge gleb.loc:/home/uchum/work/bk/5.0-opt
into gleb.loc:/home/uchum/work/bk/5.1-opt
parents
38991f3e
e5798d04
Changes
15
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
303 additions
and
35 deletions
+303
-35
libmysql/libmysql.c
libmysql/libmysql.c
+16
-11
mysql-test/r/insert_select.result
mysql-test/r/insert_select.result
+31
-0
mysql-test/r/metadata.result
mysql-test/r/metadata.result
+41
-0
mysql-test/r/mysqlbinlog.result
mysql-test/r/mysqlbinlog.result
+6
-0
mysql-test/r/rpl_change_master.result
mysql-test/r/rpl_change_master.result
+68
-4
mysql-test/r/view.result
mysql-test/r/view.result
+24
-0
mysql-test/t/insert_select.test
mysql-test/t/insert_select.test
+25
-0
mysql-test/t/metadata.test
mysql-test/t/metadata.test
+21
-0
mysql-test/t/mysqlbinlog.test
mysql-test/t/mysqlbinlog.test
+15
-2
mysql-test/t/rpl_change_master.test
mysql-test/t/rpl_change_master.test
+4
-4
mysql-test/t/view.test
mysql-test/t/view.test
+24
-0
sql/item.cc
sql/item.cc
+19
-6
sql/item.h
sql/item.h
+1
-5
sql/log_event.cc
sql/log_event.cc
+0
-1
sql/sql_select.cc
sql/sql_select.cc
+8
-2
No files found.
libmysql/libmysql.c
View file @
2cd4abeb
...
@@ -3657,33 +3657,38 @@ static void fetch_long_with_conversion(MYSQL_BIND *param, MYSQL_FIELD *field,
...
@@ -3657,33 +3657,38 @@ static void fetch_long_with_conversion(MYSQL_BIND *param, MYSQL_FIELD *field,
case
MYSQL_TYPE_FLOAT
:
case
MYSQL_TYPE_FLOAT
:
{
{
/*
/*
We need to
store data in the buffer before the truncation check
to
We need to
mark the local variable volatile
to
workaround Intel FPU executive precision feature.
workaround Intel FPU executive precision feature.
(See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=323 for details)
(See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=323 for details)
AFAIU it does not guarantee to work.
*/
*/
float
data
;
volatile
float
data
;
if
(
is_unsigned
)
if
(
is_unsigned
)
{
data
=
(
float
)
ulonglong2double
(
value
);
data
=
(
float
)
ulonglong2double
(
value
);
*
param
->
error
=
((
ulonglong
)
value
)
!=
((
ulonglong
)
data
);
}
else
else
data
=
(
float
)
value
;
{
data
=
(
float
)
value
;
*
param
->
error
=
value
!=
((
longlong
)
data
);
}
floatstore
(
buffer
,
data
);
floatstore
(
buffer
,
data
);
*
param
->
error
=
is_unsigned
?
((
ulonglong
)
value
)
!=
((
ulonglong
)
(
*
(
float
*
)
buffer
))
:
((
longlong
)
value
)
!=
((
longlong
)
(
*
(
float
*
)
buffer
));
break
;
break
;
}
}
case
MYSQL_TYPE_DOUBLE
:
case
MYSQL_TYPE_DOUBLE
:
{
{
double
data
;
volatile
double
data
;
if
(
is_unsigned
)
if
(
is_unsigned
)
{
data
=
ulonglong2double
(
value
);
data
=
ulonglong2double
(
value
);
*
param
->
error
=
((
ulonglong
)
value
)
!=
((
ulonglong
)
data
);
}
else
else
{
data
=
(
double
)
value
;
data
=
(
double
)
value
;
*
param
->
error
=
value
!=
((
longlong
)
data
);
}
doublestore
(
buffer
,
data
);
doublestore
(
buffer
,
data
);
*
param
->
error
=
is_unsigned
?
((
ulonglong
)
value
)
!=
((
ulonglong
)
(
*
(
double
*
)
buffer
))
:
((
longlong
)
value
)
!=
((
longlong
)
(
*
(
double
*
)
buffer
));
break
;
break
;
}
}
case
MYSQL_TYPE_TIME
:
case
MYSQL_TYPE_TIME
:
...
...
mysql-test/r/insert_select.result
View file @
2cd4abeb
...
@@ -688,7 +688,16 @@ ERROR 42S22: Unknown column 't2.x' in 'field list'
...
@@ -688,7 +688,16 @@ ERROR 42S22: Unknown column 't2.x' in 'field list'
drop table t1,t2;
drop table t1,t2;
CREATE TABLE t1 (a int PRIMARY KEY);
CREATE TABLE t1 (a int PRIMARY KEY);
INSERT INTO t1 values (1), (2);
INSERT INTO t1 values (1), (2);
flush status;
INSERT INTO t1 SELECT a + 2 FROM t1 LIMIT 1;
INSERT INTO t1 SELECT a + 2 FROM t1 LIMIT 1;
show status like 'Handler_read%';
Variable_name Value
Handler_read_first 1
Handler_read_key 0
Handler_read_next 0
Handler_read_prev 0
Handler_read_rnd 0
Handler_read_rnd_next 1
DROP TABLE t1;
DROP TABLE t1;
CREATE TABLE t1 (x int, y int);
CREATE TABLE t1 (x int, y int);
CREATE TABLE t2 (z int, y int);
CREATE TABLE t2 (z int, y int);
...
@@ -759,3 +768,25 @@ d
...
@@ -759,3 +768,25 @@ d
20
20
20
20
DROP TABLE t1,t2;
DROP TABLE t1,t2;
CREATE TABLE t1 (
id INT AUTO_INCREMENT PRIMARY KEY,
prev_id INT,
join_id INT DEFAULT 0);
INSERT INTO t1 (prev_id) VALUES (NULL), (1), (2);
SELECT * FROM t1;
id prev_id join_id
1 NULL 0
2 1 0
3 2 0
CREATE TABLE t2 (join_id INT);
INSERT INTO t2 (join_id) VALUES (0);
INSERT INTO t1 (prev_id) SELECT id
FROM t2 LEFT JOIN t1 ON t1.join_id = t2.join_id
ORDER BY id DESC LIMIT 1;
SELECT * FROM t1;
id prev_id join_id
1 NULL 0
2 1 0
3 2 0
4 3 0
DROP TABLE t1,t2;
mysql-test/r/metadata.result
View file @
2cd4abeb
...
@@ -140,4 +140,45 @@ Catalog Database Table Table_alias Column Column_alias Type Length Max length Is
...
@@ -140,4 +140,45 @@ Catalog Database Table Table_alias Column Column_alias Type Length Max length Is
def a v_small v_small 3 9 9 N 32769 0 63
def a v_small v_small 3 9 9 N 32769 0 63
v_small
v_small
214748364
214748364
CREATE TABLE t1 (c1 CHAR(1));
CREATE TABLE t2 (c2 CHAR(1));
CREATE VIEW v1 AS SELECT t1.c1 FROM t1;
CREATE VIEW v2 AS SELECT t2.c2 FROM t2;
INSERT INTO t1 VALUES ('1'), ('2'), ('3');
INSERT INTO t2 VALUES ('1'), ('2'), ('3'), ('2');
SELECT v1.c1 FROM v1 JOIN t2 ON c1=c2 ORDER BY 1;
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
def test t1 v1 c1 c1 254 1 1 Y 0 0 8
c1
1
2
2
3
SELECT v1.c1, v2.c2 FROM v1 JOIN v2 ON c1=c2;
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
def test t1 v1 c1 c1 254 1 1 Y 0 0 8
def test t2 v2 c2 c2 254 1 1 Y 0 0 8
c1 c2
1 1
2 2
3 3
2 2
SELECT v1.c1, v2.c2 FROM v1 JOIN v2 ON c1=c2 GROUP BY v1.c1;
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
def test t1 v1 c1 c1 254 1 1 Y 32768 0 8
def test t2 v2 c2 c2 254 1 1 Y 0 0 8
c1 c2
1 1
2 2
3 3
SELECT v1.c1, v2.c2 FROM v1 JOIN v2 ON c1=c2 GROUP BY v1.c1 ORDER BY v2.c2;
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
def test t1 v1 c1 c1 254 1 1 Y 32768 0 8
def test t2 v2 c2 c2 254 1 1 Y 0 0 8
c1 c2
1 1
2 2
3 3
DROP VIEW v1,v2;
DROP TABLE t1,t2;
End of 5.0 tests
End of 5.0 tests
mysql-test/r/mysqlbinlog.result
View file @
2cd4abeb
...
@@ -313,6 +313,12 @@ DELIMITER ;
...
@@ -313,6 +313,12 @@ DELIMITER ;
# End of log file
# End of log file
ROLLBACK /* added by mysqlbinlog */;
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
CREATE TABLE t1 (c1 CHAR(10));
flush logs;
INSERT INTO t1 VALUES ('0123456789');
flush logs;
DROP TABLE t1;
# Query thread_id=REMOVED exec_time=REMOVED error_code=REMOVED
End of 5.0 tests
End of 5.0 tests
flush logs;
flush logs;
End of 5.1 tests
End of 5.1 tests
mysql-test/r/rpl_change_master.result
View file @
2cd4abeb
...
@@ -12,12 +12,76 @@ insert into t1 values(1);
...
@@ -12,12 +12,76 @@ insert into t1 values(1);
insert into t1 values(2);
insert into t1 values(2);
stop slave;
stop slave;
show slave status;
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 Master_SSL_Verify_Server_Cert
Slave_IO_State #
# 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 # # # master-bin.000001 No No 0 0 191 # None 0 No # No
Master_Host 127.0.0.1
Master_User root
Master_Port MASTER_MYPORT
Connect_Retry 1
Master_Log_File master-bin.000001
Read_Master_Log_Pos #
Relay_Log_File #
Relay_Log_Pos #
Relay_Master_Log_File master-bin.000001
Slave_IO_Running No
Slave_SQL_Running No
Replicate_Do_DB
Replicate_Ignore_DB
Replicate_Do_Table
Replicate_Ignore_Table
Replicate_Wild_Do_Table
Replicate_Wild_Ignore_Table
Last_Errno 0
Last_Error
Skip_Counter 0
Exec_Master_Log_Pos #
Relay_Log_Space #
Until_Condition None
Until_Log_File
Until_Log_Pos 0
Master_SSL_Allowed No
Master_SSL_CA_File
Master_SSL_CA_Path
Master_SSL_Cert
Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
Master_SSL_Verify_Server_Cert No
change master to master_user='root';
change master to master_user='root';
show slave status;
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 Master_SSL_Verify_Server_Cert
Slave_IO_State #
# 127.0.0.1 root MASTER_MYPORT 1 master-bin.000001 # # # master-bin.000001 No No 0 0 191 # None 0 No # No
Master_Host 127.0.0.1
Master_User root
Master_Port MASTER_MYPORT
Connect_Retry 1
Master_Log_File master-bin.000001
Read_Master_Log_Pos #
Relay_Log_File #
Relay_Log_Pos #
Relay_Master_Log_File master-bin.000001
Slave_IO_Running No
Slave_SQL_Running No
Replicate_Do_DB
Replicate_Ignore_DB
Replicate_Do_Table
Replicate_Ignore_Table
Replicate_Wild_Do_Table
Replicate_Wild_Ignore_Table
Last_Errno 0
Last_Error
Skip_Counter 0
Exec_Master_Log_Pos #
Relay_Log_Space #
Until_Condition None
Until_Log_File
Until_Log_Pos 0
Master_SSL_Allowed No
Master_SSL_CA_File
Master_SSL_CA_Path
Master_SSL_Cert
Master_SSL_Cipher
Master_SSL_Key
Seconds_Behind_Master #
Master_SSL_Verify_Server_Cert No
start slave;
start slave;
select * from t1;
select * from t1;
n
n
...
...
mysql-test/r/view.result
View file @
2cd4abeb
...
@@ -3468,6 +3468,30 @@ a1 c
...
@@ -3468,6 +3468,30 @@ a1 c
2 0
2 0
DROP VIEW v1,v2;
DROP VIEW v1,v2;
DROP TABLE t1,t2,t3,t4;
DROP TABLE t1,t2,t3,t4;
CREATE TABLE t1 (a int, b int);
INSERT INTO t1 VALUES (1,2), (2,2), (1,3), (1,2);
CREATE VIEW v1 AS SELECT a, b+1 as b FROM t1;
SELECT b, SUM(a) FROM v1 WHERE b=3 GROUP BY b;
b SUM(a)
3 4
EXPLAIN SELECT b, SUM(a) FROM v1 WHERE b=3 GROUP BY b;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using where
SELECT a, SUM(b) FROM v1 WHERE b=3 GROUP BY a;
a SUM(b)
1 6
2 3
EXPLAIN SELECT a, SUM(b) FROM v1 WHERE b=3 GROUP BY a;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using where; Using temporary; Using filesort
SELECT a, SUM(b) FROM v1 WHERE a=1 GROUP BY a;
a SUM(b)
1 10
EXPLAIN SELECT a, SUM(b) FROM v1 WHERE a=1 GROUP BY a;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using where
DROP VIEW v1;
DROP TABLE t1;
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`;
...
...
mysql-test/t/insert_select.test
View file @
2cd4abeb
...
@@ -233,7 +233,9 @@ drop table t1,t2;
...
@@ -233,7 +233,9 @@ drop table t1,t2;
CREATE
TABLE
t1
(
a
int
PRIMARY
KEY
);
CREATE
TABLE
t1
(
a
int
PRIMARY
KEY
);
INSERT
INTO
t1
values
(
1
),
(
2
);
INSERT
INTO
t1
values
(
1
),
(
2
);
flush
status
;
INSERT
INTO
t1
SELECT
a
+
2
FROM
t1
LIMIT
1
;
INSERT
INTO
t1
SELECT
a
+
2
FROM
t1
LIMIT
1
;
show
status
like
'Handler_read%'
;
DROP
TABLE
t1
;
DROP
TABLE
t1
;
...
@@ -319,3 +321,26 @@ INSERT INTO t2 (d)
...
@@ -319,3 +321,26 @@ INSERT INTO t2 (d)
SELECT
*
FROM
t2
;
SELECT
*
FROM
t2
;
DROP
TABLE
t1
,
t2
;
DROP
TABLE
t1
,
t2
;
#
# Bug #29095: incorrect pushing of LIMIT into the temporary
# table ignoring ORDER BY clause
#
CREATE
TABLE
t1
(
id
INT
AUTO_INCREMENT
PRIMARY
KEY
,
prev_id
INT
,
join_id
INT
DEFAULT
0
);
INSERT
INTO
t1
(
prev_id
)
VALUES
(
NULL
),
(
1
),
(
2
);
SELECT
*
FROM
t1
;
CREATE
TABLE
t2
(
join_id
INT
);
INSERT
INTO
t2
(
join_id
)
VALUES
(
0
);
INSERT
INTO
t1
(
prev_id
)
SELECT
id
FROM
t2
LEFT
JOIN
t1
ON
t1
.
join_id
=
t2
.
join_id
ORDER
BY
id
DESC
LIMIT
1
;
SELECT
*
FROM
t1
;
DROP
TABLE
t1
,
t2
;
mysql-test/t/metadata.test
View file @
2cd4abeb
...
@@ -90,5 +90,26 @@ select a.* from (select 2147483648 as v_large) a;
...
@@ -90,5 +90,26 @@ select a.* from (select 2147483648 as v_large) a;
select
a
.*
from
(
select
214748364
as
v_small
)
a
;
select
a
.*
from
(
select
214748364
as
v_small
)
a
;
--
disable_metadata
--
disable_metadata
#
# Bug #28898: table alias and database name of VIEW columns is empty in the
# metadata of # SELECT statement where join is executed via temporary table.
#
CREATE
TABLE
t1
(
c1
CHAR
(
1
));
CREATE
TABLE
t2
(
c2
CHAR
(
1
));
CREATE
VIEW
v1
AS
SELECT
t1
.
c1
FROM
t1
;
CREATE
VIEW
v2
AS
SELECT
t2
.
c2
FROM
t2
;
INSERT
INTO
t1
VALUES
(
'1'
),
(
'2'
),
(
'3'
);
INSERT
INTO
t2
VALUES
(
'1'
),
(
'2'
),
(
'3'
),
(
'2'
);
--
enable_metadata
SELECT
v1
.
c1
FROM
v1
JOIN
t2
ON
c1
=
c2
ORDER
BY
1
;
SELECT
v1
.
c1
,
v2
.
c2
FROM
v1
JOIN
v2
ON
c1
=
c2
;
SELECT
v1
.
c1
,
v2
.
c2
FROM
v1
JOIN
v2
ON
c1
=
c2
GROUP
BY
v1
.
c1
;
SELECT
v1
.
c1
,
v2
.
c2
FROM
v1
JOIN
v2
ON
c1
=
c2
GROUP
BY
v1
.
c1
ORDER
BY
v2
.
c2
;
--
disable_metadata
DROP
VIEW
v1
,
v2
;
DROP
TABLE
t1
,
t2
;
--
echo
End
of
5.0
tests
--
echo
End
of
5.0
tests
mysql-test/t/mysqlbinlog.test
View file @
2cd4abeb
...
@@ -206,6 +206,19 @@ flush logs;
...
@@ -206,6 +206,19 @@ flush logs;
--
replace_result
$MYSQLTEST_VARDIR
MYSQLTEST_VARDIR
--
replace_result
$MYSQLTEST_VARDIR
MYSQLTEST_VARDIR
--
exec
$MYSQL_BINLOG
--
short
-
form
--
local
-
load
=
$MYSQLTEST_VARDIR
/
tmp
/
$MYSQLTEST_VARDIR
/
log
/
master
-
bin
.
000010
--
exec
$MYSQL_BINLOG
--
short
-
form
--
local
-
load
=
$MYSQLTEST_VARDIR
/
tmp
/
$MYSQLTEST_VARDIR
/
log
/
master
-
bin
.
000010
#
# Bug#28293 missed '#' sign in the hex dump when the dump length
# is divisible by 16.
#
CREATE
TABLE
t1
(
c1
CHAR
(
10
));
# we need this for getting fixed timestamps inside of this test
flush
logs
;
INSERT
INTO
t1
VALUES
(
'0123456789'
);
flush
logs
;
DROP
TABLE
t1
;
--
exec
$MYSQL_BINLOG
--
hexdump
--
local
-
load
=
$MYSQLTEST_VARDIR
/
tmp
/
$MYSQLTEST_VARDIR
/
log
/
master
-
bin
.
000012
|
grep
'Query'
|
sed
's/[0-9]\{1,\}/REMOVED/g'
--
echo
End
of
5.0
tests
--
echo
End
of
5.0
tests
#
#
...
@@ -213,7 +226,7 @@ flush logs;
...
@@ -213,7 +226,7 @@ flush logs;
#
#
flush
logs
;
flush
logs
;
--
error
1
--
error
1
--
exec
$MYSQL_BINLOG
$MYSQLTEST_VARDIR
/
log
/
master
-
bin
.
00001
2
>/
dev
/
null
2
>/
dev
/
null
--
exec
$MYSQL_BINLOG
$MYSQLTEST_VARDIR
/
log
/
master
-
bin
.
00001
4
>/
dev
/
null
2
>/
dev
/
null
--
exec
$MYSQL_BINLOG
--
force
-
if
-
open
$MYSQLTEST_VARDIR
/
log
/
master
-
bin
.
00001
2
>/
dev
/
null
2
>/
dev
/
null
--
exec
$MYSQL_BINLOG
--
force
-
if
-
open
$MYSQLTEST_VARDIR
/
log
/
master
-
bin
.
00001
4
>/
dev
/
null
2
>/
dev
/
null
--
echo
End
of
5.1
tests
--
echo
End
of
5.1
tests
mysql-test/t/rpl_change_master.test
View file @
2cd4abeb
...
@@ -19,12 +19,12 @@ connection slave;
...
@@ -19,12 +19,12 @@ connection slave;
--
real_sleep
3
# wait for I/O thread to have read updates
--
real_sleep
3
# wait for I/O thread to have read updates
stop
slave
;
stop
slave
;
--
replace_result
$MASTER_MYPORT
MASTER_MYPORT
--
replace_result
$MASTER_MYPORT
MASTER_MYPORT
--
replace_column
1
# 7 # 8 # 9 # 23 # 33 #
--
replace_column
1
# 7 # 8 # 9 # 2
2 # 2
3 # 33 #
show
slave
status
;
query_vertical
show
slave
status
;
change
master
to
master_user
=
'root'
;
change
master
to
master_user
=
'root'
;
--
replace_result
$MASTER_MYPORT
MASTER_MYPORT
--
replace_result
$MASTER_MYPORT
MASTER_MYPORT
--
replace_column
1
# 7 # 8 # 9 # 23 # 33 #
--
replace_column
1
# 7 # 8 # 9 # 2
2 # 2
3 # 33 #
show
slave
status
;
query_vertical
show
slave
status
;
start
slave
;
start
slave
;
sync_with_master
;
sync_with_master
;
select
*
from
t1
;
select
*
from
t1
;
...
...
mysql-test/t/view.test
View file @
2cd4abeb
...
@@ -3316,6 +3316,30 @@ SELECT * FROM t1;
...
@@ -3316,6 +3316,30 @@ SELECT * FROM t1;
DROP
VIEW
v1
,
v2
;
DROP
VIEW
v1
,
v2
;
DROP
TABLE
t1
,
t2
,
t3
,
t4
;
DROP
TABLE
t1
,
t2
,
t3
,
t4
;
#
# Bug #29104: assertion abort for a query with a view column reference
# in the GROUP BY list and a condition requiring the value
# of another view column to be equal to a constant
#
CREATE
TABLE
t1
(
a
int
,
b
int
);
INSERT
INTO
t1
VALUES
(
1
,
2
),
(
2
,
2
),
(
1
,
3
),
(
1
,
2
);
CREATE
VIEW
v1
AS
SELECT
a
,
b
+
1
as
b
FROM
t1
;
SELECT
b
,
SUM
(
a
)
FROM
v1
WHERE
b
=
3
GROUP
BY
b
;
EXPLAIN
SELECT
b
,
SUM
(
a
)
FROM
v1
WHERE
b
=
3
GROUP
BY
b
;
SELECT
a
,
SUM
(
b
)
FROM
v1
WHERE
b
=
3
GROUP
BY
a
;
EXPLAIN
SELECT
a
,
SUM
(
b
)
FROM
v1
WHERE
b
=
3
GROUP
BY
a
;
SELECT
a
,
SUM
(
b
)
FROM
v1
WHERE
a
=
1
GROUP
BY
a
;
EXPLAIN
SELECT
a
,
SUM
(
b
)
FROM
v1
WHERE
a
=
1
GROUP
BY
a
;
DROP
VIEW
v1
;
DROP
TABLE
t1
;
--
echo
End
of
5.0
tests
.
--
echo
End
of
5.0
tests
.
#
#
...
...
sql/item.cc
View file @
2cd4abeb
...
@@ -1974,10 +1974,11 @@ bool Item_field::val_bool_result()
...
@@ -1974,10 +1974,11 @@ bool Item_field::val_bool_result()
bool
Item_field
::
eq
(
const
Item
*
item
,
bool
binary_cmp
)
const
bool
Item_field
::
eq
(
const
Item
*
item
,
bool
binary_cmp
)
const
{
{
if
(
item
->
type
()
!=
FIELD_ITEM
)
Item
*
real_item
=
((
Item
*
)
item
)
->
real_item
();
if
(
real_item
->
type
()
!=
FIELD_ITEM
)
return
0
;
return
0
;
Item_field
*
item_field
=
(
Item_field
*
)
item
;
Item_field
*
item_field
=
(
Item_field
*
)
real_
item
;
if
(
item_field
->
field
&&
field
)
if
(
item_field
->
field
&&
field
)
return
item_field
->
field
==
field
;
return
item_field
->
field
==
field
;
/*
/*
...
@@ -5592,6 +5593,21 @@ void Item_ref::make_field(Send_field *field)
...
@@ -5592,6 +5593,21 @@ void Item_ref::make_field(Send_field *field)
}
}
Item
*
Item_ref
::
get_tmp_table_item
(
THD
*
thd
)
{
if
(
!
result_field
)
return
(
*
ref
)
->
get_tmp_table_item
(
thd
);
Item_field
*
item
=
new
Item_field
(
result_field
);
if
(
item
)
{
item
->
table_name
=
table_name
;
item
->
db_name
=
db_name
;
}
return
item
;
}
void
Item_ref_null_helper
::
print
(
String
*
str
)
void
Item_ref_null_helper
::
print
(
String
*
str
)
{
{
str
->
append
(
STRING_WITH_LEN
(
"<ref_null_helper>("
));
str
->
append
(
STRING_WITH_LEN
(
"<ref_null_helper>("
));
...
@@ -5718,8 +5734,7 @@ bool Item_outer_ref::fix_fields(THD *thd, Item **reference)
...
@@ -5718,8 +5734,7 @@ bool Item_outer_ref::fix_fields(THD *thd, Item **reference)
DESCRIPTION
DESCRIPTION
A view column reference is considered equal to another column
A view column reference is considered equal to another column
reference if the second one is a view column and if both column
reference if the second one is a view column and if both column
references resolve to the same item. It is assumed that both
references resolve to the same item.
items are of the same type.
RETURN
RETURN
TRUE Referenced item is equal to given item
TRUE Referenced item is equal to given item
...
@@ -5735,8 +5750,6 @@ bool Item_direct_view_ref::eq(const Item *item, bool binary_cmp) const
...
@@ -5735,8 +5750,6 @@ bool Item_direct_view_ref::eq(const Item *item, bool binary_cmp) const
if
(
item_ref
->
ref_type
()
==
VIEW_REF
)
if
(
item_ref
->
ref_type
()
==
VIEW_REF
)
{
{
Item
*
item_ref_ref
=
*
(
item_ref
->
ref
);
Item
*
item_ref_ref
=
*
(
item_ref
->
ref
);
DBUG_ASSERT
((
*
ref
)
->
real_item
()
->
type
()
==
item_ref_ref
->
real_item
()
->
type
());
return
((
*
ref
)
->
real_item
()
==
item_ref_ref
->
real_item
());
return
((
*
ref
)
->
real_item
()
==
item_ref_ref
->
real_item
());
}
}
}
}
...
...
sql/item.h
View file @
2cd4abeb
...
@@ -2031,11 +2031,7 @@ public:
...
@@ -2031,11 +2031,7 @@ public:
enum_field_types
field_type
()
const
{
return
(
*
ref
)
->
field_type
();
}
enum_field_types
field_type
()
const
{
return
(
*
ref
)
->
field_type
();
}
Field
*
get_tmp_table_field
()
Field
*
get_tmp_table_field
()
{
return
result_field
?
result_field
:
(
*
ref
)
->
get_tmp_table_field
();
}
{
return
result_field
?
result_field
:
(
*
ref
)
->
get_tmp_table_field
();
}
Item
*
get_tmp_table_item
(
THD
*
thd
)
Item
*
get_tmp_table_item
(
THD
*
thd
);
{
return
(
result_field
?
new
Item_field
(
result_field
)
:
(
*
ref
)
->
get_tmp_table_item
(
thd
));
}
table_map
used_tables
()
const
table_map
used_tables
()
const
{
{
return
depended_from
?
OUTER_REF_TABLE_BIT
:
(
*
ref
)
->
used_tables
();
return
depended_from
?
OUTER_REF_TABLE_BIT
:
(
*
ref
)
->
used_tables
();
...
...
sql/log_event.cc
View file @
2cd4abeb
...
@@ -1133,7 +1133,6 @@ void Log_event::print_header(IO_CACHE* file,
...
@@ -1133,7 +1133,6 @@ void Log_event::print_header(IO_CACHE* file,
}
}
*
c
=
'\0'
;
*
c
=
'\0'
;
/* Non-full last line */
if
(
hex_string
[
0
])
if
(
hex_string
[
0
])
{
{
char
emit_buf
[
256
];
char
emit_buf
[
256
];
...
...
sql/sql_select.cc
View file @
2cd4abeb
...
@@ -1355,8 +1355,7 @@ JOIN::optimize()
...
@@ -1355,8 +1355,7 @@ JOIN::optimize()
there are aggregate functions, because in all these cases we need
there are aggregate functions, because in all these cases we need
all result rows.
all result rows.
*/
*/
ha_rows
tmp_rows_limit
=
((
order
==
0
||
skip_sort_order
||
ha_rows
tmp_rows_limit
=
((
order
==
0
||
skip_sort_order
)
&&
test
(
select_options
&
OPTION_BUFFER_RESULT
))
&&
!
tmp_group
&&
!
tmp_group
&&
!
thd
->
lex
->
current_select
->
with_sum_func
)
?
!
thd
->
lex
->
current_select
->
with_sum_func
)
?
select_limit
:
HA_POS_ERROR
;
select_limit
:
HA_POS_ERROR
;
...
@@ -14542,6 +14541,13 @@ change_to_use_tmp_fields(THD *thd, Item **ref_pointer_array,
...
@@ -14542,6 +14541,13 @@ change_to_use_tmp_fields(THD *thd, Item **ref_pointer_array,
if
(
!
item_field
)
if
(
!
item_field
)
DBUG_RETURN
(
TRUE
);
// Fatal error
DBUG_RETURN
(
TRUE
);
// Fatal error
item_field
->
name
=
item
->
name
;
item_field
->
name
=
item
->
name
;
if
(
item
->
type
()
==
Item
::
REF_ITEM
)
{
Item_field
*
ifield
=
(
Item_field
*
)
item_field
;
Item_ref
*
iref
=
(
Item_ref
*
)
item
;
ifield
->
table_name
=
iref
->
table_name
;
ifield
->
db_name
=
iref
->
db_name
;
}
#ifndef DBUG_OFF
#ifndef DBUG_OFF
if
(
!
item_field
->
name
)
if
(
!
item_field
->
name
)
{
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment