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
b6b4202b
Commit
b6b4202b
authored
Mar 28, 2008
by
unknown
Browse files
Options
Browse Files
Download
Plain Diff
Merge bk-internal:/home/bk/mysql-5.0
into magare.gmz:/home/kgeorge/mysql/work/merge-5.0-bugteam
parents
0db1f520
f8653a79
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
190 additions
and
36 deletions
+190
-36
mysql-test/r/grant.result
mysql-test/r/grant.result
+22
-0
mysql-test/r/range.result
mysql-test/r/range.result
+39
-0
mysql-test/t/grant.test
mysql-test/t/grant.test
+22
-0
mysql-test/t/range.test
mysql-test/t/range.test
+46
-0
sql/opt_range.cc
sql/opt_range.cc
+54
-36
sql/sql_acl.cc
sql/sql_acl.cc
+7
-0
No files found.
mysql-test/r/grant.result
View file @
b6b4202b
...
@@ -1129,4 +1129,26 @@ DROP USER mysqltest_1@localhost;
...
@@ -1129,4 +1129,26 @@ DROP USER mysqltest_1@localhost;
DROP DATABASE db27878;
DROP DATABASE db27878;
use test;
use test;
DROP TABLE t1;
DROP TABLE t1;
drop table if exists test;
Warnings:
Note 1051 Unknown table 'test'
drop function if exists test_function;
Warnings:
Note 1305 FUNCTION test_function does not exist
drop view if exists v1;
Warnings:
Note 1051 Unknown table 'test.v1'
create table test (col1 varchar(30));
create function test_function() returns varchar(30)
begin
declare tmp varchar(30);
select col1 from test limit 1 into tmp;
return '1';
end|
create view v1 as select test.* from test where test.col1=test_function();
grant update (col1) on v1 to 'greg'@'localhost';
drop user 'greg'@'localhost';
drop view v1;
drop table test;
drop function test_function;
End of 5.0 tests
End of 5.0 tests
mysql-test/r/range.result
View file @
b6b4202b
...
@@ -1166,3 +1166,42 @@ EXPLAIN SELECT a FROM t1 WHERE a='b' OR a='B';
...
@@ -1166,3 +1166,42 @@ EXPLAIN SELECT a FROM t1 WHERE a='b' OR a='B';
id select_type table type possible_keys key key_len ref rows Extra
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range a a 35 NULL 3 Using where; Using index
1 SIMPLE t1 range a a 35 NULL 3 Using where; Using index
DROP TABLE t1;
DROP TABLE t1;
CREATE TABLE t1 (f1 TINYINT(11) UNSIGNED NOT NULL, PRIMARY KEY (f1));
INSERT INTO t1 VALUES (127),(254),(0),(1),(255);
SELECT SQL_NO_CACHE COUNT(*) FROM t1 WHERE f1 < 256;
COUNT(*)
5
SELECT SQL_NO_CACHE COUNT(*) FROM t1 WHERE f1 < 256.0;
COUNT(*)
5
SELECT SQL_NO_CACHE COUNT(*) FROM t1 WHERE f1 < 255;
COUNT(*)
4
SELECT SQL_NO_CACHE COUNT(*) FROM t1 WHERE f1 < -1;
COUNT(*)
0
SELECT SQL_NO_CACHE COUNT(*) FROM t1 WHERE f1 > -1;
COUNT(*)
5
DROP TABLE t1;
CREATE TABLE t1 ( f1 TINYINT(11) NOT NULL, PRIMARY KEY (f1));
INSERT INTO t1 VALUES (127),(126),(0),(-128),(-127);
SELECT SQL_NO_CACHE COUNT(*) FROM t1 WHERE f1 < 128;
COUNT(*)
5
SELECT SQL_NO_CACHE COUNT(*) FROM t1 WHERE f1 < 128.0;
COUNT(*)
5
SELECT SQL_NO_CACHE COUNT(*) FROM t1 WHERE f1 < 127;
COUNT(*)
4
SELECT SQL_NO_CACHE COUNT(*) FROM t1 WHERE f1 > -129;
COUNT(*)
5
SELECT SQL_NO_CACHE COUNT(*) FROM t1 WHERE f1 > -129.0;
COUNT(*)
5
SELECT SQL_NO_CACHE COUNT(*) FROM t1 WHERE f1 > -128;
COUNT(*)
4
DROP TABLE t1;
mysql-test/t/grant.test
View file @
b6b4202b
...
@@ -1153,4 +1153,26 @@ DROP DATABASE db27878;
...
@@ -1153,4 +1153,26 @@ DROP DATABASE db27878;
use
test
;
use
test
;
DROP
TABLE
t1
;
DROP
TABLE
t1
;
#
# Bug #33201 Crash occurs when granting update privilege on one column of a view
#
drop
table
if
exists
test
;
drop
function
if
exists
test_function
;
drop
view
if
exists
v1
;
create
table
test
(
col1
varchar
(
30
));
delimiter
|
;
create
function
test_function
()
returns
varchar
(
30
)
begin
declare
tmp
varchar
(
30
);
select
col1
from
test
limit
1
into
tmp
;
return
'1'
;
end
|
delimiter
;
|
create
view
v1
as
select
test
.*
from
test
where
test
.
col1
=
test_function
();
grant
update
(
col1
)
on
v1
to
'greg'
@
'localhost'
;
drop
user
'greg'
@
'localhost'
;
drop
view
v1
;
drop
table
test
;
drop
function
test_function
;
--
echo
End
of
5.0
tests
--
echo
End
of
5.0
tests
mysql-test/t/range.test
View file @
b6b4202b
...
@@ -972,4 +972,50 @@ EXPLAIN SELECT a FROM t1 WHERE a='b' OR a='B';
...
@@ -972,4 +972,50 @@ EXPLAIN SELECT a FROM t1 WHERE a='b' OR a='B';
DROP
TABLE
t1
;
DROP
TABLE
t1
;
#
# Bug #34731: highest possible value for INT erroneously filtered by WHERE
#
# test UNSIGNED. only occurs when indexed.
CREATE
TABLE
t1
(
f1
TINYINT
(
11
)
UNSIGNED
NOT
NULL
,
PRIMARY
KEY
(
f1
));
INSERT
INTO
t1
VALUES
(
127
),(
254
),(
0
),(
1
),(
255
);
# test upper bound
# count 5
SELECT
SQL_NO_CACHE
COUNT
(
*
)
FROM
t1
WHERE
f1
<
256
;
SELECT
SQL_NO_CACHE
COUNT
(
*
)
FROM
t1
WHERE
f1
<
256.0
;
# count 4
SELECT
SQL_NO_CACHE
COUNT
(
*
)
FROM
t1
WHERE
f1
<
255
;
# show we don't fiddle with lower bound on UNSIGNED
# count 0
SELECT
SQL_NO_CACHE
COUNT
(
*
)
FROM
t1
WHERE
f1
<
-
1
;
# count 5
SELECT
SQL_NO_CACHE
COUNT
(
*
)
FROM
t1
WHERE
f1
>
-
1
;
DROP
TABLE
t1
;
# test signed. only occurs when index.
CREATE
TABLE
t1
(
f1
TINYINT
(
11
)
NOT
NULL
,
PRIMARY
KEY
(
f1
));
INSERT
INTO
t1
VALUES
(
127
),(
126
),(
0
),(
-
128
),(
-
127
);
# test upper bound
# count 5
SELECT
SQL_NO_CACHE
COUNT
(
*
)
FROM
t1
WHERE
f1
<
128
;
SELECT
SQL_NO_CACHE
COUNT
(
*
)
FROM
t1
WHERE
f1
<
128.0
;
# count 4
SELECT
SQL_NO_CACHE
COUNT
(
*
)
FROM
t1
WHERE
f1
<
127
;
# test lower bound
# count 5
SELECT
SQL_NO_CACHE
COUNT
(
*
)
FROM
t1
WHERE
f1
>
-
129
;
SELECT
SQL_NO_CACHE
COUNT
(
*
)
FROM
t1
WHERE
f1
>
-
129.0
;
# count 4
SELECT
SQL_NO_CACHE
COUNT
(
*
)
FROM
t1
WHERE
f1
>
-
128
;
DROP
TABLE
t1
;
# End of 5.0 tests
# End of 5.0 tests
sql/opt_range.cc
View file @
b6b4202b
...
@@ -4405,52 +4405,70 @@ get_mm_leaf(PARAM *param, COND *conf_func, Field *field, KEY_PART *key_part,
...
@@ -4405,52 +4405,70 @@ get_mm_leaf(PARAM *param, COND *conf_func, Field *field, KEY_PART *key_part,
field
->
type
()
==
FIELD_TYPE_DATETIME
))
field
->
type
()
==
FIELD_TYPE_DATETIME
))
field
->
table
->
in_use
->
variables
.
sql_mode
|=
MODE_INVALID_DATES
;
field
->
table
->
in_use
->
variables
.
sql_mode
|=
MODE_INVALID_DATES
;
err
=
value
->
save_in_field_no_warnings
(
field
,
1
);
err
=
value
->
save_in_field_no_warnings
(
field
,
1
);
if
(
err
>
0
&&
field
->
cmp_type
()
!=
value
->
result_type
()
)
if
(
err
>
0
)
{
{
if
((
type
==
Item_func
::
EQ_FUNC
||
type
==
Item_func
::
EQUAL_FUNC
)
&&
if
(
field
->
cmp_type
()
!=
value
->
result_type
())
value
->
result_type
()
==
item_cmp_type
(
field
->
result_type
(),
value
->
result_type
()))
{
{
tree
=
new
(
alloc
)
SEL_ARG
(
field
,
0
,
0
);
if
((
type
==
Item_func
::
EQ_FUNC
||
type
==
Item_func
::
EQUAL_FUNC
)
&&
tree
->
type
=
SEL_ARG
::
IMPOSSIBLE
;
value
->
result_type
()
==
item_cmp_type
(
field
->
result_type
(),
goto
end
;
value
->
result_type
()))
}
{
else
tree
=
new
(
alloc
)
SEL_ARG
(
field
,
0
,
0
);
{
tree
->
type
=
SEL_ARG
::
IMPOSSIBLE
;
/*
goto
end
;
TODO: We should return trees of the type SEL_ARG::IMPOSSIBLE
}
for the cases like int_field > 999999999999999999999999 as well.
else
*/
tree
=
0
;
if
(
err
==
3
&&
field
->
type
()
==
FIELD_TYPE_DATE
&&
(
type
==
Item_func
::
GT_FUNC
||
type
==
Item_func
::
GE_FUNC
||
type
==
Item_func
::
LT_FUNC
||
type
==
Item_func
::
LE_FUNC
)
)
{
{
/*
/*
We were saving DATETIME into a DATE column, the conversion went ok
TODO: We should return trees of the type SEL_ARG::IMPOSSIBLE
but a non-zero time part was cut off.
for the cases like int_field > 999999999999999999999999 as well.
*/
tree
=
0
;
if
(
err
==
3
&&
field
->
type
()
==
FIELD_TYPE_DATE
&&
(
type
==
Item_func
::
GT_FUNC
||
type
==
Item_func
::
GE_FUNC
||
type
==
Item_func
::
LT_FUNC
||
type
==
Item_func
::
LE_FUNC
)
)
{
/*
We were saving DATETIME into a DATE column, the conversion went ok
but a non-zero time part was cut off.
In MySQL's SQL dialect, DATE and DATETIME are compared as datetime
In MySQL's SQL dialect, DATE and DATETIME are compared as datetime
values. Index over a DATE column uses DATE comparison. Changing
values. Index over a DATE column uses DATE comparison. Changing
from one comparison to the other is possible:
from one comparison to the other is possible:
datetime(date_col)< '2007-12-10 12:34:55' -> date_col<='2007-12-10'
datetime(date_col)< '2007-12-10 12:34:55' -> date_col<='2007-12-10'
datetime(date_col)<='2007-12-10 12:34:55' -> date_col<='2007-12-10'
datetime(date_col)<='2007-12-10 12:34:55' -> date_col<='2007-12-10'
datetime(date_col)> '2007-12-10 12:34:55' -> date_col>='2007-12-10'
datetime(date_col)> '2007-12-10 12:34:55' -> date_col>='2007-12-10'
datetime(date_col)>='2007-12-10 12:34:55' -> date_col>='2007-12-10'
datetime(date_col)>='2007-12-10 12:34:55' -> date_col>='2007-12-10'
but we'll need to convert '>' to '>=' and '<' to '<='. This will
but we'll need to convert '>' to '>=' and '<' to '<='. This will
be done together with other types at the end of this function
be done together with other types at the end of this function
(grep for field_is_equal_to_item)
(grep for field_is_equal_to_item)
*/
*/
}
else
goto
end
;
}
}
else
goto
end
;
}
}
}
if
(
err
<
0
)
/*
guaranteed at this point: err > 0; field and const of same type
If an integer got bounded (e.g. to within 0..255 / -128..127)
for < or >, set flags as for <= or >= (no NEAR_MAX / NEAR_MIN)
*/
else
if
(
err
==
1
&&
field
->
result_type
()
==
INT_RESULT
)
{
if
(
type
==
Item_func
::
LT_FUNC
&&
(
value
->
val_int
()
>
0
))
type
=
Item_func
::
LE_FUNC
;
else
if
(
type
==
Item_func
::
GT_FUNC
&&
!
((
Field_num
*
)
field
)
->
unsigned_flag
&&
!
((
Item_int
*
)
value
)
->
unsigned_flag
&&
(
value
->
val_int
()
<
0
))
type
=
Item_func
::
GE_FUNC
;
}
}
else
if
(
err
<
0
)
{
{
field
->
table
->
in_use
->
variables
.
sql_mode
=
orig_sql_mode
;
field
->
table
->
in_use
->
variables
.
sql_mode
=
orig_sql_mode
;
/* This happens when we try to insert a NULL field in a not null column */
/* This happens when we try to insert a NULL field in a not null column */
...
...
sql/sql_acl.cc
View file @
b6b4202b
...
@@ -2880,6 +2880,12 @@ bool mysql_table_grant(THD *thd, TABLE_LIST *table_list,
...
@@ -2880,6 +2880,12 @@ bool mysql_table_grant(THD *thd, TABLE_LIST *table_list,
}
}
#endif
#endif
/*
The lock api is depending on the thd->lex variable which needs to be
re-initialized.
*/
Query_tables_list
backup
;
thd
->
lex
->
reset_n_backup_query_tables_list
(
&
backup
);
if
(
simple_open_n_lock_tables
(
thd
,
tables
))
if
(
simple_open_n_lock_tables
(
thd
,
tables
))
{
// Should never happen
{
// Should never happen
close_thread_tables
(
thd
);
/* purecov: deadcode */
close_thread_tables
(
thd
);
/* purecov: deadcode */
...
@@ -3018,6 +3024,7 @@ bool mysql_table_grant(THD *thd, TABLE_LIST *table_list,
...
@@ -3018,6 +3024,7 @@ bool mysql_table_grant(THD *thd, TABLE_LIST *table_list,
send_ok
(
thd
);
send_ok
(
thd
);
/* Tables are automatically closed */
/* Tables are automatically closed */
thd
->
lex
->
restore_backup_query_tables_list
(
&
backup
);
DBUG_RETURN
(
result
);
DBUG_RETURN
(
result
);
}
}
...
...
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