set DATE|DATETIME value to 0 if ALLOW_INVALID_DATES sql_mode is not enabled.
sql/field.cc:
set DATE|DATETIME value to 0 if ALLOW_INVALID_DATES sql_mode is not enabled.
tests/mysql_client_test.c:
test case
The code to get read the value of a system variable was extracting its value
on PREPARE stage and was substituting the value (as a constant) into the parse tree.
Note that this must be a reversible transformation, i.e. it must be reversed before
each re-execution.
Unfortunately this cannot be reliably done using the current code, because there are
other non-reversible source tree transformations that can interfere with this
reversible transformation.
Fixed by not resolving the value at PREPARE, but at EXECUTE (as the rest of the
functions operate). Added a cache of the value (so that it's constant throughout
the execution of the query). Note that the cache also caches NULL values.
Updated an obsolete related test suite (variables-big) and the code to test the
result type of system variables (as per bug 74).
mysql-test/extra/rpl_tests/rpl_insert_id.test:
Bug #32124: removed ambiguous testcase
mysql-test/r/innodb_data_home_dir_basic.result:
Bug #32124: fixed wrong test case
mysql-test/r/innodb_flush_method_basic.result:
Bug #32124: fixed wrong test case
mysql-test/r/ps_11bugs.result:
Bug #32124: test case
mysql-test/r/ssl_capath_basic.result:
Bug #32124: fixed wrong test case
mysql-test/r/ssl_cipher_basic.result:
Bug #32124: fixed wrong test case
mysql-test/r/variables.result:
Bug #32124: system vars are shown as such in EXPLAIN EXTENDED, not as constants.
mysql-test/suite/rpl/r/rpl_insert_id.result:
Bug #32124: removed ambiguous testcase
mysql-test/t/ps_11bugs.test:
Bug #32124: test case
sql/item.cc:
Bug #32124: placed the code to convert string to longlong or double
to a function (so that it can be reused)
sql/item.h:
Bug #32124: placed the code to convert string to longlong or double
to a function (so that it can be reused)
sql/item_func.cc:
Bug #32124: moved the evaluation of system variables at runtime (val_xxx).
sql/item_func.h:
Bug #32124: moved the evaluation of system variables at runtime (val_xxx).
sql/set_var.cc:
Bug #32124: removed the code that calculated the system variable's value
at PREPARE
sql/set_var.h:
Bug #32124: removed the code that calculated the system variable's value
at PREPARE
tests/mysql_client_test.c:
Bug #32124 : removed the reading of the system variable, because its max
length is depended on the system charset and client charset and can't be
easily calculated.
Send_field.org_col_name has broken value on secondary execution.
It happens when result field is created from the field which belongs to view
due to forgotten assignment of some Send_field attributes.
The fix:
set Send_field.org_col_name,org_table_name with correct value during Send_field intialization.
mysql-test/r/metadata.result:
result fix
The result file was changed because now forgotten attributes are properly set.
mysql-test/r/sp.result:
test result
mysql-test/t/sp.test:
test case
sql/item.cc:
Send_field.org_col_name has broken value on secondary execution.
It happens when result field is created from the field which belongs to view
due to forgotten assignment of some Send_field attributes.
The fix:
set Send_field.org_col_name,org_table_name with correct value during Send_field intialization.
tests/mysql_client_test.c:
test case fix
The test was changed because now forgotten attributes are properly set.
Length value is the length of the field,
Max_length is the length of the field value.
So Max_length can not be more than Length.
The fix: fixed calculation of the Item_empty_string item length
(Patch applied and queued on demand of Trudy/Davi.)
sql/item.h:
fixed calculation of the item length
sql/sql_show.cc:
removed unnecessary code
Post-merge fix: mysql_client_test.c is compiled by C compilers
and some C compilers don't support mixed declarations and code
and it's explicitly forbidden by ISO C90.
tests/mysql_client_test.c:
Don't mix declarations and code.
There was a typo in a error check causing wrong thing to be ckecked
and a possible error not being caught.
Fixed by using the correct variable to test for malloc() errors.
tests/mysql_client_test.c:
Bug #36887: fixed a typo
the local tree contains a fix for
Bug#32748 "Inconsistent handling of assignments to
general_log_file/slow_query_log_file",
which changes output of a number of tests.
mysql-test/r/general_log_file_basic.result:
Update results (Bug#32748)
mysql-test/r/log_output_basic.result:
Update the test with results of the fix for Bug#32748
mysql-test/r/slow_query_log_file_basic.result:
Update the test with results of the fix for Bug#32748
mysql-test/t/general_log_file_basic.test:
Adjust to take into account the fix for Bug#32748
(a port from 6.0-bugteam)
mysql-test/t/log_output_basic.test:
Adjust to take into account the fix for Bug#32748
(a port from 6.0-bugteam)
mysql-test/t/slow_query_log_file_basic.test:
Adjust to take into account the fix for Bug#32748
(a port from 6.0-bugteam)
tests/mysql_client_test.c:
Fix a compilation warning.
PREPARE", review fixes:
- make the patch follow the specification of WL#4166 and remove
the new error that was originally introduced.
Now the client never gets an error from reprepare, unless it failed.
I.e. even if the statement at hand returns a completely different
result set, this is not considered a server error.
The C API library, that can not handle this situation, was modified to
return a client error.
Added additional test coverage.
include/errmsg.h:
Add a new client side error: now when we automatically
reprepare a statement, the new result set may contain a different
number of columns.
include/mysql_com.h:
Add a new server status to be sent to the client if the
number of columns in the result set is different.
libmysql/errmsg.c:
Add a new error message.
libmysql/libmysql.c:
Make the client library robust against a result set that
contains a different number of columns from prepare time.
Previously that could never happen, and we simply had an assert.
That means in particular that all clients are advised to upgrade
with transition to 5.1, if they are using prepared statements C API.
Make mysql_stmt_store_result() and mysql_stmt_execute() robust against
"broken" statement handles (those that have an error).
sql/sql_parse.cc:
Clear transient server status flags at start of statement more
systematically.
sql/share/errmsg.txt:
Remove an error that is unused and is not part of any public release.
sql/sql_prepare.cc:
Instead of returning an error in case the number of result set columns
has changed, simply update the client in server status.
That will allow modern clients automatically recover from an error.
tests/mysql_client_test.c:
Add additional coverage to the cases when the number of result
set columns changed as a result of reprepare.
Cover conversion and truncation of result set columns.
"Crash in subquery code when in PS and table DDL changed after PREPARE"
include/my_sys.h:
Add two new flags for my_error(). These flags help parameterize
behavoiur of my_message_sql()
sql/item.cc:
Update comments.
Fix a typo in Item_param::set_param_type_and_swap_value()
sql/mysqld.cc:
Implement two additional flags for my_error():
- if ME_NO_SP_HANDLER is specified, ignore stored procedure continue/
exit handlers
- if ME_NO_WARNING_FOR_ERROR is specified, do not push warning
sql/sql_base.cc:
Update comments.
Rename a few methods.
sql/sql_class.h:
Update and improve comments.
sql/sql_prepare.cc:
Update comments.
Style changes.
sql/table.h:
Update comments.
Style changes.
Rename a few methods.
tests/mysql_client_test.c:
Zero the bind array, to follow C API requirements.
WL#4165 Prepared statements: validation
WL#4166 Prepared statements: automatic re-prepare
Fixes
Bug#27430 Crash in subquery code when in PS and table DDL changed after PREPARE
Bug#27690 Re-execution of prepared statement after table was replaced with a view crashes
Bug#27420 A combination of PS and view operations cause error + assertion on shutdown
The basic idea of the patch is to keep track of table metadata between
prepared statement prepare and execute. If some table used in the statement
has changed, the prepared statement is re-prepared before execution.
See WL#4165 and WL#4166 contents and comments in the code for details
of the implementation.
include/my_global.h:
Remove 'register' keyword to avoid warnings when swapping large structures
that don't fit into a register. Any modern compiler is capable of placing
a variable in a register when that would benefit performance.
mysql-test/r/ps_1general.result:
Update test results: since now we re-prepare automatically,
more correct results are produced in prepare-ddl-execute scenario.
mysql-test/r/query_cache_merge.result:
Ensure that the table definition cache is large enough for
the test to pass in --ps-protocol
mysql-test/r/trigger.result:
Update test results to reflect automatic statement reprepare.
mysql-test/t/disabled.def:
Enable ps_ddl.test, which now passes.
mysql-test/t/ps_1general.test:
Since now we re-execute prepared statements after DDL successfully,
change the test to produce repeatable results. Remove expectancy of
an error in one place where now we automatically reprepare the prepared
statement.
mysql-test/t/query_cache_merge.test:
Ensure the table definition cache is large enough for the test to pass
in --ps-protocol
mysql-test/t/trigger.test:
Sinc
sql/item.cc:
Implement Item_param "copy" functionality, used at re-prepare of
a prepared statement.
We copy the type of the original parameter, and move the assigned value,
if any. Sic, the value is "moved", since it can be quite big --
e.g. in case we deal with a LONG DATA parameter.
It's essential to move the value from the old parameter since
at the time of re-prepare the client packet with the necessary information
may be not available.
sql/item.h:
Declare a new method used for reprepare.
sql/my_decimal.h:
Implement "swap()" functionality of class my_decimal to be
able to easily swap two decimal values.
sql/mysql_priv.h:
Declare enum_metadata_type.
sql/mysqld.cc:
Implement a status variable for the number of reprepared statements.
sql/sql_base.cc:
Implement metadata version validation.
sql/share/errmsg.txt:
Add two new error messages: ER_NEED_REPREPARE and ER_PS_REBIND.
The first error (theoretically) never reaches the user.
It is issued by the metadata validation framework when a metadata version
has changed between prepare and execute. Later on it's intercepted
and the statement is automatically re-prepared. Only if the error
has occurred repeatedly MAX_REPREPARE_ATTEMTS (3) times do we
return it to the user.
The second error is issued when after re-prepare we discover
that the metadata we sent over to the client using the binary
protocol differs drammatically from the new result set metadata
that the reprepared statement produces (e.g. number of result
set columns is different).
sql/sql_class.cc:
Implement metadata version validation framework.
sql/sql_class.h:
Declarations for metadata version validation framework.
sql/sql_parse.cc:
Mark commands for which we must invalidate and reprepare a prepared
statement when metadata has changed.
sql/sql_prepare.cc:
Implement WL#4165 and WL#4166 (limited support of metadata validation
and re-prepare).
sql/table.h:
Implement metadata validation.
tests/mysql_client_test.c:
Add a test case for WL#4166
into amd64.(none):/src/bug26243/my50-bug26243
libmysql/libmysql.c:
Auto merged
myisam/mi_open.c:
Auto merged
sql/ha_federated.cc:
Auto merged
sql/ha_myisammrg.cc:
Auto merged
sql/slave.cc:
Auto merged
sql/sql_select.cc:
Auto merged
tests/mysql_client_test.c:
Auto merged
- Backported the 5.1 DBUG to 5.0.
- Avoid memory cleanup race on Windows client for CTRL-C
client/mysql.cc:
Bug#26243 mysql command line crash after control-c
- On Windows, the sigint handler shouldn't call mysql_end
because the main thread will do so automatically.
- Remove unnecessary signal call from the sigint handler.
- Call my_end with proper value.
dbug/dbug.c:
Bug#26243 mysql command line crash after control-c
- Backported the 5.1 DBUG library. The old version uses a non-thread
safe global variable 'static struct state *stack'.
dbug/factorial.c:
Bug#26243 mysql command line crash after control-c
- Backported the 5.1 DBUG library. The old version uses a non-thread
safe global variable 'static struct state *stack'.
dbug/user.r:
Bug#26243 mysql command line crash after control-c
- Backported the 5.1 DBUG library. The old version uses a non-thread
safe global variable 'static struct state *stack'.
include/my_dbug.h:
Bug#26243 mysql command line crash after control-c
- Backported the 5.1 DBUG library. The old version uses a non-thread
safe global variable 'static struct state *stack'.
libmysql/libmysql.c:
Bug#26243 mysql command line crash after control-c
- Update for new DBUG library.
myisam/mi_open.c:
Bug#26243 mysql command line crash after control-c
- Update for new DBUG library.
sql/ha_federated.cc:
Bug#26243 mysql command line crash after control-c
- Update for new DBUG library.
sql/ha_innodb.cc:
Bug#26243 mysql command line crash after control-c
- Update for new DBUG library.
sql/ha_myisammrg.cc:
Bug#26243 mysql command line crash after control-c
- Update for new DBUG library.
sql/item_cmpfunc.cc:
Bug#26243 mysql command line crash after control-c
- Update for new DBUG library.
sql/mysqld.cc:
Bug#26243 mysql command line crash after control-c
- Update for new DBUG library.
sql/net_serv.cc:
Bug#26243 mysql command line crash after control-c
- Update for new DBUG library.
sql/opt_range.cc:
Bug#26243 mysql command line crash after control-c
- Update for new DBUG library.
sql/set_var.cc:
Bug#26243 mysql command line crash after control-c
- Update for new DBUG library.
sql/slave.cc:
Bug#26243 mysql command line crash after control-c
- Update for new DBUG library.
sql/sql_cache.cc:
Bug#26243 mysql command line crash after control-c
- Update for new DBUG library.
sql/sql_select.cc:
Bug#26243 mysql command line crash after control-c
- Update for new DBUG library.
tests/mysql_client_test.c:
Bug#26243 mysql command line crash after control-c
- Update for new DBUG library.
mysql_client_test causing a severe slowdown and increase
in memory usage, especially for test cases with long queries.
The solution is to enable the general log only in tests that
actually need the general log and disable it during the
execution of all other tests.
tests/mysql_client_test.c:
Selectively enable and disable the general log.
into quad.opbmk:/mnt/raid/alik/MySQL/devel/5.1-rt-merged
libmysql/libmysql.c:
Auto merged
sql-common/client.c:
Auto merged
tests/mysql_client_test.c:
Manually merged.
into quad.opbmk:/mnt/raid/alik/MySQL/devel/5.0-rt-merged
libmysql/libmysql.c:
Auto merged
sql-common/client.c:
Auto merged
tests/mysql_client_test.c:
Manually merged.
into quad.opbmk:/mnt/raid/alik/MySQL/devel/5.1-rt-merged
libmysql/libmysql.c:
Auto merged
sql-common/client.c:
Auto merged
sql/mysql_priv.h:
Auto merged
sql/mysqld.cc:
Auto merged
tests/mysql_client_test.c:
Auto merged
libmysql/libmysql.c:
Manual merge
sql/sql_class.cc:
Don't send anything back to the client if disabled.
sql/sql_prepare.cc:
Don't send any packet back for statement close.
tests/mysql_client_test.c:
Manual merge
The problem was that the COM_STMT_SEND_LONG_DATA was sending a response
packet if the prepared statement wasn't found in the server (due to
reconnection). The commands COM_STMT_SEND_LONG_DATA and COM_STMT_CLOSE
should not send any packets, even error packets should not be sent since
they are not expected by the client API.
The solution is to clear generated during the execution of the aforementioned
commands and to skip resend of prepared statement commands. Another fix is
that if the connection breaks during the send of prepared statement command,
the command is not sent again since the prepared statement is no longer in the
server.
libmysql/libmysql.c:
The mysql handle might be reset after a reconnection.
Pass the now used stmt argument to cli_advanced_command.
sql-common/client.c:
Don't resend command if the connection broke and it's a prepared
statement command. If the session is broken, prepared statements
on the server are gone, set the error accordanly.
sql/sql_prepare.cc:
Clear any error set during the execution of the request
command.
tests/mysql_client_test.c:
Fix memory leak by freeing result associated with statement.
Remove test case for Bug 29948 because it's not reliable in
5.0 (fixed in 5.1) due to KILL queries sending two packets for
a thread that kills itself.
Disable test case for bug 29948, which is causing sporadically
failures in other tests inside mysql_client_test.
tests/mysql_client_test.c:
Disable test case.
into kaamos.(none):/data/src/opt/mysql-5.1-opt
client/mysql.cc:
Auto merged
client/mysqldump.c:
Auto merged
configure.in:
Auto merged
include/my_global.h:
Auto merged
libmysql/libmysql.c:
Auto merged
libmysqld/lib_sql.cc:
Auto merged
mysql-test/include/mix1.inc:
Auto merged
mysql-test/r/create.result:
Auto merged
mysql-test/r/func_str.result:
Auto merged
mysql-test/r/innodb.result:
Auto merged
mysql-test/r/innodb_mysql.result:
Auto merged
mysql-test/r/select.result:
Auto merged
mysql-test/r/subselect.result:
Auto merged
mysql-test/t/create.test:
Auto merged
mysql-test/t/disabled.def:
Auto merged
sql/filesort.cc:
Auto merged
sql/handler.cc:
Auto merged
sql/item.cc:
Auto merged
sql/item.h:
Auto merged
sql/item_cmpfunc.cc:
Auto merged
sql/item_func.cc:
Auto merged
sql/item_func.h:
Auto merged
sql/item_sum.cc:
Auto merged
sql/log.cc:
Auto merged
sql/mysql_priv.h:
Auto merged
sql/mysqld.cc:
Auto merged
sql/set_var.cc:
Auto merged
sql/sp.cc:
Auto merged
sql/sql_acl.cc:
Auto merged
sql/sql_base.cc:
Auto merged
sql/sql_insert.cc:
Auto merged
sql/sql_plugin.cc:
Auto merged
sql/sql_select.cc:
Auto merged
sql/sql_yacc.yy:
Auto merged
storage/ndb/src/kernel/blocks/backup/Backup.hpp:
Auto merged
tests/mysql_client_test.c:
Auto merged
mysql-test/r/func_time.result:
Manual merge.
mysql-test/r/view.result:
Manual merge.
mysql-test/t/view.test:
Manual merge.
scripts/mysql_config.sh:
Manual merge.
sql-common/client.c:
Manual merge.
sql/sql_parse.cc:
Manual merge.
into kaamos.(none):/data/src/opt/mysql-5.0-opt
client/mysql.cc:
Auto merged
sql/filesort.cc:
Auto merged
sql/item.cc:
Auto merged
sql/item.h:
Auto merged
sql/item_func.cc:
Auto merged
sql/mysqld.cc:
Auto merged
sql/sql_parse.cc:
Auto merged
sql/sql_yacc.yy:
Auto merged
tests/mysql_client_test.c:
Auto merged
mysql-test/r/view.result:
Manual merge.
mysql-test/t/view.test:
Manual merge.
scripts/mysql_config.sh:
Manual merge.
Disable test case for bug 29948, which is causing sporadically
failures in other tests inside mysql_client_test.
tests/mysql_client_test.c:
Disable test case.
sporadically
Under some circumstances, the mysql_insert_id() value after SELECT ...
INSERT could return a wrong value. This could happen when the last
SELECT ... INSERT did not involve an AUTO_INCREMENT column, but the
value of mysql_insert_id() was changed by some previous statements.
Fixed by checking the value of thd->insert_id_used in
select_insert::send_eof() and returning 0 for mysql_insert_id() if it
is not set.
sql/sql_insert.cc:
Do not return thd->last_insert_id unconditionally in
select_insert::send_eof(). First check if thd->insert_id_used is
non-zero, and return 0 otherwise.
tests/mysql_client_test.c:
Added a test case for bug #34889.
into quad.:/mnt/raid/alik/MySQL/devel/5.1-rt-merged
client/mysqltest.c:
Auto merged
mysql-test/r/view.result:
Auto merged
sql/ha_ndbcluster.cc:
Auto merged
sql/ha_ndbcluster_binlog.cc:
Auto merged
sql/handler.cc:
Auto merged
sql/log_event.cc:
Auto merged
sql/mysql_priv.h:
Auto merged
sql/mysqld.cc:
Auto merged
sql/set_var.cc:
Auto merged
sql/sql_class.cc:
Auto merged
sql/sql_connect.cc:
Auto merged
sql/sql_parse.cc:
Auto merged
tests/mysql_client_test.c:
Auto merged
mysql-test/suite/rpl_ndb/t/disabled.def:
Manually merged.
mysql-test/t/disabled.def:
Manually merged.
The problem is that the commands COM_STMT_CLOSE, COM_STMT_RESET,
COM_STMT_SEND_LONG_DATA weren't being logged to the general log.
The solution is to log the general log the aforementioned commands.
mysql-test/t/mysql_client_test-master.opt:
Also log to table.
sql/sql_prepare.cc:
Log COM_STMT_CLOSE, COM_STMT_RESET and COM_STMT_SEND_LONG_DATA.
tests/mysql_client_test.c:
Add test case for Bug#28386
--local-infile=0 checks can be bypassed by sending a FETCH LOCAL FILE response
Add a check for CLIENT_LOCAL_FILES before sending a local file.
Beware, that all binary distributions enable sending of local files and it's up
to the programs which use libmysql to disable it, if they don't use this functionality.
Otherwise they are not safe.
client/mysqltest.c:
Enable LOAD DATA LOCAL INFILE for the test suite, like some rpl and ndb test.
sql-common/client.c:
Check if the client has LOAD DATA LOCAL INFILE disabled and
don't serve such requests from the server. This is not 100% proof,
as if the client has this enabled, in all binary builds for BC,
the check won't work and the client can be tricked into sending a
local file.
tests/mysql_client_test.c:
Switch on LOCAL INFILE in client test. If one day there
is a test which uses it, then it will work out of the box.
mysql-test/r/view.result:
Drop created view.
mysql-test/t/view.test:
Update test result.
sql/sql_cursor.cc:
Fix compilation failure.
tests/mysql_client_test.c:
Manual merge.