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
f7010479
Commit
f7010479
authored
Jul 22, 2007
by
gshchepa/uchum@gleb.loc
Browse files
Options
Browse Files
Download
Plain Diff
Merge gleb.loc:/home/uchum/work/bk/5.0-opt
into gleb.loc:/home/uchum/work/bk/5.1-opt
parents
a5075a68
2313bbc3
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
76 additions
and
3 deletions
+76
-3
mysql-test/r/sp.result
mysql-test/r/sp.result
+33
-1
mysql-test/t/sp.test
mysql-test/t/sp.test
+32
-1
sql/item_func.cc
sql/item_func.cc
+10
-0
sql/item_func.h
sql/item_func.h
+1
-1
No files found.
mysql-test/r/sp.result
View file @
f7010479
use test;
use test;
drop table if exists t1,t2,t3,t4;
drop table if exists t1,t2,t3,t4;
drop function if exists f1;
drop function if exists f2;
create table t1 (
create table t1 (
id char(16) not null default '',
id char(16) not null default '',
data int not null
data int not null
...
@@ -6249,7 +6251,7 @@ drop table t1,t2;
...
@@ -6249,7 +6251,7 @@ drop table t1,t2;
CREATE TABLE t1 (a int auto_increment primary key) engine=MyISAM;
CREATE TABLE t1 (a int auto_increment primary key) engine=MyISAM;
CREATE TABLE t2 (a int auto_increment primary key, b int) engine=innodb;
CREATE TABLE t2 (a int auto_increment primary key, b int) engine=innodb;
set @a=0;
set @a=0;
CREATE function bug27354() RETURNS int deterministic
CREATE function bug27354() RETURNS int
not
deterministic
begin
begin
insert into t1 values (null);
insert into t1 values (null);
set @a=@a+1;
set @a=@a+1;
...
@@ -6433,3 +6435,33 @@ where ROUTINE_NAME = "proc_26302";
...
@@ -6433,3 +6435,33 @@ where ROUTINE_NAME = "proc_26302";
ROUTINE_NAME ROUTINE_DEFINITION
ROUTINE_NAME ROUTINE_DEFINITION
proc_26302 select 1 /* testing */
proc_26302 select 1 /* testing */
drop procedure proc_26302;
drop procedure proc_26302;
CREATE FUNCTION f1() RETURNS INT DETERMINISTIC RETURN 2;
CREATE FUNCTION f2(I INT) RETURNS INT DETERMINISTIC RETURN 3;
CREATE TABLE t1 (c1 INT, INDEX(c1));
INSERT INTO t1 VALUES (1), (2), (3), (4), (5);
CREATE VIEW v1 AS SELECT c1 FROM t1;
EXPLAIN SELECT * FROM t1 WHERE c1=1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref c1 c1 5 const 1 Using where; Using index
EXPLAIN SELECT * FROM t1 WHERE c1=f1();
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref c1 c1 5 const 1 Using where; Using index
EXPLAIN SELECT * FROM v1 WHERE c1=1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref c1 c1 5 const 1 Using where; Using index
EXPLAIN SELECT * FROM v1 WHERE c1=f1();
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref c1 c1 5 const 1 Using where; Using index
EXPLAIN SELECT * FROM t1 WHERE c1=f2(10);
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref c1 c1 5 const 1 Using where; Using index
EXPLAIN SELECT * FROM t1 WHERE c1=f2(c1);
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index NULL c1 5 NULL 5 Using where; Using index
EXPLAIN SELECT * FROM t1 WHERE c1=f2(rand());
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index NULL c1 5 NULL 5 Using where; Using index
DROP VIEW v1;
DROP FUNCTION f1;
DROP TABLE t1;
End of 5.0 tests
mysql-test/t/sp.test
View file @
f7010479
...
@@ -24,6 +24,8 @@ use test;
...
@@ -24,6 +24,8 @@ use test;
#
#
--
disable_warnings
--
disable_warnings
drop
table
if
exists
t1
,
t2
,
t3
,
t4
;
drop
table
if
exists
t1
,
t2
,
t3
,
t4
;
drop
function
if
exists
f1
;
drop
function
if
exists
f2
;
--
enable_warnings
--
enable_warnings
create
table
t1
(
create
table
t1
(
id
char
(
16
)
not
null
default
''
,
id
char
(
16
)
not
null
default
''
,
...
@@ -7214,7 +7216,7 @@ CREATE TABLE t2 (a int auto_increment primary key, b int) engine=innodb;
...
@@ -7214,7 +7216,7 @@ CREATE TABLE t2 (a int auto_increment primary key, b int) engine=innodb;
set
@
a
=
0
;
set
@
a
=
0
;
delimiter
|
;
delimiter
|
;
CREATE
function
bug27354
()
RETURNS
int
deterministic
CREATE
function
bug27354
()
RETURNS
int
not
deterministic
begin
begin
insert
into
t1
values
(
null
);
insert
into
t1
values
(
null
);
set
@
a
=@
a
+
1
;
set
@
a
=@
a
+
1
;
...
@@ -7368,3 +7370,32 @@ where ROUTINE_NAME = "proc_26302";
...
@@ -7368,3 +7370,32 @@ where ROUTINE_NAME = "proc_26302";
drop
procedure
proc_26302
;
drop
procedure
proc_26302
;
# Bug #29338: no optimization for stored functions with a trivial body
# always returning constant.
#
CREATE
FUNCTION
f1
()
RETURNS
INT
DETERMINISTIC
RETURN
2
;
CREATE
FUNCTION
f2
(
I
INT
)
RETURNS
INT
DETERMINISTIC
RETURN
3
;
CREATE
TABLE
t1
(
c1
INT
,
INDEX
(
c1
));
INSERT
INTO
t1
VALUES
(
1
),
(
2
),
(
3
),
(
4
),
(
5
);
CREATE
VIEW
v1
AS
SELECT
c1
FROM
t1
;
EXPLAIN
SELECT
*
FROM
t1
WHERE
c1
=
1
;
EXPLAIN
SELECT
*
FROM
t1
WHERE
c1
=
f1
();
EXPLAIN
SELECT
*
FROM
v1
WHERE
c1
=
1
;
EXPLAIN
SELECT
*
FROM
v1
WHERE
c1
=
f1
();
EXPLAIN
SELECT
*
FROM
t1
WHERE
c1
=
f2
(
10
);
EXPLAIN
SELECT
*
FROM
t1
WHERE
c1
=
f2
(
c1
);
EXPLAIN
SELECT
*
FROM
t1
WHERE
c1
=
f2
(
rand
());
DROP
VIEW
v1
;
DROP
FUNCTION
f1
;
DROP
TABLE
t1
;
--
echo
End
of
5.0
tests
sql/item_func.cc
View file @
f7010479
...
@@ -5599,10 +5599,20 @@ Item_func_sp::fix_fields(THD *thd, Item **ref)
...
@@ -5599,10 +5599,20 @@ Item_func_sp::fix_fields(THD *thd, Item **ref)
#endif
/* ! NO_EMBEDDED_ACCESS_CHECKS */
#endif
/* ! NO_EMBEDDED_ACCESS_CHECKS */
}
}
if
(
!
m_sp
->
m_chistics
->
detistic
)
used_tables_cache
|=
RAND_TABLE_BIT
;
DBUG_RETURN
(
res
);
DBUG_RETURN
(
res
);
}
}
void
Item_func_sp
::
update_used_tables
()
{
Item_func
::
update_used_tables
();
if
(
!
m_sp
->
m_chistics
->
detistic
)
used_tables_cache
|=
RAND_TABLE_BIT
;
}
/*
/*
uuid_short handling.
uuid_short handling.
...
...
sql/item_func.h
View file @
f7010479
...
@@ -1472,7 +1472,7 @@ public:
...
@@ -1472,7 +1472,7 @@ public:
virtual
~
Item_func_sp
()
virtual
~
Item_func_sp
()
{}
{}
table_map
used_tables
()
const
{
return
RAND_TABLE_BIT
;
}
void
update_used_tables
();
void
cleanup
();
void
cleanup
();
...
...
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