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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
e91bf15d
Commit
e91bf15d
authored
Jan 19, 2008
by
kaa@kaamos.(none)
Browse files
Options
Browse Files
Download
Plain Diff
Merge kaamos.(none):/data/src/opt/mysql-5.0-opt
into kaamos.(none):/data/src/opt/mysql-5.1-opt
parents
f8fb6e93
e3e370dd
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
175 additions
and
4 deletions
+175
-4
mysql-test/r/group_by.result
mysql-test/r/group_by.result
+36
-0
mysql-test/r/subselect.result
mysql-test/r/subselect.result
+48
-0
mysql-test/r/view.result
mysql-test/r/view.result
+16
-0
mysql-test/t/group_by.test
mysql-test/t/group_by.test
+1
-2
mysql-test/t/subselect.test
mysql-test/t/subselect.test
+55
-0
mysql-test/t/type_decimal.test
mysql-test/t/type_decimal.test
+1
-0
mysql-test/t/view.test
mysql-test/t/view.test
+14
-0
sql/sql_insert.cc
sql/sql_insert.cc
+2
-1
sql/sql_select.cc
sql/sql_select.cc
+2
-1
No files found.
mysql-test/r/group_by.result
View file @
e91bf15d
...
@@ -1128,6 +1128,42 @@ id c1 c2
...
@@ -1128,6 +1128,42 @@ id c1 c2
4 2 3
4 2 3
1 5 1
1 5 1
DROP TABLE t1;
DROP TABLE t1;
CREATE TABLE t1 ( a INT, b INT );
SELECT b c, (SELECT a FROM t1 WHERE b = c)
FROM t1;
c (SELECT a FROM t1 WHERE b = c)
SELECT b c, (SELECT a FROM t1 WHERE b = c)
FROM t1
HAVING b = 10;
c (SELECT a FROM t1 WHERE b = c)
SELECT MAX(b) c, (SELECT a FROM t1 WHERE b = c)
FROM t1
HAVING b = 10;
ERROR 42S22: Reference 'c' not supported (reference to group function)
SET @old_sql_mode = @@sql_mode;
SET @@sql_mode='ONLY_FULL_GROUP_BY';
SELECT b c, (SELECT a FROM t1 WHERE b = c)
FROM t1;
c (SELECT a FROM t1 WHERE b = c)
SELECT b c, (SELECT a FROM t1 WHERE b = c)
FROM t1
HAVING b = 10;
ERROR 42000: non-grouping field 'b' is used in HAVING clause
SELECT MAX(b) c, (SELECT a FROM t1 WHERE b = c)
FROM t1
HAVING b = 10;
ERROR 42S22: Reference 'c' not supported (reference to group function)
INSERT INTO t1 VALUES (1, 1);
SELECT b c, (SELECT a FROM t1 WHERE b = c)
FROM t1;
c (SELECT a FROM t1 WHERE b = c)
1 1
INSERT INTO t1 VALUES (2, 1);
SELECT b c, (SELECT a FROM t1 WHERE b = c)
FROM t1;
ERROR 21000: Subquery returns more than 1 row
DROP TABLE t1;
SET @@sql_mode = @old_sql_mode;
End of 5.0 tests
End of 5.0 tests
CREATE TABLE t1 (a INT, b INT,
CREATE TABLE t1 (a INT, b INT,
PRIMARY KEY (a),
PRIMARY KEY (a),
...
...
mysql-test/r/subselect.result
View file @
e91bf15d
...
@@ -4291,6 +4291,54 @@ select count(*) from t1 where f12 =
...
@@ -4291,6 +4291,54 @@ select count(*) from t1 where f12 =
count(*)
count(*)
3
3
drop table t1,t2;
drop table t1,t2;
CREATE TABLE t4 (
f7 varchar(32) collate utf8_bin NOT NULL default '',
f10 varchar(32) collate utf8_bin default NULL,
PRIMARY KEY (f7)
);
INSERT INTO t4 VALUES(1,1), (2,null);
CREATE TABLE t2 (
f4 varchar(32) collate utf8_bin NOT NULL default '',
f2 varchar(50) collate utf8_bin default NULL,
f3 varchar(10) collate utf8_bin default NULL,
PRIMARY KEY (f4),
UNIQUE KEY uk1 (f2)
);
INSERT INTO t2 VALUES(1,1,null), (2,2,null);
CREATE TABLE t1 (
f8 varchar(32) collate utf8_bin NOT NULL default '',
f1 varchar(10) collate utf8_bin default NULL,
f9 varchar(32) collate utf8_bin default NULL,
PRIMARY KEY (f8)
);
INSERT INTO t1 VALUES (1,'P',1), (2,'P',1), (3,'R',2);
CREATE TABLE t3 (
f6 varchar(32) collate utf8_bin NOT NULL default '',
f5 varchar(50) collate utf8_bin default NULL,
PRIMARY KEY (f6)
);
INSERT INTO t3 VALUES (1,null), (2,null);
SELECT
IF(t1.f1 = 'R', a1.f2, t2.f2) AS a4,
IF(t1.f1 = 'R', a1.f3, t2.f3) AS f3,
SUM(
IF(
(SELECT VPC.f2
FROM t2 VPC, t4 a2, t2 a3
WHERE
VPC.f4 = a2.f10 AND a3.f2 = a4
LIMIT 1) IS NULL,
0,
t3.f5
)
) AS a6
FROM
t2, t3, t1 JOIN t2 a1 ON t1.f9 = a1.f4
GROUP BY a4;
a4 f3 a6
1 NULL NULL
2 NULL NULL
DROP TABLE t1, t2;
End of 5.0 tests.
End of 5.0 tests.
CREATE TABLE t1 (a int, b int);
CREATE TABLE t1 (a int, b int);
INSERT INTO t1 VALUES (2,22),(1,11),(2,22);
INSERT INTO t1 VALUES (2,22),(1,11),(2,22);
...
...
mysql-test/r/view.result
View file @
e91bf15d
...
@@ -3597,6 +3597,22 @@ DROP VIEW v1;
...
@@ -3597,6 +3597,22 @@ DROP VIEW v1;
DROP VIEW v2;
DROP VIEW v2;
DROP VIEW v3;
DROP VIEW v3;
DROP TABLE t1;
DROP TABLE t1;
#
# Bug#29477: Not all fields of the target table were checked to have
# a default value when inserting into a view.
#
create table t1(f1 int, f2 int not null);
create view v1 as select f1 from t1;
insert into v1 values(1);
Warnings:
Warning 1423 Field of view 'test.v1' underlying table doesn't have a default value
set @old_mode=@@sql_mode;
set @@sql_mode=traditional;
insert into v1 values(1);
ERROR HY000: Field of view 'test.v1' underlying table doesn't have a default value
set @@sql_mode=@old_mode;
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/group_by.test
View file @
e91bf15d
...
@@ -789,8 +789,6 @@ select t1.f1,t.* from t1, t1 t group by 1;
...
@@ -789,8 +789,6 @@ select t1.f1,t.* from t1, t1 t group by 1;
drop
table
t1
;
drop
table
t1
;
SET
SQL_MODE
=
''
;
SET
SQL_MODE
=
''
;
#
#
#
# Bug #32202: ORDER BY not working with GROUP BY
# Bug #32202: ORDER BY not working with GROUP BY
#
#
...
@@ -824,6 +822,7 @@ SELECT * FROM t1 GROUP BY c2 ORDER BY c2 DESC, c1 DESC;
...
@@ -824,6 +822,7 @@ SELECT * FROM t1 GROUP BY c2 ORDER BY c2 DESC, c1 DESC;
DROP
TABLE
t1
;
DROP
TABLE
t1
;
--
echo
End
of
5.0
tests
--
echo
End
of
5.0
tests
# Bug #21174: Index degrades sort performance and
# Bug #21174: Index degrades sort performance and
# optimizer does not honor IGNORE INDEX.
# optimizer does not honor IGNORE INDEX.
...
...
mysql-test/t/subselect.test
View file @
e91bf15d
...
@@ -3159,6 +3159,60 @@ select count(*) from t1 where f12 =
...
@@ -3159,6 +3159,60 @@ select count(*) from t1 where f12 =
drop
table
t1
,
t2
;
drop
table
t1
,
t2
;
#
# BUG#33794 "MySQL crashes executing specific query on specific dump"
#
CREATE
TABLE
t4
(
f7
varchar
(
32
)
collate
utf8_bin
NOT
NULL
default
''
,
f10
varchar
(
32
)
collate
utf8_bin
default
NULL
,
PRIMARY
KEY
(
f7
)
);
INSERT
INTO
t4
VALUES
(
1
,
1
),
(
2
,
null
);
CREATE
TABLE
t2
(
f4
varchar
(
32
)
collate
utf8_bin
NOT
NULL
default
''
,
f2
varchar
(
50
)
collate
utf8_bin
default
NULL
,
f3
varchar
(
10
)
collate
utf8_bin
default
NULL
,
PRIMARY
KEY
(
f4
),
UNIQUE
KEY
uk1
(
f2
)
);
INSERT
INTO
t2
VALUES
(
1
,
1
,
null
),
(
2
,
2
,
null
);
CREATE
TABLE
t1
(
f8
varchar
(
32
)
collate
utf8_bin
NOT
NULL
default
''
,
f1
varchar
(
10
)
collate
utf8_bin
default
NULL
,
f9
varchar
(
32
)
collate
utf8_bin
default
NULL
,
PRIMARY
KEY
(
f8
)
);
INSERT
INTO
t1
VALUES
(
1
,
'P'
,
1
),
(
2
,
'P'
,
1
),
(
3
,
'R'
,
2
);
CREATE
TABLE
t3
(
f6
varchar
(
32
)
collate
utf8_bin
NOT
NULL
default
''
,
f5
varchar
(
50
)
collate
utf8_bin
default
NULL
,
PRIMARY
KEY
(
f6
)
);
INSERT
INTO
t3
VALUES
(
1
,
null
),
(
2
,
null
);
SELECT
IF
(
t1
.
f1
=
'R'
,
a1
.
f2
,
t2
.
f2
)
AS
a4
,
IF
(
t1
.
f1
=
'R'
,
a1
.
f3
,
t2
.
f3
)
AS
f3
,
SUM
(
IF
(
(
SELECT
VPC
.
f2
FROM
t2
VPC
,
t4
a2
,
t2
a3
WHERE
VPC
.
f4
=
a2
.
f10
AND
a3
.
f2
=
a4
LIMIT
1
)
IS
NULL
,
0
,
t3
.
f5
)
)
AS
a6
FROM
t2
,
t3
,
t1
JOIN
t2
a1
ON
t1
.
f9
=
a1
.
f4
GROUP
BY
a4
;
DROP
TABLE
t1
,
t2
;
--
echo
End
of
5.0
tests
.
--
echo
End
of
5.0
tests
.
#
#
...
@@ -3194,3 +3248,4 @@ CREATE TABLE t1 (s1 char(1));
...
@@ -3194,3 +3248,4 @@ CREATE TABLE t1 (s1 char(1));
INSERT
INTO
t1
VALUES
(
'a'
);
INSERT
INTO
t1
VALUES
(
'a'
);
SELECT
*
FROM
t1
WHERE
_utf8
'a'
=
ANY
(
SELECT
s1
FROM
t1
);
SELECT
*
FROM
t1
WHERE
_utf8
'a'
=
ANY
(
SELECT
s1
FROM
t1
);
DROP
TABLE
t1
;
DROP
TABLE
t1
;
mysql-test/t/type_decimal.test
View file @
e91bf15d
...
@@ -477,6 +477,7 @@ show create table t1;
...
@@ -477,6 +477,7 @@ show create table t1;
select
round
(
a
,
b
)
as
c
from
t1
order
by
c
;
select
round
(
a
,
b
)
as
c
from
t1
order
by
c
;
DROP
TABLE
t1
,
t2
,
t3
,
t4
;
DROP
TABLE
t1
,
t2
,
t3
,
t4
;
#
#
# Bug #33143: Incorrect ORDER BY for ROUND()/TRUNCATE() result
# Bug #33143: Incorrect ORDER BY for ROUND()/TRUNCATE() result
#
#
...
...
mysql-test/t/view.test
View file @
e91bf15d
...
@@ -3453,6 +3453,20 @@ DROP VIEW v2;
...
@@ -3453,6 +3453,20 @@ DROP VIEW v2;
DROP
VIEW
v3
;
DROP
VIEW
v3
;
DROP
TABLE
t1
;
DROP
TABLE
t1
;
--
echo
#
--
echo
# Bug#29477: Not all fields of the target table were checked to have
--
echo
# a default value when inserting into a view.
--
echo
#
create
table
t1
(
f1
int
,
f2
int
not
null
);
create
view
v1
as
select
f1
from
t1
;
insert
into
v1
values
(
1
);
set
@
old_mode
=@@
sql_mode
;
set
@@
sql_mode
=
traditional
;
--
error
ER_NO_DEFAULT_FOR_VIEW_FIELD
insert
into
v1
values
(
1
);
set
@@
sql_mode
=@
old_mode
;
drop
view
v1
;
drop
table
t1
;
--
echo
End
of
5.0
tests
.
--
echo
End
of
5.0
tests
.
...
...
sql/sql_insert.cc
View file @
e91bf15d
...
@@ -619,7 +619,8 @@ bool mysql_insert(THD *thd,TABLE_LIST *table_list,
...
@@ -619,7 +619,8 @@ bool mysql_insert(THD *thd,TABLE_LIST *table_list,
if
(
mysql_prepare_insert
(
thd
,
table_list
,
table
,
fields
,
values
,
if
(
mysql_prepare_insert
(
thd
,
table_list
,
table
,
fields
,
values
,
update_fields
,
update_values
,
duplic
,
&
unused_conds
,
update_fields
,
update_values
,
duplic
,
&
unused_conds
,
FALSE
,
FALSE
,
(
fields
.
elements
||
!
value_count
),
(
fields
.
elements
||
!
value_count
||
table_list
->
view
!=
0
),
!
ignore
&&
(
thd
->
variables
.
sql_mode
&
!
ignore
&&
(
thd
->
variables
.
sql_mode
&
(
MODE_STRICT_TRANS_TABLES
|
(
MODE_STRICT_TRANS_TABLES
|
MODE_STRICT_ALL_TABLES
))))
MODE_STRICT_ALL_TABLES
))))
...
...
sql/sql_select.cc
View file @
e91bf15d
...
@@ -5552,7 +5552,8 @@ get_store_key(THD *thd, KEYUSE *keyuse, table_map used_tables,
...
@@ -5552,7 +5552,8 @@ get_store_key(THD *thd, KEYUSE *keyuse, table_map used_tables,
(
keyuse
->
val
->
type
()
==
Item
::
REF_ITEM
&&
(
keyuse
->
val
->
type
()
==
Item
::
REF_ITEM
&&
((
Item_ref
*
)
keyuse
->
val
)
->
ref_type
()
==
Item_ref
::
OUTER_REF
&&
((
Item_ref
*
)
keyuse
->
val
)
->
ref_type
()
==
Item_ref
::
OUTER_REF
&&
(
*
(
Item_ref
**
)((
Item_ref
*
)
keyuse
->
val
)
->
ref
)
->
ref_type
()
==
(
*
(
Item_ref
**
)((
Item_ref
*
)
keyuse
->
val
)
->
ref
)
->
ref_type
()
==
Item_ref
::
DIRECT_REF
)
)
Item_ref
::
DIRECT_REF
&&
keyuse
->
val
->
real_item
()
->
type
()
==
Item
::
FIELD_ITEM
))
return
new
store_key_field
(
thd
,
return
new
store_key_field
(
thd
,
key_part
->
field
,
key_part
->
field
,
key_buff
+
maybe_null
,
key_buff
+
maybe_null
,
...
...
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