The problem is that the offset argument of the limit clause
might be truncated on a 32-bits server built without big
tables support. The truncation was happening because the
original 64-bits long argument was being cast to a 32-bits
(ha_rows) offset counter.
The solution is to check if the conversing resulted in value
truncation and if so, the offset is set to the maximum possible
value that can fit on the type.
mysql-test/r/limit.result:
Add test case result for Bug#37075
mysql-test/t/limit.test:
Add test case for Bug#37075
sql/sql_lex.cc:
Check for truncation of the offset value. If value was
truncated, set to the maximum possible value.
The problem is that passing anything other than a integer to a limit
clause in a prepared statement would fail. This limitation was introduced
to avoid replication problems (e.g: replicating the statement with a
string argument would cause a parse failure in the slave).
The solution is to convert arguments to the limit clause to a integer
value and use this converted value when persisting the query to the log.
mysql-test/r/limit.result:
Update test case result.
mysql-test/r/ps.result:
Add test case result for Bug#33851
mysql-test/r/rpl_user_variables.result:
Test case result for replication of prepared statement with
limit clause.
mysql-test/t/limit.test:
Test parameters to limit clause.
mysql-test/t/ps.test:
Add test case for Bug#33851
mysql-test/t/rpl_user_variables.test:
Test replication of a parameter which value is converted.
sql/item.cc:
Convert value to integer if it's a parameter to a limit clause.
sql/item.h:
Flag signal that item is a parameter to a limit clause.
sql/item_func.cc:
Const member functions, object is not mutated.
sql/sql_class.h:
Const member functions, object is not mutated.
sql/sql_yacc.yy:
Flag that item is a parameter to a limit clause.
Problem: we may get syntactically incorrect queries in the binary log
if we use a string value user variable executing a PS which
contains '... limit ?' clause, e.g.
prepare s from "select 1 limit ?";
set @a='qwe'; execute s using @a;
Fix: raise an error in such cases.
mysql-test/r/limit.result:
Fix for bug #28464: a string argument to 'limit ?' PS - replication fails
- test result
mysql-test/t/limit.test:
Fix for bug #28464: a string argument to 'limit ?' PS - replication fails
- test case
sql/item.cc:
Fix for bug #28464: a string argument to 'limit ?' PS - replication fails
- if Item_param::strict_type is set, check given and required types,
return an error if not equal.
sql/item.h:
Fix for bug #28464: a string argument to 'limit ?' PS - replication fails
- bool strict_type introduced, which indicates that a parameter value must be of
the required_result_type type.
- set_strict_type() function introduced to set required type.
sql/sql_yacc.yy:
Fix for bug #28464: a string argument to 'limit ?' PS - replication fails
- as we accept only INTs in the 'limit' clause set parameter's required type.
mysql-test/r/limit.result:
Add missing drop of table t1
mysql-test/r/lowercase_fs_off.result:
Add missing drop of "sample" user
mysql-test/t/limit.test:
Add missing drop of table t1
mysql-test/t/lowercase_fs_off.test:
Add missing drop of "sample" user
into dl145s.mysql.com:/data/tkatchaounov/5.0-bug-21787
mysql-test/r/limit.result:
Auto merged
mysql-test/t/limit.test:
Auto merged
sql/sql_select.cc:
Adjust the fix for BUG#21787 for 5.0
The problem was due to a prior fix for BUG 9676, which limited
the rows stored in a temporary table to the LIMIT clause. This
optimization is not applicable to non-group queries with aggregate
functions. The fix disables the optimization in this case.
mysql-test/r/limit.result:
Test case for BUG#21787
mysql-test/t/limit.test:
Test case for BUG#21787
sql/sql_select.cc:
If there is an aggregate function in a non-group query,
materialize all rows in the temporary table no matter if
there is a LIMIT clause. This is necessary, since the
aggregate functions must be computed over all result rows,
not just the first LIMIT rows.
mysql-test/r/create.result:
Auto merged
mysql-test/r/ctype_latin1_de.result:
Auto merged
mysql-test/r/grant.result:
Auto merged
mysql-test/r/grant2.result:
Auto merged
mysql-test/r/limit.result:
Auto merged
mysql-test/r/order_by.result:
Auto merged
mysql-test/r/rpl000001.result:
Auto merged
mysql-test/r/sp.result:
Auto merged
mysql-test/r/strict.result:
Auto merged
mysql-test/r/type_blob.result:
Auto merged
mysql-test/r/type_ranges.result:
Auto merged
mysql-test/r/warnings.result:
Auto merged
mysql-test/t/ctype_latin1_de.test:
Auto merged
mysql-test/t/limit.test:
Auto merged
mysql-test/t/order_by.test:
Auto merged
mysql-test/t/show_check.test:
Auto merged
mysql-test/t/sp.test:
Auto merged
mysql-test/t/type_blob.test:
Auto merged
mysql-test/t/type_ranges.test:
Auto merged
sql/item.cc:
Auto merged
sql/item.h:
Auto merged
sql/sql_insert.cc:
Auto merged
mysql-test/t/strict.test:
SCCS merged
Allow LIMIT clause after DUAL.
mysql-test/r/limit.result:
Added test result for BUG#8023.
mysql-test/t/limit.test:
Added test for BUG#8023.
sql/sql_yacc.yy:
Allow the specification of a LIMIT clause after DUAL. This is needed for queries as:
select a from t1 union all select 1 from dual limit 1;
In this query LIMIT is applied to the whole UNION, so it makes sense, however, the
current parser did not allow any clause after DUAL.
are not specified in an insert. Most of these changes are actually to
clean up the test suite to either specify defaults to avoid warnings,
or add the warnings to the results. Related to bug #5986.
mysql-test/t/index_merge_ror.test:
Set default on columns to avoid warnings
mysql-test/t/ctype_many.test:
Add defaults to avoid warnings
mysql-test/t/ctype_latin1_de.test:
Add defaults to avoid warnings
mysql-test/t/gis-rtree.test:
Remove field that isn't used in test
mysql-test/t/limit.test:
set default values
mysql-test/t/null.test:
Specify default values
mysql-test/t/order_by.test:
add default value
mysql-test/t/show_check.test:
Add defaults
mysql-test/t/sp.test:
Add default value
mysql-test/t/type_blob.test:
Set default value
mysql-test/t/type_ranges.test:
Set default values
mysql-test/r/create.result:
Update results
mysql-test/r/ctype_latin1_de.result:
Update results
mysql-test/r/ctype_many.result:
Update results
mysql-test/r/gis-rtree.result:
Update results
mysql-test/r/grant.result:
Update results
mysql-test/r/grant2.result:
Update results
mysql-test/r/help.result:
Update results
mysql-test/r/limit.result:
Update results
mysql-test/r/null.result:
Update results
mysql-test/r/order_by.result:
Update results
mysql-test/r/rpl000001.result:
Update results
mysql-test/r/sp.result:
Update results
mysql-test/r/strict.result:
Update results
mysql-test/r/type_blob.result:
Update results
mysql-test/r/type_ranges.result:
Update results
mysql-test/r/warnings.result:
Update results
sql/sql_insert.cc:
Change check_that_all_fields_are_given_values() to issue warnings for all
fields, and not only run when thd->abort_on_warning is set and error on
just the first field.
mysql_server_init() now returns error code if something went wrong (Bug #2062)
Don't use my_fopen() when reading symlink information as this may cause problems when a lot of files are opened.
Free thread keys with pthread_key_delete() instead of relying on automatic free. (Bug #2062)
Fixed bug in UNION statement with alias '*'. (Bug #1249)
Fixed a bug in DELETE ... ORDER BY ... LIMIT where the rows where not deleted in the proper order. (Bug #1024).
FOUND_ROWS() could return incorrect number of rows after a query with an impossible WHERE condition.
HOW DATABASES doesn't anymore show .sym files (on windows) that doesn't point to a valid directory. (Bug #1385)
include/config-win.h:
Ensure that USE_SYMDIR is set for all windows versions
(This is set in makefiles, so this is just an extra safety measure)
include/my_pthread.h:
Fixed a possible memory leak on MacOSX when using the shared libmysql.so library (Bug #2061)
include/my_sys.h:
my_init() now returns error code if something went wrong
include/mysql.h:
mysql_once_init() now returns error code if something went wrong
include/mysql_com.h:
my_init() now returns error code if something went wrong
libmysql/libmysql.c:
mysql_server_init() and mysql_once_init() now returns error code if something went wrong (Bug #2062)
mysql-test/r/limit.result:
Update results
mysql-test/r/select_found.result:
Update results
mysql-test/r/union.result:
Update results
mysql-test/t/limit.test:
Added test for DELETE ... ORDER BY ... LIMIT (bug #1024)
mysql-test/t/select_found.test:
Added test for problem with impossible WHERE (Bug #1468)
mysql-test/t/union.test:
Added test for problem with alias '*' (Bug #1249)
mysys/mf_pack.c:
Don't use my_fopen() when reading symlink information as this may cause problems when a lot of files are opened.
mysys/my_init.c:
my_init() now returns error code if something went wrong
mysys/my_lib.c:
More debug information
mysys/my_thr_init.c:
Free thread keys with pthread_key_delete() instead of relying on automatic free. (Bug #2062)
sql/sql_base.cc:
Fixed bug in UNION statement with alias '*'. (Bug #1249)
sql/sql_delete.cc:
Fixed a bug in DELETE ... ORDER BY ... LIMIT where the rows where not deleted in the proper order. (Bug #1024).
sql/sql_select.cc:
FOUND_ROWS() could return incorrect number of rows after a query with an impossible WHERE condition.
sql/sql_show.cc:
SHOW DATABASES doesn't anymore show .sym files (on windows) that doesn't point to a valid directory. (Bug #1385)
sql/sql_yacc.yy:
Allow syntax UNION DISTINCT
Added counting of rollback's and commits
Fixed bug in 'SELECT 0 LIMIT 0'
Fixed bug in 'SELECT SQL_CALC_FOUND_ROWS'
Docs/manual.texi:
Changelog
configure.in:
Cleanup
myisam/myisamchk.c:
Fix some bugs introduced with the new my_getopt
mysql-test/r/limit.result:
Test for bugfix
mysql-test/r/rpl000001.result:
fix wrong result
mysql-test/r/select.result:
Fix things after fixing ignore index()
mysql-test/r/select_found.result:
Test of bug in SQL_CALC_FOUND_ROWS
mysql-test/t/limit.test:
Test bug in LIMIT 0
mysql-test/t/rpl000001.test:
fix wrong result
mysql-test/t/select_found.test:
Test of bug in SQL_CALC_FOUND_ROWS
sql/handler.cc:
Added counting of rollback's and commits
sql/mysql_priv.h:
Added counting of rollback's and commits
sql/mysqld.cc:
Added counting of rollback's and commits
sql/sql_select.cc:
Fixed bug in 'SELECT 0 LIMIT 0'
Fixed bug in 'SELECT SQL_CALC_FOUND_ROWS'
Added warning for tables where the auto_increment key is 0
Fixed DELETE ... LIMIT 0
Fixed UPDATE ..LIMIT 0
Docs/manual.texi:
Changelog + Update to CHECK TABLE
configure.in:
Patch for netBSD
mit-pthreads/gen/ctime.c:
Patch for netBSD
mit-pthreads/machdep/netbsd-1.1/__signal.h:
Patch for netBSD
mit-pthreads/stdio/strerror.c:
Patch for netBSD
myisam/mi_check.c:
Added warning for tables where the auto_increment key is 0
myisam/myisamchk.c:
Added warning for tables where the auto_increment key is 0
mysql-test/r/auto_increment.result:
Added warning for tables where the auto_increment key is 0
mysql-test/r/limit.result:
Test of DELETE ... LIMIT 0
mysql-test/t/auto_increment.test:
Added warning for tables where the auto_increment key is 0
mysql-test/t/limit.test:
Test of DELETE ... LIMIT 0
sql/Makefile.am:
Don't add mysqld_LDADD to mysqlbinlog (portability patch)
sql/ha_gemini.cc:
Changed copyright (have got ok from NuSphere previously)
sql/ha_gemini.h:
Changed copyright (have got ok from NuSphere previously)
sql/sql_delete.cc:
Fixed DELETE ... LIMIT 0
sql/sql_update.cc:
Fixed UPDATE ..LIMIT 0