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
1a2e4afe
Commit
1a2e4afe
authored
Mar 12, 2012
by
Norvald H. Ryeng
Browse files
Options
Browse Files
Download
Plain Diff
Merge 5.1 => 5.5.
parents
d2e447d5
ad031d51
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
36 additions
and
12 deletions
+36
-12
mysql-test/r/errors.result
mysql-test/r/errors.result
+14
-0
mysql-test/t/errors.test
mysql-test/t/errors.test
+18
-0
sql/item.cc
sql/item.cc
+4
-12
No files found.
mysql-test/r/errors.result
View file @
1a2e4afe
...
...
@@ -146,3 +146,17 @@ ERROR 22003: BIGINT value is out of range in '(-(73) * -(2465717823867977728))'
#
# End Bug#57882
#
CREATE TABLE t1 (a INT);
CREATE TABLE t2(a INT PRIMARY KEY, b INT);
SELECT '' AS b FROM t1 GROUP BY VALUES(b);
ERROR 42S22: Unknown column '' in 'VALUES() function'
REPLACE t2(b) SELECT '' AS b FROM t1 GROUP BY VALUES(b);
ERROR 42S22: Unknown column '' in 'VALUES() function'
UPDATE t2 SET a=(SELECT '' AS b FROM t1 GROUP BY VALUES(b));
ERROR 42S22: Unknown column '' in 'VALUES() function'
INSERT INTO t2 VALUES (1,0) ON DUPLICATE KEY UPDATE
b=(SELECT '' AS b FROM t1 GROUP BY VALUES(b));
ERROR 42S22: Unknown column '' in 'VALUES() function'
INSERT INTO t2(a,b) VALUES (1,0) ON DUPLICATE KEY UPDATE
b=(SELECT VALUES(a)+2 FROM t1);
DROP TABLE t1, t2;
mysql-test/t/errors.test
View file @
1a2e4afe
...
...
@@ -171,3 +171,21 @@ SELECT UPDATEXML(-73 * -2465717823867977728,@@global.auto_increment_increment,nu
--
echo
#
--
echo
# End Bug#57882
--
echo
#
#
# Bug #13031606 VALUES() IN A SELECT STATEMENT CRASHES SERVER
#
CREATE
TABLE
t1
(
a
INT
);
CREATE
TABLE
t2
(
a
INT
PRIMARY
KEY
,
b
INT
);
--
error
ER_BAD_FIELD_ERROR
SELECT
''
AS
b
FROM
t1
GROUP
BY
VALUES
(
b
);
--
error
ER_BAD_FIELD_ERROR
REPLACE
t2
(
b
)
SELECT
''
AS
b
FROM
t1
GROUP
BY
VALUES
(
b
);
--
error
ER_BAD_FIELD_ERROR
UPDATE
t2
SET
a
=
(
SELECT
''
AS
b
FROM
t1
GROUP
BY
VALUES
(
b
));
--
error
ER_BAD_FIELD_ERROR
INSERT
INTO
t2
VALUES
(
1
,
0
)
ON
DUPLICATE
KEY
UPDATE
b
=
(
SELECT
''
AS
b
FROM
t1
GROUP
BY
VALUES
(
b
));
INSERT
INTO
t2
(
a
,
b
)
VALUES
(
1
,
0
)
ON
DUPLICATE
KEY
UPDATE
b
=
(
SELECT
VALUES
(
a
)
+
2
FROM
t1
);
DROP
TABLE
t1
,
t2
;
sql/item.cc
View file @
1a2e4afe
...
...
@@ -7078,20 +7078,12 @@ bool Item_insert_value::fix_fields(THD *thd, Item **items)
}
if
(
arg
->
type
()
==
REF_ITEM
)
arg
=
static_cast
<
Item_ref
*>
(
arg
)
->
ref
[
0
];
if
(
arg
->
type
()
!=
FIELD_ITEM
)
{
Item_ref
*
ref
=
(
Item_ref
*
)
arg
;
if
(
ref
->
ref
[
0
]
->
type
()
!=
FIELD_ITEM
)
{
my_error
(
ER_BAD_FIELD_ERROR
,
MYF
(
0
),
""
,
"VALUES() function"
);
return
TRUE
;
}
arg
=
ref
->
ref
[
0
];
my_error
(
ER_BAD_FIELD_ERROR
,
MYF
(
0
),
""
,
"VALUES() function"
);
return
TRUE
;
}
/*
According to our SQL grammar, VALUES() function can reference
only to a column.
*/
DBUG_ASSERT
(
arg
->
type
()
==
FIELD_ITEM
);
Item_field
*
field_arg
=
(
Item_field
*
)
arg
;
...
...
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