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
79361c65
Commit
79361c65
authored
Jan 03, 2007
by
holyfoot/hf@mysql.com/hfmain.(none)
Browse files
Options
Browse Files
Download
Plain Diff
Merge mysql.com:/d2/hf/common/my50-common
into mysql.com:/d2/hf/opt/my50-opt
parents
8c2d34c3
a0f48f0f
Changes
13
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
142 additions
and
5 deletions
+142
-5
myisam/mi_check.c
myisam/mi_check.c
+8
-0
mysql-test/r/gis-rtree.result
mysql-test/r/gis-rtree.result
+11
-0
mysql-test/r/ps.result
mysql-test/r/ps.result
+15
-0
mysql-test/r/subselect.result
mysql-test/r/subselect.result
+13
-0
mysql-test/r/udf.result
mysql-test/r/udf.result
+11
-0
mysql-test/t/gis-rtree.test
mysql-test/t/gis-rtree.test
+17
-0
mysql-test/t/ps.test
mysql-test/t/ps.test
+18
-0
mysql-test/t/subselect.test
mysql-test/t/subselect.test
+12
-0
mysql-test/t/udf.test
mysql-test/t/udf.test
+17
-0
sql/item_subselect.cc
sql/item_subselect.cc
+17
-2
sql/item_subselect.h
sql/item_subselect.h
+2
-1
sql/sql_lex.cc
sql/sql_lex.cc
+0
-1
sql/sql_udf.cc
sql/sql_udf.cc
+1
-1
No files found.
myisam/mi_check.c
View file @
79361c65
...
@@ -1813,6 +1813,12 @@ int mi_sort_index(MI_CHECK *param, register MI_INFO *info, my_string name)
...
@@ -1813,6 +1813,12 @@ int mi_sort_index(MI_CHECK *param, register MI_INFO *info, my_string name)
MI_STATE_INFO
old_state
;
MI_STATE_INFO
old_state
;
DBUG_ENTER
(
"mi_sort_index"
);
DBUG_ENTER
(
"mi_sort_index"
);
/* cannot sort index files with R-tree indexes */
for
(
key
=
0
,
keyinfo
=
&
share
->
keyinfo
[
0
];
key
<
share
->
base
.
keys
;
key
++
,
keyinfo
++
)
if
(
keyinfo
->
key_alg
==
HA_KEY_ALG_RTREE
)
return
0
;
if
(
!
(
param
->
testflag
&
T_SILENT
))
if
(
!
(
param
->
testflag
&
T_SILENT
))
printf
(
"- Sorting index for MyISAM-table '%s'
\n
"
,
name
);
printf
(
"- Sorting index for MyISAM-table '%s'
\n
"
,
name
);
...
@@ -1905,6 +1911,8 @@ static int sort_one_index(MI_CHECK *param, MI_INFO *info, MI_KEYDEF *keyinfo,
...
@@ -1905,6 +1911,8 @@ static int sort_one_index(MI_CHECK *param, MI_INFO *info, MI_KEYDEF *keyinfo,
char
llbuff
[
22
];
char
llbuff
[
22
];
DBUG_ENTER
(
"sort_one_index"
);
DBUG_ENTER
(
"sort_one_index"
);
/* cannot walk over R-tree indices */
DBUG_ASSERT
(
keyinfo
->
key_alg
!=
HA_KEY_ALG_RTREE
);
new_page_pos
=
param
->
new_file_pos
;
new_page_pos
=
param
->
new_file_pos
;
param
->
new_file_pos
+=
keyinfo
->
block_length
;
param
->
new_file_pos
+=
keyinfo
->
block_length
;
...
...
mysql-test/r/gis-rtree.result
View file @
79361c65
...
@@ -881,3 +881,14 @@ ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
...
@@ -881,3 +881,14 @@ ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
INSERT INTO t1(foo) VALUES ('');
INSERT INTO t1(foo) VALUES ('');
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
DROP TABLE t1;
DROP TABLE t1;
CREATE TABLE t1 (a INT AUTO_INCREMENT, b POINT NOT NULL, KEY (a), SPATIAL KEY (b));
INSERT INTO t1 (b) VALUES (GeomFromText('POINT(1 2)'));
INSERT INTO t1 (b) SELECT b FROM t1;
INSERT INTO t1 (b) SELECT b FROM t1;
INSERT INTO t1 (b) SELECT b FROM t1;
INSERT INTO t1 (b) SELECT b FROM t1;
INSERT INTO t1 (b) SELECT b FROM t1;
OPTIMIZE TABLE t1;
Table Op Msg_type Msg_text
test.t1 optimize status OK
DROP TABLE t1;
mysql-test/r/ps.result
View file @
79361c65
...
@@ -1514,4 +1514,19 @@ Variable_name Value
...
@@ -1514,4 +1514,19 @@ Variable_name Value
Slow_queries 1
Slow_queries 1
deallocate prepare no_index;
deallocate prepare no_index;
deallocate prepare sq;
deallocate prepare sq;
CREATE TABLE t1 (a int);
INSERT INTO t1 VALUES (1), (2);
CREATE TABLE t2 (b int);
INSERT INTO t2 VALUES (NULL);
SELECT a FROM t1 WHERE (SELECT b FROM t2) IS NULL;
a
1
2
PREPARE stmt FROM 'SELECT a FROM t1 WHERE (SELECT b FROM t2) IS NULL';
EXECUTE stmt;
a
1
2
DEALLOCATE PREPARE stmt;
DROP TABLE t1,t2;
End of 5.0 tests.
End of 5.0 tests.
mysql-test/r/subselect.result
View file @
79361c65
...
@@ -3033,6 +3033,19 @@ t3 CREATE TABLE `t3` (
...
@@ -3033,6 +3033,19 @@ t3 CREATE TABLE `t3` (
`a` datetime default NULL
`a` datetime default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1,t2,t3;
DROP TABLE t1,t2,t3;
CREATE TABLE t1 (a int);
INSERT INTO t1 VALUES (1), (2);
SELECT a FROM t1 WHERE (SELECT 1 FROM DUAL WHERE 1=0) > 0;
a
SELECT a FROM t1 WHERE (SELECT 1 FROM DUAL WHERE 1=0) IS NULL;
a
1
2
EXPLAIN SELECT a FROM t1 WHERE (SELECT 1 FROM DUAL WHERE 1=0) IS NULL;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 2
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
DROP TABLE t1;
create table t1 (df decimal(5,1));
create table t1 (df decimal(5,1));
insert into t1 values(1.1);
insert into t1 values(1.1);
insert into t1 values(2.2);
insert into t1 values(2.2);
...
...
mysql-test/r/udf.result
View file @
79361c65
...
@@ -194,6 +194,17 @@ DROP FUNCTION sequence;
...
@@ -194,6 +194,17 @@ DROP FUNCTION sequence;
DROP FUNCTION lookup;
DROP FUNCTION lookup;
DROP FUNCTION reverse_lookup;
DROP FUNCTION reverse_lookup;
DROP FUNCTION avgcost;
DROP FUNCTION avgcost;
select * from mysql.func;
name ret dl type
CREATE FUNCTION is_const RETURNS STRING SONAME "UDF_EXAMPLE_LIB";
select IS_const(3);
IS_const(3)
const
drop function IS_const;
select * from mysql.func;
name ret dl type
select is_const(3);
ERROR 42000: FUNCTION test.is_const does not exist
CREATE FUNCTION is_const RETURNS STRING SONAME "UDF_EXAMPLE_LIB";
CREATE FUNCTION is_const RETURNS STRING SONAME "UDF_EXAMPLE_LIB";
select
select
is_const(3) as const,
is_const(3) as const,
...
...
mysql-test/t/gis-rtree.test
View file @
79361c65
...
@@ -254,3 +254,20 @@ INSERT INTO t1() VALUES ();
...
@@ -254,3 +254,20 @@ INSERT INTO t1() VALUES ();
--
error
1416
--
error
1416
INSERT
INTO
t1
(
foo
)
VALUES
(
''
);
INSERT
INTO
t1
(
foo
)
VALUES
(
''
);
DROP
TABLE
t1
;
DROP
TABLE
t1
;
#
# Bug #23578: Corruption prevents Optimize table from working properly with a
# spatial index
#
CREATE
TABLE
t1
(
a
INT
AUTO_INCREMENT
,
b
POINT
NOT
NULL
,
KEY
(
a
),
SPATIAL
KEY
(
b
));
INSERT
INTO
t1
(
b
)
VALUES
(
GeomFromText
(
'POINT(1 2)'
));
INSERT
INTO
t1
(
b
)
SELECT
b
FROM
t1
;
INSERT
INTO
t1
(
b
)
SELECT
b
FROM
t1
;
INSERT
INTO
t1
(
b
)
SELECT
b
FROM
t1
;
INSERT
INTO
t1
(
b
)
SELECT
b
FROM
t1
;
INSERT
INTO
t1
(
b
)
SELECT
b
FROM
t1
;
OPTIMIZE
TABLE
t1
;
DROP
TABLE
t1
;
mysql-test/t/ps.test
View file @
79361c65
...
@@ -1563,4 +1563,22 @@ execute sq;
...
@@ -1563,4 +1563,22 @@ execute sq;
deallocate
prepare
no_index
;
deallocate
prepare
no_index
;
deallocate
prepare
sq
;
deallocate
prepare
sq
;
#
# Bug 25027: query with a single-row non-correlated subquery
# and IS NULL predicate
#
CREATE
TABLE
t1
(
a
int
);
INSERT
INTO
t1
VALUES
(
1
),
(
2
);
CREATE
TABLE
t2
(
b
int
);
INSERT
INTO
t2
VALUES
(
NULL
);
SELECT
a
FROM
t1
WHERE
(
SELECT
b
FROM
t2
)
IS
NULL
;
PREPARE
stmt
FROM
'SELECT a FROM t1 WHERE (SELECT b FROM t2) IS NULL'
;
EXECUTE
stmt
;
DEALLOCATE
PREPARE
stmt
;
DROP
TABLE
t1
,
t2
;
--
echo
End
of
5.0
tests
.
--
echo
End
of
5.0
tests
.
mysql-test/t/subselect.test
View file @
79361c65
...
@@ -1988,6 +1988,18 @@ SHOW CREATE TABLE t3;
...
@@ -1988,6 +1988,18 @@ SHOW CREATE TABLE t3;
DROP
TABLE
t1
,
t2
,
t3
;
DROP
TABLE
t1
,
t2
,
t3
;
#
# Bug 24670: subquery witout tables but with a WHERE clause
#
CREATE
TABLE
t1
(
a
int
);
INSERT
INTO
t1
VALUES
(
1
),
(
2
);
SELECT
a
FROM
t1
WHERE
(
SELECT
1
FROM
DUAL
WHERE
1
=
0
)
>
0
;
SELECT
a
FROM
t1
WHERE
(
SELECT
1
FROM
DUAL
WHERE
1
=
0
)
IS
NULL
;
EXPLAIN
SELECT
a
FROM
t1
WHERE
(
SELECT
1
FROM
DUAL
WHERE
1
=
0
)
IS
NULL
;
DROP
TABLE
t1
;
# End of 4.1 tests
# End of 4.1 tests
#
#
...
...
mysql-test/t/udf.test
View file @
79361c65
...
@@ -187,6 +187,23 @@ DROP FUNCTION lookup;
...
@@ -187,6 +187,23 @@ DROP FUNCTION lookup;
DROP
FUNCTION
reverse_lookup
;
DROP
FUNCTION
reverse_lookup
;
DROP
FUNCTION
avgcost
;
DROP
FUNCTION
avgcost
;
#
# Bug #15439: UDF name case handling forces DELETE FROM mysql.func to remove
# the UDF
#
select
*
from
mysql
.
func
;
--
replace_result
$UDF_EXAMPLE_LIB
UDF_EXAMPLE_LIB
eval
CREATE
FUNCTION
is_const
RETURNS
STRING
SONAME
"
$UDF_EXAMPLE_LIB
"
;
select
IS_const
(
3
);
drop
function
IS_const
;
select
*
from
mysql
.
func
;
--
error
1305
select
is_const
(
3
);
#
#
# Bug#18761: constant expression as UDF parameters not passed in as constant
# Bug#18761: constant expression as UDF parameters not passed in as constant
#
#
...
...
sql/item_subselect.cc
View file @
79361c65
...
@@ -348,6 +348,7 @@ Item_singlerow_subselect::select_transformer(JOIN *join)
...
@@ -348,6 +348,7 @@ Item_singlerow_subselect::select_transformer(JOIN *join)
*/
*/
!
(
select_lex
->
item_list
.
head
()
->
type
()
==
FIELD_ITEM
||
!
(
select_lex
->
item_list
.
head
()
->
type
()
==
FIELD_ITEM
||
select_lex
->
item_list
.
head
()
->
type
()
==
REF_ITEM
)
&&
select_lex
->
item_list
.
head
()
->
type
()
==
REF_ITEM
)
&&
!
join
->
conds
&&
!
join
->
having
&&
/*
/*
switch off this optimization for prepare statement,
switch off this optimization for prepare statement,
because we do not rollback this changes
because we do not rollback this changes
...
@@ -372,8 +373,6 @@ Item_singlerow_subselect::select_transformer(JOIN *join)
...
@@ -372,8 +373,6 @@ Item_singlerow_subselect::select_transformer(JOIN *join)
*/
*/
substitution
->
walk
(
&
Item
::
remove_dependence_processor
,
substitution
->
walk
(
&
Item
::
remove_dependence_processor
,
(
byte
*
)
select_lex
->
outer_select
());
(
byte
*
)
select_lex
->
outer_select
());
/* SELECT without FROM clause can't have WHERE or HAVING clause */
DBUG_ASSERT
(
join
->
conds
==
0
&&
join
->
having
==
0
);
return
RES_REDUCE
;
return
RES_REDUCE
;
}
}
return
RES_OK
;
return
RES_OK
;
...
@@ -2276,6 +2275,22 @@ bool subselect_single_select_engine::no_tables()
...
@@ -2276,6 +2275,22 @@ bool subselect_single_select_engine::no_tables()
}
}
/*
Check statically whether the subquery can return NULL
SINOPSYS
subselect_single_select_engine::may_be_null()
RETURN
FALSE can guarantee that the subquery never return NULL
TRUE otherwise
*/
bool
subselect_single_select_engine
::
may_be_null
()
{
return
((
no_tables
()
&&
!
join
->
conds
&&
!
join
->
having
)
?
maybe_null
:
1
);
}
/*
/*
Report about presence of tables in subquery
Report about presence of tables in subquery
...
...
sql/item_subselect.h
View file @
79361c65
...
@@ -362,7 +362,7 @@ class subselect_engine: public Sql_alloc
...
@@ -362,7 +362,7 @@ class subselect_engine: public Sql_alloc
enum
Item_result
type
()
{
return
res_type
;
}
enum
Item_result
type
()
{
return
res_type
;
}
enum_field_types
field_type
()
{
return
res_field_type
;
}
enum_field_types
field_type
()
{
return
res_field_type
;
}
virtual
void
exclude
()
=
0
;
virtual
void
exclude
()
=
0
;
bool
may_be_null
()
{
return
maybe_null
;
};
virtual
bool
may_be_null
()
{
return
maybe_null
;
};
virtual
table_map
upper_select_const_tables
()
=
0
;
virtual
table_map
upper_select_const_tables
()
=
0
;
static
table_map
calc_const_tables
(
TABLE_LIST
*
);
static
table_map
calc_const_tables
(
TABLE_LIST
*
);
virtual
void
print
(
String
*
str
)
=
0
;
virtual
void
print
(
String
*
str
)
=
0
;
...
@@ -399,6 +399,7 @@ class subselect_single_select_engine: public subselect_engine
...
@@ -399,6 +399,7 @@ class subselect_single_select_engine: public subselect_engine
void
print
(
String
*
str
);
void
print
(
String
*
str
);
bool
change_result
(
Item_subselect
*
si
,
select_subselect
*
result
);
bool
change_result
(
Item_subselect
*
si
,
select_subselect
*
result
);
bool
no_tables
();
bool
no_tables
();
bool
may_be_null
();
bool
is_executed
()
const
{
return
executed
;
}
bool
is_executed
()
const
{
return
executed
;
}
bool
no_rows
();
bool
no_rows
();
};
};
...
...
sql/sql_lex.cc
View file @
79361c65
...
@@ -1902,7 +1902,6 @@ void st_select_lex_unit::set_limit(SELECT_LEX *sl)
...
@@ -1902,7 +1902,6 @@ void st_select_lex_unit::set_limit(SELECT_LEX *sl)
{
{
ha_rows
select_limit_val
;
ha_rows
select_limit_val
;
DBUG_ASSERT
(
!
thd
->
stmt_arena
->
is_stmt_prepare
());
select_limit_val
=
(
ha_rows
)(
sl
->
select_limit
?
sl
->
select_limit
->
val_uint
()
:
select_limit_val
=
(
ha_rows
)(
sl
->
select_limit
?
sl
->
select_limit
->
val_uint
()
:
HA_POS_ERROR
);
HA_POS_ERROR
);
offset_limit_cnt
=
(
ha_rows
)(
sl
->
offset_limit
?
sl
->
offset_limit
->
val_uint
()
:
offset_limit_cnt
=
(
ha_rows
)(
sl
->
offset_limit
?
sl
->
offset_limit
->
val_uint
()
:
...
...
sql/sql_udf.cc
View file @
79361c65
...
@@ -535,7 +535,7 @@ int mysql_drop_function(THD *thd,const LEX_STRING *udf_name)
...
@@ -535,7 +535,7 @@ int mysql_drop_function(THD *thd,const LEX_STRING *udf_name)
tables
.
table_name
=
tables
.
alias
=
(
char
*
)
"func"
;
tables
.
table_name
=
tables
.
alias
=
(
char
*
)
"func"
;
if
(
!
(
table
=
open_ltable
(
thd
,
&
tables
,
TL_WRITE
)))
if
(
!
(
table
=
open_ltable
(
thd
,
&
tables
,
TL_WRITE
)))
goto
err
;
goto
err
;
table
->
field
[
0
]
->
store
(
udf
_name
->
str
,
udf_name
->
length
,
system_charset_info
);
table
->
field
[
0
]
->
store
(
udf
->
name
.
str
,
udf
->
name
.
length
,
&
my_charset_bin
);
table
->
file
->
extra
(
HA_EXTRA_RETRIEVE_ALL_COLS
);
table
->
file
->
extra
(
HA_EXTRA_RETRIEVE_ALL_COLS
);
if
(
!
table
->
file
->
index_read_idx
(
table
->
record
[
0
],
0
,
if
(
!
table
->
file
->
index_read_idx
(
table
->
record
[
0
],
0
,
(
byte
*
)
table
->
field
[
0
]
->
ptr
,
(
byte
*
)
table
->
field
[
0
]
->
ptr
,
...
...
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