limit.
mysql-test/r/ps.result:
Post-merge fixes.
mysql-test/t/ps.test:
Post-merge fixes.
sql/share/errmsg.txt:
Add a new error message for max_prepared_stmt_count limit,
we can do it in 5.0
sql/sql_class.cc:
Post-merge fixes.
sql/sql_class.h:
Post-merge fixes.
sql/sql_prepare.cc:
Post-merge fixes.
If the second or the third argument of a BETWEEN predicate was
a constant expression, like '2005.09.01' - INTERVAL 6 MONTH,
while the other two arguments were fields then the predicate
was evaluated incorrectly and the query returned a wrong
result set.
The bug was introduced in 5.0.17 when in the fix for 12612.
mysql-test/r/func_time.result:
Added a test case for bug #18618.
mysql-test/t/func_time.test:
Added a test case for bug #18618.
mysql-test/r/innodb.result:
Fix for bug #14360: Date Between Interval Broken.
- test case.
mysql-test/t/innodb.test:
Fix for bug #14360: Date Between Interval Broken.
- test case.
sql/item_timefunc.cc:
Fix for bug #14360: Date Between Interval Broken.
- Item_date_add_interval::eq() introduced.
sql/item_timefunc.h:
Fix for bug #14360: Date Between Interval Broken.
- Item_date_add_interval::eq() introduced.
The function agg_cmp_type in item_cmpfunc.cc neglected the fact that
the first argument in a BETWEEN/IN predicate could be a field of a view.
As a result in the case when the retrieved table was hidden by a view
over it and the arguments in the BETWEEN/IN predicates are of
the date/time type the function did not perform conversion of
the constant arguments to the same format as the first field argument.
If formats of the arguments differed it caused wrong a evaluation of
the predicates.
mysql-test/r/view.result:
Added a test case for bug #16069.
mysql-test/t/view.test:
Added a test case for bug #16069.
innobase_query_caching_of_table_permitted()".
Applied the patch due to Heikki Tuuri.
Also removed superfluous #ifdefs.
sql/sql_cache.cc:
Applied the patch due to Heikki Tuuri.
Query_cache::store_query(): Make InnoDB to release the adaptive
hash index latch before MySQL acquires the query cache mutex.
sql/sql_class.cc:
Removing superfluous #ifdefs (suggested by Sanja, also discussed with Serg).
sql/sql_cursor.cc:
Removing superfluous #ifdefs (suggested by Sanja, also discussed with Serg).
into mysql.com:/opt/local/work/mysql-4.1-16365
sql/mysql_priv.h:
Auto merged
sql/sql_class.h:
Auto merged
mysql-test/r/ps.result:
Manual merge
mysql-test/t/ps.test:
Manual merge
too many open statements". The patch adds a new global variable
@@max_prepared_stmt_count. This variable limits the total number
of prepared statements in the server. The default value of
@@max_prepared_stmt_count is 16382. 16382 small statements
(a select against 3 tables with GROUP, ORDER and LIMIT) consume
100MB of RAM. Once this limit has been reached, the server will
refuse to prepare a new statement and return ER_UNKNOWN_ERROR
(unfortunately, we can't add new errors to 4.1 without breaking 5.0). The limit is changeable after startup
and can accept any value from 0 to 1 million. In case
the new value of the limit is less than the current
statement count, no new statements can be added, while the old
still can be used. Additionally, the current count of prepared
statements is now available through a global read-only variable
@@prepared_stmt_count.
mysql-test/r/ps.result:
Test results fixed (a test case for Bug#16365)
mysql-test/t/ps.test:
A test case for Bug#16365 "Prepared Statements: DoS with too many
open statements". Also fix statement leaks in other tests.
sql/mysql_priv.h:
Add declarations for new global variables.
sql/mysqld.cc:
Add definitions of max_prepared_stmt_count, prepared_stmt_count.
sql/set_var.cc:
Implement support for @@prepared_stmt_count and
@@max_prepared_stmt_count. Currently these variables are queried
without acquiring LOCK_prepared_stmt_count due to limitations of
the set_var/sys_var class design. Updates are, however, protected
with a lock.
sql/set_var.h:
New declarations to add support for @@max_prepared_stmt_count.
Implement a new class, where the lock to be used when updating
a variable is a parameter.
sql/sql_class.cc:
Add accounting of the total number of prepared statements in the
server to the methods of Statement_map.
sql/sql_class.h:
Add accounting of the total number of prepared statements in the
server to the methods of Statement_map.
sql/sql_prepare.cc:
Statement_map::insert will now send a message in case of an
error.
gives wrong results". Implement previously missing
Item_row::cleanup. The bug is not repeatable in 5.0, probably
due to a coincidence: the problem is present in 5.0 as well.
mysql-test/r/ps.result:
Update the result file (Bug#16248)
mysql-test/t/ps.test:
Add a test case for Bug#16248 "WHERE (col1,col2) IN ((?,?)) gives
wrong results"
sql/item_row.cc:
Implement Item_row::cleanup(): we should reset used_tables_cache
before reexecution of a prepared statement. In case ROW
arguments contain a placeholder, used_tables_cache has PARAM_TABLE
bit set in statement prepare. As a result, when executing a statement,
the condition push down algorithm (make_cond_for_table) would think
that the WHERE clause belongs to the non-existent PARAM_TABLE and
wouldn't attach the WHERE clause to any of the real tables,
effectively optimizing the clause away.
sql/item_row.h:
Remove a never used member 'array_holder'. Add declaration for
Item_row::cleanup.
Idea of the fix is for master to send FD event with `created' as 0
to reconnecting slave (upon slave_net_timeout, no master crash) to avoid destroying temp tables.
In a case of a connect by slave to the master after its crash temp tables have been already
cleaned up so that slave can not keep `orphan' temp tables.
mysql-test/r/rpl_temporary.result:
results
mysql-test/t/rpl_temporary.test:
wait-free addon to check temp tables are ok after slave reconnect.
sql/sql_repl.cc:
Storing zero for assigning to `created' of FD event on the reconnecting slave.
mysql-test/include/get_binlog_dump_thread_id.inc:
mysqltest's preudo-macro to calculate $id master dump thread id
mysql-test/r/func_time.result:
expected test results for bug #18100 added
mysql-test/t/func_time.test:
test case for bug #18100 added
sql/item_timefunc.cc:
wrong formula for EXTRACT QUARTER, now uses the same calculus as the QUARTER()
function
The problem was due to the fact that with --lower-case-table-names set to 1
the function find_field_in_group did not convert the prefix 'HU' in
HU.PROJ.CITY into lower case when looking for it in the group list. Yet the
names in the group list were extended by the database name in lower case.
mysql-test/r/having.result:
Added a test case for bug #15917.
mysql-test/t/having.test:
Added a test case for bug #15917.
sql/item.cc:
Fixed bug #15917: unexpected complain for a NIST test case.
The problem was due to the fact that with --lower-case-table-names set to 1
the function find_field_in_group did not convert the prefix 'HU' in
HU.PROJ.CITY into lower case when looking for it in the group list. Yet the
names in the group list were extended by the database name in lower case.
The needed conversion was added to the code of find_field_in_group.
counter".
When TRUNCATE TABLE was called within an stored procedure the
auto_increment counter was not reset to 0 even if straight
TRUNCATE for this table did this.
This fix makes TRUNCATE in stored procedures to be handled exactly
in the same way as straight TRUNCATE. We achieve this by rolling
back the fix for bug 8850, which is no longer needed since stored
procedures don't require prelocked mode anymore (and TRUNCATE is
not allowed in stored functions or triggers).
mysql-test/r/sp.result:
Test case for BUG#14945.
mysql-test/t/sp.test:
Test case for BUG#14945.
sql/sql_delete.cc:
Handle TRUNCATE in stored procedures exactly in the same way as straight
TRUNCATE (i.e. without falling back to DELETE if possible). We achieve
this by rolling back the fix for bug 8850, which is no longer relevant
since stored procedures don't require prelocked mode anymore
(and TRUNCATE is not allowed in stored functions or triggers).
sql/sql_parse.cc:
Handle TRUNCATE in stored procedures exactly in the same way as straight
TRUNCATE (i.e. without falling back to DELETE if possible). We achieve
this by rolling back the fix for bug 8850, which is no longer relevant
since stored procedures don't require prelocked mode anymore
(and TRUNCATE is not allowed in stored functions or triggers).
Additional fix for INSERT DELAYED with subselect.
Originally detected in 5.1, but 5.0 could also be affected.
The user thread creates a dummy table object,
which is not included in the lock. The 'real' table is
opened and locked by the 'delayed' system thread.
The dummy object is now marked as not locked and this is
tested in mysql_lock_have_duplicate().
sql/lock.cc:
BUG#5390 - problems with merge tables
Additional fix for INSERT DELAYED with subselect.
The user thread creates a dummy table object,
which is not included in the lock.
Changed to safer asserts.
sql/sql_insert.cc:
BUG#5390 - problems with merge tables
Marked the dummy table object as not being
included in the lock.
Mutli-table uses temporary table to store new values for fields. With the
new values the rowid of the record to be updated is stored in a Field_string
field. Table to be updated is set as source table of the rowid field.
But when the temporary table creates the tmp field for the rowid field it
converts it to a varstring field because the table to be updated was created by
the v4.1. Due to this the stored rowids were broken and no records for
update were found.
The flag can_alter_field_type is added to Field_string class. When it is set to
0 the field won't be converted to varstring. The Field_string::type() function
now always returns MYSQL_TYPE_STRING if can_alter_field_type is set to 0.
The multi_update::initialize_tables() function now sets can_alter_field_type
flag to 0 for the rowid fields denying conversion of the field to a varstring
field.
sql/field.h:
Fixed bug #16281: Multi-table update broken in 5.0 on tables imported from 4.1
The flag can_alter_field_type is added to Field_string class. When it is set to
0 the field won't be converted to varstring.
The Field_string::type() function now always returns MYSQL_TYPE_STRING if
can_alter_field_type is set to 0.
sql/sql_update.cc:
Fixed bug #16281: Multi-table update broken in 5.0 on tables imported from 4.1
The multi_update::initialize_tables() function now sets can_alter_field_type
flag to 0 for the rowid fields denying conversion of the field to a varstring
field.
The wrong value was being reported as the field_length for BIT
fields, resulting in confusion for at least Connector/J. The
field_length is now always the number of bits in the field, as
it should be.
mysql-test/r/type_bit.result:
Add new results
mysql-test/r/type_bit_innodb.result:
Add new results
mysql-test/t/type_bit.test:
Add new regression test
mysql-test/t/type_bit_innodb.test:
Add new regression test
sql/field.cc:
Fix Field_bit->field_length to actually report the display width, and
store the bytes stored in the rec in the new bytes_in_rec member.
sql/field.h:
Fix Field_bit::field_length to store the correct value, adding
Field_bit::bytes_in_rec to remember the number of bytes used for
storing the value. Remove Field_bit_as_char::create_length, as it
is now redundant.
sql/ha_ndbcluster.cc:
Handle field_length of Field_bit actually being the display width (# of bits).
sql/key.cc:
Fix inappropriate use of field->field_length for BIT field.
The bug was caused by wrong behaviour of mysql_insert() which in case
of INSERT DELAYED into a view exited with thd->net.report_error == 0.
This blocked error reporting to the client which started waiting
infinitely for response to the query.
mysql-test/r/insert.result:
Fixed results for the added test case.
mysql-test/t/insert.test:
Added test case.
sql/sql_insert.cc:
Fixed BUG#13683: INSERT DELAYED into a view creates an infinite loop.
Changed mysql_insert(): delayed_get_table() applied to a view exits
with ER_WRONG_OBJECT error (and with thd->net.report_error == 1) and
in this case we must just exit from mysql_insert(). Prior to this
change, instead of exiting open_and_lock_tables() was invoked which
cleared thd->net.report_error to zero and caused the bug.
The code in opt_sum_query that prevented the COUNT/MIN/MAX
optimization from being applied to outer joins was not adjusted
after introducing nested joins. As a result if an outer join
contained a reference to a view as an inner table the code of
opt_sum_query missed the presence of an on expressions and
erroneously applied the mentioned optimization.
mysql-test/r/view.result:
Added a test case for bug #18237.
mysql-test/t/view.test:
Added a test case for bug #18237.