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
f6d9e96f
Commit
f6d9e96f
authored
Oct 12, 2002
by
bell@sanja.is.com.ua
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed subselect * bug
parent
b79a4c01
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
6 deletions
+20
-6
mysql-test/r/subselect.result
mysql-test/r/subselect.result
+6
-0
mysql-test/t/subselect.test
mysql-test/t/subselect.test
+6
-0
sql/item_subselect.cc
sql/item_subselect.cc
+8
-6
No files found.
mysql-test/r/subselect.result
View file @
f6d9e96f
...
...
@@ -159,6 +159,12 @@ UNIQUE KEY `email` (`email`)
INSERT INTO inscrit (pseudo,email) VALUES ('joce','test');
INSERT INTO inscrit (pseudo,email) VALUES ('joce1','test1');
INSERT INTO inscrit (pseudo,email) VALUES ('2joce1','2test1');
SELECT pseudo FROM inscrit WHERE pseudo=(SELECT pseudo,email FROM
inscrit WHERE pseudo='joce');
Subselect returns more than 1 field
SELECT pseudo FROM inscrit WHERE pseudo=(SELECT * FROM inscrit WHERE
pseudo='joce');
Subselect returns more than 1 field
SELECT pseudo FROM inscrit WHERE pseudo=(SELECT pseudo FROM inscrit WHERE pseudo='joce');
pseudo
joce
...
...
mysql-test/t/subselect.test
View file @
f6d9e96f
...
...
@@ -82,6 +82,12 @@ CREATE TABLE `inscrit` (
INSERT
INTO
inscrit
(
pseudo
,
email
)
VALUES
(
'joce'
,
'test'
);
INSERT
INTO
inscrit
(
pseudo
,
email
)
VALUES
(
'joce1'
,
'test1'
);
INSERT
INTO
inscrit
(
pseudo
,
email
)
VALUES
(
'2joce1'
,
'2test1'
);
--
error
1239
SELECT
pseudo
FROM
inscrit
WHERE
pseudo
=
(
SELECT
pseudo
,
email
FROM
inscrit
WHERE
pseudo
=
'joce'
);
--
error
1239
SELECT
pseudo
FROM
inscrit
WHERE
pseudo
=
(
SELECT
*
FROM
inscrit
WHERE
pseudo
=
'joce'
);
SELECT
pseudo
FROM
inscrit
WHERE
pseudo
=
(
SELECT
pseudo
FROM
inscrit
WHERE
pseudo
=
'joce'
);
--
error
1240
SELECT
pseudo
FROM
inscrit
WHERE
pseudo
=
(
SELECT
pseudo
FROM
inscrit
WHERE
pseudo
LIKE
'%joce%'
);
...
...
sql/item_subselect.cc
View file @
f6d9e96f
...
...
@@ -81,15 +81,17 @@ void Item_subselect::make_field (Send_field *tmp_field)
bool
Item_subselect
::
fix_fields
(
THD
*
thd
,
TABLE_LIST
*
tables
,
Item
**
ref
)
{
// Is it one field subselect?
if
(
engine
->
cols
()
>
max_columns
)
{
my_message
(
ER_SUBSELECT_NO_1_COL
,
ER
(
ER_SUBSELECT_NO_1_COL
),
MYF
(
0
));
return
1
;
}
int
res
=
engine
->
prepare
();
if
(
!
res
)
{
// Is it one field subselect?
if
(
engine
->
cols
()
>
max_columns
)
{
my_message
(
ER_SUBSELECT_NO_1_COL
,
ER
(
ER_SUBSELECT_NO_1_COL
),
MYF
(
0
));
return
1
;
}
fix_length_and_dec
();
}
return
res
;
}
...
...
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