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
c1660e1a
Commit
c1660e1a
authored
Jul 02, 2003
by
Sinisa@sinisa.nasamreza.org
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Lot's of clean-ups and fixes for 4.0.14.
parent
ef61b1a5
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
552 additions
and
12 deletions
+552
-12
include/my_global.h
include/my_global.h
+1
-1
mysql-test/r/grant.result
mysql-test/r/grant.result
+2
-0
mysql-test/r/insert_select.result
mysql-test/r/insert_select.result
+490
-0
mysql-test/r/union.result
mysql-test/r/union.result
+18
-0
mysql-test/t/grant.test
mysql-test/t/grant.test
+2
-0
mysql-test/t/insert_select.test
mysql-test/t/insert_select.test
+16
-0
mysql-test/t/union.test
mysql-test/t/union.test
+13
-0
sql/sql_acl.cc
sql/sql_acl.cc
+1
-1
sql/sql_parse.cc
sql/sql_parse.cc
+7
-3
sql/sql_select.cc
sql/sql_select.cc
+1
-5
sql/sql_union.cc
sql/sql_union.cc
+1
-2
No files found.
include/my_global.h
View file @
c1660e1a
...
...
@@ -263,10 +263,10 @@ C_MODE_END
#endif
#ifdef HAVE_ATOMIC_ADD
#define __SMP__
#include <asm/atomic.h>
#ifndef CONFIG_SMP
#define CONFIG_SMP
#endif
#include <asm/atomic.h>
#endif
#include <errno.h>
/* Recommended by debian */
/* We need the following to go around a problem with openssl on solaris */
...
...
mysql-test/r/grant.result
View file @
c1660e1a
...
...
@@ -106,3 +106,5 @@ delete from mysql.tables_priv where user='mysqltest_1';
delete from mysql.columns_priv where user='mysqltest_1';
flush privileges;
drop table t1;
GRANT FILE on mysqltest.* to mysqltest_1@localhost;
Wrong usage of DB GRANT and GLOBAL PRIVILEGES
mysql-test/r/insert_select.result
View file @
c1660e1a
...
...
@@ -80,3 +80,493 @@ Log_name Pos Event_type Server_id Orig_log_pos Info
master-bin.001 4 Start 1 4 Server ver: VERSION, Binlog ver: 3
master-bin.001 79 Query 1 79 use test; insert into t1 select * from t2
drop table t1, t2;
drop table if exists t1, t2;
create table t1 (a int not null);
create table t2 (a int not null);
insert into t1 values (1);
insert into t1 values (a+2);
insert into t1 values (a+3);
insert into t1 values (4),(a+5);
insert into t1 select * from t1;
select * from t1;
a
1
2
3
4
5
1
2
3
4
5
insert into t1 select * from t1 as t2;
select * from t1;
a
1
2
3
4
5
1
2
3
4
5
1
2
3
4
5
1
2
3
4
5
insert into t2 select * from t1 as t2;
select * from t1;
a
1
2
3
4
5
1
2
3
4
5
1
2
3
4
5
1
2
3
4
5
insert into t1 select t2.a from t1,t2;
select * from t1;
a
1
2
3
4
5
1
2
3
4
5
1
2
3
4
5
1
2
3
4
5
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
drop table t1,t2;
mysql-test/r/union.result
View file @
c1660e1a
...
...
@@ -96,6 +96,13 @@ a b
select found_rows();
found_rows()
6
select sql_calc_found_rows a,b from t1 union all select a,b from t2 limit 2;
a b
1 a
2 b
select found_rows();
found_rows()
6
explain select a,b from t1 union all select a,b from t2;
table type possible_keys key key_len ref rows Extra
t1 ALL NULL NULL NULL NULL 4
...
...
@@ -259,3 +266,14 @@ uid rl g1 cid gg
uid rl g1 cid gg
1 NULL V1 NULL 1
drop table t1,t2,t3,t4,t5,t6;
CREATE TABLE t1 (a int not null, b char (10) not null);
insert into t1 values(1,'a'),(2,'b'),(3,'c'),(3,'c');
CREATE TABLE t2 (a int not null, b char (10) not null);
insert into t2 values (3,'c'),(4,'d'),(5,'f'),(6,'e');
create table t3 select a,b from t1 union select a,b from t2;
create table t4 (select a,b from t1) union (select a,b from t2) limit 2;
insert into t4 select a,b from t1 union select a,b from t2;
insert into t3 (select a,b from t1) union (select a,b from t2) limit 2;
select * from t3;
select * from t4;
drop table t1,t2,t3,t4;
mysql-test/t/grant.test
View file @
c1660e1a
...
...
@@ -72,3 +72,5 @@ delete from mysql.tables_priv where user='mysqltest_1';
delete
from
mysql
.
columns_priv
where
user
=
'mysqltest_1'
;
flush
privileges
;
drop
table
t1
;
--
error
1054
GRANT
FILE
on
mysqltest
.*
to
mysqltest_1
@
localhost
;
mysql-test/t/insert_select.test
View file @
c1660e1a
...
...
@@ -87,3 +87,19 @@ let $VERSION=`select version()`;
--
replace_result
$VERSION
VERSION
show
binlog
events
;
drop
table
t1
,
t2
;
drop
table
if
exists
t1
,
t2
;
create
table
t1
(
a
int
not
null
);
create
table
t2
(
a
int
not
null
);
insert
into
t1
values
(
1
);
insert
into
t1
values
(
a
+
2
);
insert
into
t1
values
(
a
+
3
);
insert
into
t1
values
(
4
),(
a
+
5
);
insert
into
t1
select
*
from
t1
;
select
*
from
t1
;
insert
into
t1
select
*
from
t1
as
t2
;
select
*
from
t1
;
insert
into
t2
select
*
from
t1
as
t2
;
select
*
from
t1
;
insert
into
t1
select
t2
.
a
from
t1
,
t2
;
select
*
from
t1
;
drop
table
t1
,
t2
;
mysql-test/t/union.test
View file @
c1660e1a
...
...
@@ -23,6 +23,8 @@ select 't1',b,count(*) from t1 group by b UNION select 't2',b,count(*) from t2 g
explain
(
select
a
,
b
from
t1
limit
2
)
union
all
(
select
a
,
b
from
t2
order
by
a
limit
1
)
order
by
b
desc
;
(
select
sql_calc_found_rows
a
,
b
from
t1
limit
2
)
union
all
(
select
a
,
b
from
t2
order
by
a
)
limit
2
;
select
found_rows
();
select
sql_calc_found_rows
a
,
b
from
t1
union
all
select
a
,
b
from
t2
limit
2
;
select
found_rows
();
#
# Test some error conditions with UNION
...
...
@@ -157,3 +159,14 @@ SELECT t4.uid, t5.rl, t3.gn as g1, t4.cid, t4.gid as gg FROM t3, t6, t1, t4 left
(
SELECT
t4
.
uid
,
t5
.
rl
,
t3
.
gn
as
g1
,
t4
.
cid
,
t4
.
gid
as
gg
FROM
t3
,
t6
,
t1
,
t4
left
join
t5
on
t5
.
rid
=
t4
.
rid
left
join
t2
on
t2
.
cid
=
t4
.
cid
WHERE
t3
.
gid
=
t4
.
gid
AND
t6
.
uid
=
t4
.
uid
AND
t3
.
must
IS
NOT
NULL
AND
t6
.
uc
=
t1
.
cid
AND
t1
.
cv
=
"dummy"
AND
t6
.
un
=
"test"
)
UNION
(
SELECT
t4
.
uid
,
t5
.
rl
,
t3
.
gn
as
g1
,
t4
.
cid
,
t4
.
gid
as
gg
FROM
t3
,
t6
,
t1
,
t4
left
join
t5
on
t5
.
rid
=
t4
.
rid
left
join
t2
on
t2
.
cid
=
t4
.
cid
WHERE
t3
.
gid
=
t4
.
gid
AND
t6
.
uid
=
t4
.
uid
AND
t6
.
uc
=
t1
.
cid
AND
t1
.
cv
=
"dummy"
AND
t6
.
un
=
"test"
);
drop
table
t1
,
t2
,
t3
,
t4
,
t5
,
t6
;
CREATE
TABLE
t1
(
a
int
not
null
,
b
char
(
10
)
not
null
);
insert
into
t1
values
(
1
,
'a'
),(
2
,
'b'
),(
3
,
'c'
),(
3
,
'c'
);
CREATE
TABLE
t2
(
a
int
not
null
,
b
char
(
10
)
not
null
);
insert
into
t2
values
(
3
,
'c'
),(
4
,
'd'
),(
5
,
'f'
),(
6
,
'e'
);
create
table
t3
select
a
,
b
from
t1
union
select
a
,
b
from
t2
;
create
table
t4
(
select
a
,
b
from
t1
)
union
(
select
a
,
b
from
t2
)
limit
2
;
insert
into
t4
select
a
,
b
from
t1
union
select
a
,
b
from
t2
;
insert
into
t3
(
select
a
,
b
from
t1
)
union
(
select
a
,
b
from
t2
)
limit
2
;
select
*
from
t3
;
select
*
from
t4
;
drop
table
t1
,
t2
,
t3
,
t4
;
sql/sql_acl.cc
View file @
c1660e1a
...
...
@@ -2325,7 +2325,7 @@ int mysql_grant (THD *thd, const char *db, List <LEX_USER> &list,
}
else
{
net_printf
(
&
thd
->
net
,
ER_WRONG_USAGE
,
"DB GRANT"
,
"GLOBAL PRIVILEGE
Y
"
);
net_printf
(
&
thd
->
net
,
ER_WRONG_USAGE
,
"DB GRANT"
,
"GLOBAL PRIVILEGE
S
"
);
result
=
-
1
;
}
}
...
...
sql/sql_parse.cc
View file @
c1660e1a
...
...
@@ -3386,14 +3386,18 @@ TABLE_LIST *add_table_to_list(Table_ident *table, LEX_STRING *alias,
tables
;
tables
=
tables
->
next
)
{
if
(
!
strcmp
(
alias_str
,
tables
->
alias
)
&&
!
strcmp
(
ptr
->
db
,
tables
->
db
))
if
(
ptr
->
db_length
==
tables
->
db_length
&&
!
memcmp
(
ptr
->
db
,
tables
->
db
,
ptr
->
db_length
))
{
if
((
thd
->
lex
.
sql_command
&
(
SQLCOM_INSERT_SELECT
|
SQLCOM_REPLACE_SELECT
))
&&
(
tables
->
lock_type
&
(
TL_WRITE_CONCURRENT_INSERT
|
TL_WRITE_LOW_PRIORITY
|
TL_WRITE_DELAYED
|
TL_WRITE
)))
thd
->
lex
.
select
->
options
|=
OPTION_BUFFER_RESULT
;
else
{
if
(
ptr
->
real_name_length
==
tables
->
real_name_length
&&
!
memcmp
(
ptr
->
real_name
,
tables
->
real_name
,
ptr
->
real_name_length
))
thd
->
lex
.
select
->
options
|=
OPTION_BUFFER_RESULT
;
}
else
if
(
!
strcmp
(
alias_str
,
tables
->
alias
))
{
net_printf
(
&
thd
->
net
,
ER_NONUNIQ_TABLE
,
alias_str
);
/* purecov: tested */
DBUG_RETURN
(
0
);
/* purecov: tested */
...
...
sql/sql_select.cc
View file @
c1660e1a
...
...
@@ -974,11 +974,7 @@ mysql_select(THD *thd,TABLE_LIST *tables,List<Item> &fields,COND *conds,
thd
->
select_limit
))
{
if
(
!
join
.
join_tab
[
join
.
const_tables
].
select
->
quick
)
error
=
return_zero_rows
(
&
join
,
result
,
tables
,
fields
,
0
,
select_options
,
"Impossible WHERE noticed after reading const tables"
,
having
,
procedure
);
goto
err
;
goto
err
;
}
}
join
.
having
=
having
;
// Actually a parameter
...
...
sql/sql_union.cc
View file @
c1660e1a
...
...
@@ -33,7 +33,7 @@ int mysql_union(THD *thd, LEX *lex,select_result *result)
TABLE
*
table
;
int
describe
=
(
lex
->
select_lex
.
options
&
SELECT_DESCRIBE
)
?
1
:
0
;
int
res
;
bool
found_rows_for_union
=
0
;
bool
found_rows_for_union
=
lex
->
select_lex
.
options
&
OPTION_FOUND_ROWS
;
TABLE_LIST
result_table_list
;
TABLE_LIST
*
first_table
=
(
TABLE_LIST
*
)
lex
->
select_lex
.
table_list
.
first
;
TMP_TABLE_PARAM
tmp_table_param
;
...
...
@@ -63,7 +63,6 @@ int mysql_union(THD *thd, LEX *lex,select_result *result)
*/
lex_sl
=
sl
;
order
=
(
ORDER
*
)
lex_sl
->
order_list
.
first
;
found_rows_for_union
=
lex
->
select_lex
.
options
&
OPTION_FOUND_ROWS
&&
sl
->
select_limit
;
// This is done to eliminate unnecessary slowing down of the first query
if
(
!
order
||
!
describe
)
last_sl
->
next
=
0
;
// Remove this extra element
...
...
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