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
f1353c1d
Commit
f1353c1d
authored
Jul 01, 2003
by
bell@sanja.is.com.ua
Browse files
Options
Browse Files
Download
Plain Diff
merged
parents
1c38e179
76315814
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
47 additions
and
8 deletions
+47
-8
mysql-test/r/subselect.result
mysql-test/r/subselect.result
+13
-0
mysql-test/t/subselect.test
mysql-test/t/subselect.test
+13
-0
sql/mysqld.cc
sql/mysqld.cc
+15
-7
sql/sql_lex.cc
sql/sql_lex.cc
+2
-1
sql/sql_lex.h
sql/sql_lex.h
+1
-0
sql/sql_select.cc
sql/sql_select.cc
+3
-0
No files found.
mysql-test/r/subselect.result
View file @
f1353c1d
...
...
@@ -1153,6 +1153,19 @@ INSERT INTO t1 VALUES (1,0,NULL,NULL),(2,0,NULL,NULL);
SELECT DISTINCT REF_ID FROM t1 WHERE ID= (SELECT DISTINCT REF_ID FROM t1 WHERE ID=2);
REF_ID
DROP TABLE t1;
create table t1 (a int, b int);
create table t2 (a int, b int);
insert into t1 values (1,0), (2,0), (3,0);
insert into t2 values (1,1), (2,1), (3,1), (2,2);
update ignore t1 set b=(select b from t2 where t1.a=t2.a);
Warnings:
Error 1240 Subselect returns more than 1 record
select * from t1;
a b
1 1
2 NULL
3 1
drop table t1, t2;
create table t1(City VARCHAR(30),Location geometry);
insert into t1 values("Paris",GeomFromText('POINT(2.33 48.87)'));
select City from t1 where (select intersects(GeomFromText(AsText(Location)),GeomFromText('Polygon((2 50, 2.5 50, 2.5 47, 2 47, 2 50))'))=0);
...
...
mysql-test/t/subselect.test
View file @
f1353c1d
...
...
@@ -739,6 +739,19 @@ INSERT INTO t1 VALUES (1,0,NULL,NULL),(2,0,NULL,NULL);
SELECT
DISTINCT
REF_ID
FROM
t1
WHERE
ID
=
(
SELECT
DISTINCT
REF_ID
FROM
t1
WHERE
ID
=
2
);
DROP
TABLE
t1
;
#
# uninterruptable update
#
create
table
t1
(
a
int
,
b
int
);
create
table
t2
(
a
int
,
b
int
);
insert
into
t1
values
(
1
,
0
),
(
2
,
0
),
(
3
,
0
);
insert
into
t2
values
(
1
,
1
),
(
2
,
1
),
(
3
,
1
),
(
2
,
2
);
update
ignore
t1
set
b
=
(
select
b
from
t2
where
t1
.
a
=
t2
.
a
);
select
*
from
t1
;
drop
table
t1
,
t2
;
#
# correct behavoiur for function from reduced subselect
...
...
sql/mysqld.cc
View file @
f1353c1d
...
...
@@ -1818,15 +1818,23 @@ extern "C" int my_message_sql(uint error, const char *str,
{
THD
*
thd
;
DBUG_ENTER
(
"my_message_sql"
);
DBUG_PRINT
(
"error"
,
(
"Message: '%s'"
,
str
));
if
((
thd
=
current_thd
))
DBUG_PRINT
(
"error"
,
(
"Message: '%s'"
,
str
));
if
((
thd
=
current_thd
))
{
NET
*
net
=
&
thd
->
net
;
net
->
report_error
=
1
;
if
(
!
net
->
last_error
[
0
])
// Return only first message
if
(
thd
->
lex
.
current_select
->
no_error
&&
!
thd
->
is_fatal_error
)
{
strmake
(
net
->
last_error
,
str
,
sizeof
(
net
->
last_error
)
-
1
);
net
->
last_errno
=
error
?
error
:
ER_UNKNOWN_ERROR
;
DBUG_PRINT
(
"error"
,
(
"above error converted to warning"
));
push_warning
(
thd
,
MYSQL_ERROR
::
WARN_LEVEL_ERROR
,
error
,
str
);
}
else
{
NET
*
net
=
&
thd
->
net
;
net
->
report_error
=
1
;
if
(
!
net
->
last_error
[
0
])
// Return only first message
{
strmake
(
net
->
last_error
,
str
,
sizeof
(
net
->
last_error
)
-
1
);
net
->
last_errno
=
error
?
error
:
ER_UNKNOWN_ERROR
;
}
}
}
else
...
...
sql/sql_lex.cc
View file @
f1353c1d
...
...
@@ -122,6 +122,7 @@ LEX *lex_start(THD *thd, uchar *buf,uint length)
lex
->
yacc_yyss
=
lex
->
yacc_yyvs
=
0
;
lex
->
ignore_space
=
test
(
thd
->
variables
.
sql_mode
&
MODE_IGNORE_SPACE
);
lex
->
sql_command
=
SQLCOM_END
;
lex
->
duplicates
=
DUP_ERROR
;
return
lex
;
}
...
...
@@ -965,7 +966,7 @@ void st_select_lex_node::init_query()
{
options
=
0
;
linkage
=
UNSPECIFIED_TYPE
;
no_table_names_allowed
=
uncacheable
=
dependent
=
0
;
no_
error
=
no_
table_names_allowed
=
uncacheable
=
dependent
=
0
;
ref_pointer_array
=
0
;
cond_count
=
0
;
}
...
...
sql/sql_lex.h
View file @
f1353c1d
...
...
@@ -213,6 +213,7 @@ public:
bool
dependent
;
/* dependent from outer select subselect */
bool
uncacheable
;
/* result of this query can't be cached */
bool
no_table_names_allowed
;
/* used for global order by */
bool
no_error
;
/* suppress error message (convert it to warnings) */
static
void
*
operator
new
(
size_t
size
)
{
...
...
sql/sql_select.cc
View file @
f1353c1d
...
...
@@ -436,6 +436,9 @@ JOIN::optimize()
DBUG_RETURN
(
0
);
optimized
=
1
;
// Ignore errors of execution if option IGNORE present
if
(
thd
->
lex
.
duplicates
==
DUP_IGNORE
)
thd
->
lex
.
current_select
->
no_error
=
1
;
#ifdef HAVE_REF_TO_FIELDS // Not done yet
/* Add HAVING to WHERE if possible */
if
(
having
&&
!
group_list
&&
!
sum_func_count
)
...
...
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