into dl145h.mysql.com:/data0/mkindahl/mysql-5.0-rpl-merge
client/mysql.cc:
Auto merged
mysql-test/r/ctype_ucs.result:
Auto merged
mysql-test/t/ctype_uca.test:
Auto merged
mysql-test/t/ctype_ucs.test:
Auto merged
mysql-test/t/subselect.test:
Auto merged
sql/item_cmpfunc.cc:
Auto merged
sql/mysqld.cc:
Auto merged
sql/sql_class.h:
Auto merged
UNIQUE (eq-ref) lookups result in table being considered as a "constant" table.
Queries that consist of only constant tables are processed in do_select() in a
special way that doesn't invoke evaluate_join_record(), and therefore doesn't
increase the counters join->examined_rows and join->thd->row_count.
The patch increases these counters in this special case.
NOTICE:
This behavior seems to contradict what the documentation says in Sect. 5.11.4:
"Queries handled by the query cache are not added to the slow query log, nor
are queries that would not benefit from the presence of an index because the
table has zero rows or one row."
No test case in 5.0 as issue shows only in slow query log, and other counters
can give subtly different values (with regard to counting in create_sort_index(),
synthetic rows in ROLLUP, etc.).
sql/sql_class.h:
add documentation for some variables
sql/sql_select.cc:
Don't forget const tables when counting read records!
into mysql.com:/home/bar/mysql-work/mysql-5.0-rpl-merge
mysql-test/r/ctype_utf8.result:
Auto merged
mysql-test/r/func_regexp.result:
Auto merged
mysql-test/t/ctype_utf8.test:
Auto merged
mysql-test/t/func_regexp.test:
Auto merged
sql/item_cmpfunc.cc:
Auto merged
sql/item_cmpfunc.h:
Auto merged
sql/sql_class.h:
Auto merged
sql/sql_insert.cc:
Auto merged
sql/sql_parse.cc:
Auto merged
sql/sql_update.cc:
Auto merged
mysql-test/r/ctype_ucs.result:
After merge fix
mysql-test/t/ctype_ucs.test:
After merge fix
in the SELECT INTO OUTFILE clause starts with a special
character (one of n, t, r, b, 0, Z or N) and ENCLOSED BY
is empty, every occurrence of this character within a
field value is duplicated.
Duplication has been avoided.
New warning message has been added: "First character of
the FIELDS TERMINATED string is ambiguous; please use
non-optional and non-empty FIELDS ENCLOSED BY".
mysql-test/r/outfile_loaddata.result:
BitKeeper file /home/uchum/work/bk/5.0-opt-31663/mysql-test/r/outfile_loaddata.result
Added test case for bug #31663.
mysql-test/t/outfile_loaddata.test:
BitKeeper file /home/uchum/work/bk/5.0-opt-31663/mysql-test/t/outfile_loaddata.test
Added test case for bug #31663.
sql/sql_class.h:
Fixed bug #31663.
The select_export::is_ambiguous_field_term field has been added.
This field is true if select_export::field_sep_char contains
the first char of the FIELDS TERMINATED BY (ENCLOSED BY is empty),
and items can contain this character.
The select_export::field_term_char field has been added (first
char of the FIELDS TERMINATED BY string or INT_MAX).
sql/sql_class.cc:
Fixed bug #31663.
The select_export::prepare method has been modified to calculate
a value of the select_export::is_ambiguous_field_term field and
to warn if this value is true.
The select_export::send_data method has been modified to
avoid escaping or duplication of the field_set_char if
is_ambiguous_field_term is true.
sql/share/errmsg.txt:
Fixed bug #31663.
The ER_AMBIGUOUS_FIELD_TERM warning has been added.
similar to bug_27716, but it was stressed on in the synopsis on that there is another
side of the artifact affecting behaviour in transaction.
Fixed with deploying multi_delete::send_error() - otherwise never called - and refining its logic
to perform binlogging job if needed.
The changeset includes the following side effects:
- added tests to check bug_23333's scenarios on the mixture of tables for multi_update;
- fixes bug@30763 with two-liner patch and a test coinciding to one added for bug_23333.
mysql-test/r/innodb.result:
results changed
mysql-test/r/mix_innodb_myisam_binlog.result:
results changed
mysql-test/r/multi_update.result:
results changed
mysql-test/t/innodb.test:
trans table specific test added
mysql-test/t/mix_innodb_myisam_binlog.test:
multi-update and multi-delete of mixure of ta and not-ta tables tests added (relates to bug_23333).
mysql-test/t/multi_update.test:
testing another branch of mult-delete: send_eof() (binloggin there), send_error (early return)
sql/sql_class.h:
a new flag to designate the fact the statement's error has been handled.
The flag is checked by ::send_error() methods (multi_update and _delete classes)
sql/sql_delete.cc:
expanding multi_delete::send_error to
1. early return if error_handled == t
2. binlogging locally if there was a non-trans table modified side effect
sql/sql_parse.cc:
adding multi_update::send_error which can perform binlogging and rollback job in needed
sql/sql_update.cc:
issues relating to
1. bug_27716 with zeroing of `updated' to serve as the flag of early return from send_error().
The flag is changed to be a new member error_handled; also moved outside binlogging branch.
The reason for this change is that bug_23333 fixes were pushed after the bug_27716's and they
left this flaw (also no test coverage).
2. bug_30763 with assertion on trans_safe. I decide to make 2 liner fix for that bug here instead of to remove
those two assertions. This new bug test case is the same as for multi-update on the mixure of tables.
The rational for this fix:
presumption for mutli_update::trans_safe to be set to zero at
multi_update::multi_update or multi_update::initialize_tables() is incorrect.
trans_safe := false should happen only when a non-transactional table gets modified.
Therefore, at initialization the member must be be set to true.
Problem: one thread could read uninitialized memory from (the stack of) another
thread.
Fix: swapped order of initializing the memory and making it available to the
other thread.
Fix: put lock around the statement that makes the memory available to the other
thread.
Fix: all fields of the struct are now initialized in the constructor, to avoid
future problems.
sql/sql_class.h:
Initialize all members in constructor for more safe future code.
sql/sql_repl.cc:
Swap order so that linfo is first initialized, then assigned, instead of the
other way around.
Put a lock around the assignment. We use LOCK_thread_count since log_in_use
uses it: log_in_use may be running concurrently, called from
MYSQL_LOG::purge_logs.
led to creating corrupted index.
While execution of the CREATE .. SELECT SQL_BUFFER_RESULT statement the
engine->start_bulk_insert function was called twice. On the first call
On the first call MyISAM disabled all non-unique indexes and on the second
call it decides to not re-enable them because all indexes was disabled.
Due to this no indexes was actually created during CREATE TABLE thus
producing crashed table.
Now the select_inset class has is_bulk_insert_mode flag which prevents
calling the start_bulk_insert function twice.
The flag is set in the select_create::prepare, select_insert::prepare2
functions and the select_insert class constructor.
The flag is reset in the select_insert::send_eof function.
mysql-test/t/insert_select.test:
A test case is added for the bug#30384: Having SQL_BUFFER_RESULT option in the
CREATE .. KEY(..) .. SELECT led to creating corrupted index.
mysql-test/r/insert_select.result:
A test case is added for the bug#30384: Having SQL_BUFFER_RESULT option in the
CREATE .. KEY(..) .. SELECT led to creating corrupted index.
sql/sql_class.h:
Bug#30384: Having SQL_BUFFER_RESULT option in the CREATE .. KEY(..) .. SELECT
led to creating corrupted index.
The is_bulk_insert_mode flag is added to the select_insert class.
sql/sql_insert.cc:
Bug#30384: Having SQL_BUFFER_RESULT option in the CREATE .. KEY(..) .. SELECT
led to creating corrupted index.
The is_bulk_insert_mode is set in the select_create::prepare, select_insert::prepare2
functions and the select_insert class constructor.
The flag is reset in the select_insert::send_eof function.
into ramayana.hindu.god:/home/tsmith/m/bk/maint/50
sql/handler.h:
Auto merged
sql/sql_base.cc:
Auto merged
sql/sql_class.cc:
Auto merged
sql/sql_class.h:
Auto merged
sql/sql_table.cc:
Auto merged
sql/sql_yacc.yy:
Auto merged
sql/table.cc:
Auto merged
into ramayana.hindu.god:/home/tsmith/m/bk/maint/50
mysql-test/r/federated.result:
Auto merged
mysql-test/t/federated.test:
Auto merged
sql/ha_federated.h:
Auto merged
sql/item_func.cc:
Auto merged
sql/sql_class.h:
Auto merged
sql/sql_table.cc:
Auto merged
mysql-test/r/innodb_mysql.result:
Manual merge
mysql-test/t/innodb_mysql.test:
Manual merge
restores from mysqlbinlog out
Problem: using "mysqlbinlog | mysql" for recoveries the connection_id()
result may differ from what was used when issuing the statement.
Fix: if there is a connection_id() in a statement, write to binlog
SET pseudo_thread_id= XXX; before it and use the value later on.
mysql-test/r/mysqlbinlog.result:
Fix for bug #29928: INSERT ... VALUES(connection_id(), ...) incorrect
restores from mysqlbinlog out
- test result.
mysql-test/t/mysqlbinlog.test:
Fix for bug #29928: INSERT ... VALUES(connection_id(), ...) incorrect
restores from mysqlbinlog out
- test case.
sql/item_create.cc:
Fix for bug #29928: INSERT ... VALUES(connection_id(), ...) incorrect
restores from mysqlbinlog out
- set thread_specific_used flag for the connection_id() function.
sql/item_func.cc:
Fix for bug #29928: INSERT ... VALUES(connection_id(), ...) incorrect
restores from mysqlbinlog out
- always return thd->variables.pseudo_thread_id as a connection_id()
result, as it contains a proper value for both master and slave.
sql/log_event.cc:
Fix for bug #29928: INSERT ... VALUES(connection_id(), ...) incorrect
restores from mysqlbinlog out
- set LOG_EVENT_THREAD_SPECIFIC_F event flag if thread_specific_used
is set.
sql/sql_class.cc:
Fix for bug #29928: INSERT ... VALUES(connection_id(), ...) incorrect
restores from mysqlbinlog out
- thd->thread_specific_used introduced, which is set if thread specific
value(s) used in a statement.
sql/sql_class.h:
Fix for bug #29928: INSERT ... VALUES(connection_id(), ...) incorrect
restores from mysqlbinlog out
- thd->thread_specific_used introduced, which is set if thread specific
value(s) used in a statement.
into magare.gmz:/home/kgeorge/mysql/autopush/B27417-5.0-opt
sql/handler.cc:
Auto merged
sql/sp_head.cc:
Auto merged
sql/sql_class.cc:
Auto merged
sql/sql_class.h:
Auto merged
Bug #27417 thd->no_trans_update.stmt lost value inside of SF-exec-stack
Once had been set the flag might later got reset inside of a stored routine
execution stack.
The reason was in that there was no check if a new statement started at time
of resetting.
The artifact affects most of binlogable DML queries. Notice, that multi-update
is wrapped up within
bug@27716 fix, multi-delete bug@29136.
Fixed with saving parent's statement flag of whether the statement modified
non-transactional table, and unioning (merging) the value with that was gained
in mysql_execute_command.
Resettling thd->no_trans_update members into thd->transaction.`member`;
Asserting code;
Effectively the following properties are held.
1. At the end of a substatement thd->transaction.stmt.modified_non_trans_table
reflects the fact if such a table got modified by the substatement.
That also respects THD::really_abort_on_warnin() requirements.
2. Eventually thd->transaction.stmt.modified_non_trans_table will be computed as
the union of the values of all invoked sub-statements.
That fixes this bug#27417;
Computing of thd->transaction.all.modified_non_trans_table is refined to base to
the stmt's value for all the case including insert .. select statement which
before the patch had an extra issue bug@28960.
Minor issues are covered with mysql_load, mysql_delete, and binloggin of insert in
to temp_table select.
The supplied test verifies limitely, mostly asserts. The ultimate testing is defered
for bug@13270, bug@23333.
mysql-test/r/mix_innodb_myisam_binlog.result:
results changed
mysql-test/t/mix_innodb_myisam_binlog.test:
regression test incl the related bug#28960.
sql/ha_ndbcluster.cc:
thd->transaction.{all,stmt}.modified_non_trans_table
instead of
thd->no_trans_update.{all,stmt}
sql/handler.cc:
thd->transaction.{all,stmt}.modified_non_trans_table
instead of
thd->no_trans_update.{all,stmt}
sql/handler.h:
new member added
sql/log.cc:
thd->transaction.{all,stmt}.modified_non_trans_table
instead of
thd->no_trans_update.{all,stmt}
sql/set_var.cc:
thd->transaction.{all,stmt}.modified_non_trans_table
instead of
thd->no_trans_update.{all,stmt}
sql/sp_head.cc:
thd->transaction.{all,stmt}.modified_non_trans_table
instead of
thd->no_trans_update.{all,stmt}
and saving and merging stmt's flag at the end of a substatement.
sql/sql_class.cc:
thd->transaction.{all,stmt}.modified_non_trans_table
instead of
thd->no_trans_update.{all,stmt}
sql/sql_class.h:
thd->transaction.{all,stmt}.modified_non_trans_table
instead of
thd->no_trans_update.{all,stmt}
sql/sql_delete.cc:
correcting basic delete incl truncate branch and multi-delete queries to set
stmt.modified_non_trans_table;
optimization to set the flag at the end of per-row loop;
multi-delete still has an extra issue similar to bug#27716 of multi-update
- to be address with bug_29136 fix.
sql/sql_insert.cc:
thd->transaction.{all,stmt}.modified_non_trans_table
instead of
thd->no_trans_update.{all,stmt}
sql/sql_load.cc:
eliminating a separate issue where the stmt flag was saved and re-stored after
write_record that actually could change it and the change would be lost but
should remain permanent;
thd->transaction.{all,stmt}.modified_non_trans_table
instead of
thd->no_trans_update.{all,stmt}
sql/sql_parse.cc:
initialization to transaction.stmt.modified_non_trans_table at the common part
of all types of statements processing - mysql_execute_command().
sql/sql_table.cc:
moving the reset up to the mysql_execute_command() caller
sql/sql_update.cc:
correcting update query case (multi-update part of the issues covered by other
bug#27716 fix)
thd->transaction.{all,stmt}.modified_non_trans_table
instead of
thd->no_trans_update.{all,stmt}
into moonbone.local:/mnt/gentoo64/work/24989-bug-5.0-opt-mysql
sql/ha_innodb.cc:
Auto merged
sql/handler.cc:
Auto merged
sql/sql_class.cc:
Auto merged
sql/sql_class.h:
Auto merged
When innodb detects a deadlock it calls ha_rollback_trans() to rollback the
main transaction. But such action isn't allowed from inside of triggers and
functions. When it happen the 'Explicit or implicit commit' error is thrown
even if there is no commit/rollback statements in the trigger/function. This
leads to the user confusion.
Now the convert_error_code_to_mysql() function doesn't call the
ha_rollback_trans() function directly but rather calls the
mark_transaction_to_rollback function and returns an error.
The sp_rcontext::find_handler() now doesn't allow errors to be caught by the
trigger/function error handlers when the thd->is_fatal_sub_stmt_error flag
is set. Procedures are still allowed to catch such errors.
The sp_rcontext::find_handler function now accepts a THD handle as a parameter.
The transaction_rollback_request and the is_fatal_sub_stmt_error flags are
added to the THD class. The are initialized by the THD class constructor.
Now the ha_autocommit_or_rollback function rolls back main transaction
when not in a sub statement and the thd->transaction_rollback_request
is set.
The THD::restore_sub_statement_state function now resets the
thd->is_fatal_sub_stmt_error flag on exit from a sub-statement.
sql/ha_innodb.cc:
Bug#24989: The DEADLOCK error is improperly handled by InnoDB.
Now the convert_error_code_to_mysql() function doesn't call the
ha_rollback_trans() function directly but rather calls the
mark_transaction_to_rollback function and returns an error.
sql/handler.cc:
Bug#24989: The DEADLOCK error is improperly handled by InnoDB.
Now the ha_autocommit_or_rollback function rolls back main transaction
when not in a sub statement and the thd->transaction_rollback_request
is set.
mysql-test/r/innodb-big.result:
Added a test case for the bug#24989: The DEADLOCK error is improperly handled by
InnoDB.
mysql-test/t/innodb-big.test:
Added a test case for the bug#24989: The DEADLOCK error is improperly handled by
InnoDB.
sql/sql_class.h:
Bug#24989: The DEADLOCK error is improperly handled by InnoDB.
The transaction_rollback_request and the is_fatal_sub_stmt_error flags are
added to the THD class.
sql/sql_class.cc:
Bug#24989: The DEADLOCK error is improperly handled by InnoDB.
Initialization of the transaction_rollback_request and the
is_fatal_sub_stmt_error flags are added to the THD class constructor.
The mark_transaction_to_rollback function is added.
The THD::restore_sub_statement_state function now resets the
thd->is_fatal_sub_stmt_error flag on exit from a sub-statement.
sql/sp_rcontext.h:
Bug#24989: The DEADLOCK error is improperly handled by InnoDB.
The sp_rcontext::find_handler function now accepts a THD handle as a parameter.
The in_sub_stmt flag is added to the sp_rcontext class.
sql/sp_rcontext.cc:
Bug#24989: The DEADLOCK error is improperly handled by InnoDB.
The sp_rcontext::find_handler() now doesn't allow errors to be caught by the
trigger/function error handlers when the thd->is_fatal_sub_stmt_error flag
is set. Instead it tries to find a most inner procedure that isn't called
directly or indirectly from any function/trigger.
Procedures are still allowed to catch such errors.
The sp_rcontext::find_handler function now accepts a THD handle as a parameter.
between perm and temp tables. Review fixes.
The original bug report complains that if we locked a temporary table
with LOCK TABLES statement, we would not leave LOCK TABLES mode
when this temporary table is dropped.
Additionally, the bug was escalated when it was discovered than
when a temporary transactional table that was previously
locked with LOCK TABLES statement was dropped, futher actions with
this table, such as UNLOCK TABLES, would lead to a crash.
The problem originates from incomplete support of transactional temporary
tables. When we added calls to handler::store_lock()/handler::external_lock()
to operations that work with such tables, we only covered the normal
server code flow and did not cover LOCK TABLES mode.
In LOCK TABLES mode, ::external_lock(LOCK) would sometimes be called without
matching ::external_lock(UNLOCK), e.g. when a transactional temporary table
was dropped. Additionally, this table would be left in the list of LOCKed
TABLES.
The patch aims to address this inadequacy. Now, whenever an instance
of 'handler' is destroyed, we assert that it was priorly
external_lock(UNLOCK)-ed. All the places that violate this assert
were fixed.
This patch introduces no changes in behavior -- the discrepancy in
behavior will be fixed when we start calling ::store_lock()/::external_lock()
for all tables, regardless whether they are transactional or not,
temporary or not.
mysql-test/r/innodb_mysql.result:
Update test results (Bug#24918)
mysql-test/t/innodb_mysql.test:
Add a test case for Bug#24918
sql/handler.h:
Make handler::external_lock() a protected method. Backport from 5.1 its
public wrapper handler::ha_external_lock().
Assert that the handler is not closed if it is still locked.
sql/lock.cc:
In mysql_lock_tables only call lock_external() for the list of tables that
we called store_lock() for.
E.g. get_lock_data() does not add non-transactional temporary tables to the
lock list, so lock_external() should not be called for them.
Use handler::ha_external_lock() instead of handler::external_lock().
Add comments for mysql_lock_remove(), parameterize one strange
side effect that it has. At least in one place where mysql_lock_remove
is used, this side effect is not desired (DROP TABLE). The parameter
will be dropped in 5.1, along with the side effect.
sql/mysql_priv.h:
Update declaration of mysql_lock_remove().
sql/opt_range.cc:
Deploy handler::ha_external_lock() instead of handler::external_lock()
sql/sql_base.cc:
When closing a temporary table, remove the table from the list of LOCKed
TABLES of this thread, in case it's there.
It's there if it is a transactional temporary table.
Use a new declaration of mysql_lock_remove().
sql/sql_class.h:
Extend the comment for THD::temporary_tables.
sql/sql_table.cc:
Deploy handler::ha_external_lock() instead of handler::external_lock()
into bodhi.(none):/opt/local/work/mysql-5.0-runtime
mysql-test/r/create.result:
Auto merged
mysql-test/t/create.test:
Auto merged
sql/sql_class.h:
Auto merged
Fix the typo in the constructor. Cover a semantic check that previously
never worked with a test.
mysql-test/r/create.result:
Update results (Bug#26104)
mysql-test/r/innodb.result:
Update results.
mysql-test/t/create.test:
Add a test case for Bug#26104 Bug on foreign key class constructor
mysql-test/t/innodb.test:
Return a new error number (MySQL error instead of internal InnoDB error).
sql/sql_class.h:
A fix for Bug#26104 Bug on foreign key class constructor -- fix
the typo in the constructor
into sin.intern.azundris.com:/home/tnurnberg/27198/41-27198
sql/mysql_priv.h:
Bug #27198: Error returns from time() are ignored
manual merge
sql/sql_class.h:
Bug #27198: Error returns from time() are ignored
manual merge
gettimeofday() can fail and presumably, so can time().
Keep an eye on it.
Since we have no data on this at all so far, we just
retry on failure (and log the event), assuming that
this is just an intermittant failure. This might of
course hang the threat until we succeed. Once we know
more about these failures, an appropriate more clever
scheme may be picked (only try so many times per thread,
etc., if that fails, return last "good" time() we got or
some such). Using sql_print_information() to log as this
probably only occurs in high load scenarios where the debug-
trace likely is disabled (or might interfere with testing
the effect). No test-case as this is a non-deterministic
issue.
sql/mysql_priv.h:
Bug#27198: Error returns from time() are ignored
move declarations for log.cc to before inclusion of
sql_class.h as we now use sql_print_information() in
there.
sql/sql_class.h:
Bug#27198: Error returns from time() are ignored
gettimeofday() can fail and presumably, so can time().
Keep an eye on it.
By default MyISAM overwrites .MYD and .MYI files no
DATA DIRECTORY option is used. This can lead to two tables
using the same .MYD and .MYI files (that can't be dropped).
To prevent CREATE TABLE from overwriting a file a new option
is introduced : keep_files_on_create
When this is on the CREATE TABLE throws an error if either
the .MYD or .MYI exists for a MyISAM table.
The option is off by default (resulting in compatible behavior).
include/my_base.h:
Bug #29325: introduce keep_files_on_create
myisam/mi_create.c:
Bug #29325: introduce keep_files_on_create
mysql-test/r/create.result:
Bug #29325: test case
mysql-test/t/create.test:
Bug #29325: test case
sql/ha_myisam.cc:
Bug #29325: introduce keep_files_on_create
sql/set_var.cc:
Bug #29325: introduce keep_files_on_create
sql/sql_class.h:
Bug #29325: introduce keep_files_on_create
sql/sql_table.cc:
Bug #29325: introduce keep_files_on_create
sql/unireg.cc:
Bug #29325: introduce keep_files_on_create
The SELECT INTO OUTFILE FIELDS ENCLOSED BY digit or minus sign,
followed by the same LOAD DATA INFILE statement, used wrond encoding
of non-string fields contained the enclosed character in their text
representation.
Example:
SELECT 15, 9 INTO OUTFILE 'text' FIELDS ENCLOSED BY '5';
Old encoded result in the text file:
5155 595
^ was decoded as the 1st enclosing character of the 2nd field;
^ was skipped as garbage;
^ ^ was decoded as a pair of englosing characters of the 1st field;
^ was decoded as traling space of the first field;
^^ was decoded as a doubled enclosed character.
New encoded result in the text file:
51\55 595
^ ^ pair of enclosing characters of the 1st field;
^^ escaped enclosed character.
sql/sql_class.h:
Fixed bug #29442.
The NUMERIC_CHARS macro constant has been defined to enumerate
all possible characters of a numeric value text representation.
The select_export::is_unsafe_field_sep boolean flag has been added
to apply the encoding algorithm to non-string values when it is
necessary.
sql/sql_class.cc:
Fixed bug #29442.
The select_export::send_data method has been modified to encode text
representation of fields of all data types like string fields.
mysql-test/t/loaddata.test:
Updated test case for bug #29442.
mysql-test/r/loaddata.result:
Updated test case for bug #29442.
into gleb.loc:/home/uchum/work/bk/5.0-opt
sql/sql_class.cc:
Auto merged
sql/sql_class.h:
Auto merged
sql/sql_load.cc:
Auto merged
mysql-test/r/loaddata.result:
Merge with 4.1-opt.
mysql-test/t/loaddata.test:
Merge with 4.1-opt.
The `SELECT 'r' INTO OUTFILE ... FIELDS ENCLOSED BY 'r' ' statement
encoded the 'r' string to a 4 byte string of value x'725c7272'
(sequence of 4 characters: r\rr).
The LOAD DATA statement decoded this string to a 1 byte string of
value x'0d' (ASCII Carriage Return character) instead of the original
'r' character.
The same error also happened with the FIELDS ENCLOSED BY clause
followed by special characters: 'n', 't', 'r', 'b', '0', 'Z' and 'N'.
NOTE 1: This is a result of the undocumented feature: the LOAD DATA INFILE
recognises 2-byte input sequences like \n, \t, \r and \Z in addition
to documented 2-byte sequences: \0 and \N. This feature should be
documented (here backspace character is a default ESCAPED BY character,
in the real-life example it may be any ESCAPED BY character).
NOTE 2, changed behaviour:
Now the `SELECT INTO OUTFILE' statement with the `FIELDS ENCLOSED BY'
clause followed by one of: 'n', 't', 'r', 'b', '0', 'Z' or 'N' characters
encodes this special character itself by doubling it ('r' --> 'rr'),
not by prepending it with an escape character.
sql/sql_class.h:
Fixed bug #29294.
The ESCAPE_CHARS macro constant is defined to enumerate
symbolic names of espace-sequences like '\n', '\t' etc.
The select_export::is_ambiguous_field_sep field has been added
to distinguish special values of the field_sep field from
another values (see ESCAPE_CHARS).
sql/sql_class.cc:
Fixed bug #29294.
The select_export::send_data method has been modified to
encode special values of the field_sep field by
doubling of those values instead of prepending them with a
value of the escape_char field.
Example: The SELECT 'r' INTO OUTFILE FIELDS ENCLOSED BY 'r'
now produces the 'rr' output string instead of x'5c72'
(i.e. instead of sequence of 2 bytes: \ and r).
sql/sql_load.cc:
Fixed bug #29294.
Added commentary for the READ_INFO::unescape method.
mysql-test/t/loaddata.test:
Updated test case for bug #29294.
mysql-test/r/loaddata.result:
Updated test case for bug #29294.
into adventure.(none):/home/thek/Development/cpp/mysql-5.0-runtime
sql/sql_class.h:
Auto merged
sql/sql_parse.cc:
Auto merged
sql/sql_prepare.cc:
Auto merged
sql/sql_view.cc:
Auto merged
sql/sql_yacc.yy:
Auto merged
ALTER VIEW is currently not supported as a prepared statement
and should be disabled as such as they otherwise could cause server crashes.
ALTER VIEW is currently not supported when called from stored
procedures or functions for related reasons and should also be disabled.
This patch disables these DDL statements and adjusts the appropriate test
cases accordingly.
Additional tests has been added to reflect on the fact that we do support
CREATE/ALTER/DROP TABLE for Prepared Statements (PS), Stored Procedures (SP)
and PS within SP.
mysql-test/r/ps_1general.result:
- Updated test to reflect on the new policy to disallow ALTER VIEW within SP.
mysql-test/r/sp-dynamic.result:
- Added PS ALTER TABLE test from within SP-context to demonstrate that CREATE/ALTER/DROP
TABLE statements is working.
- Added PS CREATE/ALTER/DROP VIEW tests from within SP-context to show that
ALTER VIEW is not supported, CREATE VIEW/DROP VIEW are supported.
mysql-test/r/sp-error.result:
- Updated test to reflect on the new policy to disallow VIEW DDL within SP.
mysql-test/t/ps_1general.test:
- Updated test to reflect on the new policy to disallow VIEW DDL within SP.
mysql-test/t/sp-dynamic.test:
- Add PS ALTER TABLE test from within SP to demonstrate that CREATE/ALTER/DROP
TABLE statements are supported.
mysql-test/t/sp-error.test:
- Updated test to reflect on the new policy to disallow ALTER VIEW
within SP-context.
- Changed error code 1314 to the more abstract ER_SP_BADSTATEMENT.
sql/sql_class.h:
- Added comment for clarity
sql/sql_parse.cc:
- Added comment for clarity
sql/sql_prepare.cc:
- Disallow ALTER VIEW as prepared statements until they are
properly supported. Note that SQLCOM_CREATE_VIEW also handles ALTER VIEW
statements.
sql/sql_view.cc:
- converted to doxygen comments
- Added comment for clarity
sql/sql_yacc.yy:
- Disallow ALTER VIEW statements within a SP.
If the parser is operating within the SP context, this is shown
on the sp->sphead pointer. If this flag is set for view DDL operations
we stop parsing with the error 'ER_SP_BAD_STATEMENT'.
The method select_insert::send_error does two things, it rolls back a statement
being executed and outputs an error message. But when a
nonexistent column is referenced, an error message has been published already and
there is no need to publish another.
Fixed by moving all functionality beyond publishing an error message into
select_insert::abort() and calling only that function.
mysql-test/r/errors.result:
Bug#28677: test result
mysql-test/t/errors.test:
Bug#28677: test case
sql/sql_class.h:
Bug#28677: overriding abort()
sql/sql_insert.cc:
Bug#28677:
- moved everything beyond producing an error message out of select_insert::send_error
and into new override select_insert::abort()
- made corresponding move of code from select_create::send_error to select_create::abort
sql/sql_select.cc:
Bug#28677: No need to pusblish an error here
changed bytes_received, bytes_sent status variables to longlong
sql/mysqld.cc:
changed bytes_received, bytes_sent status variables to longlong
sql/sql_class.h:
changed bytes_received, bytes_sent status variables to longlong
sql/sql_show.cc:
changed bytes_received, bytes_sent status variables to longlong
sql/structs.h:
changed bytes_received, bytes_sent status variables to longlong
into bk-internal.mysql.com:/data0/bk/mysql-5.0-opt
mysql-test/r/sp.result:
Auto merged
mysql-test/t/sp.test:
Auto merged
mysql-test/t/strict.test:
Auto merged
mysql-test/t/subselect3.test:
Auto merged
sql/mysqld.cc:
Auto merged
sql/sp_head.cc:
Auto merged
sql/sql_base.cc:
Auto merged
sql/sql_class.h:
Auto merged
sql/sql_table.cc:
Auto merged
sql/sql_update.cc:
Auto merged
sql/sql_view.cc:
Manual merge
The result of the CHECK OPTION condition evaluation over an
updated record and records of merged tables was arbitrary and
dependant on the order of records in the merged tables during
the execution of SELECT statement.
The CHECK OPTION expression was evaluated over expired record
buffers (with arbitrary data in the fields).
Rowids of tables used in the CHECK OPTION expression were
added to temporary table rows. The multi_update::do_updates()
method was modified to restore necessary record buffers
before evaluation of the CHECK OPTION condition.
sql/sql_class.h:
Fixed bug #29716.
The multi_update::unupdatable_check_opt_tables variable
has been added.
sql/sql_update.cc:
Fixed bug #29716.
Rowids of tables used in the CHECK OPTION expression were
added to temporary table rows. The multi_update::do_updates()
method was modified to restore necessary record buffers
before evaluation of the CHECK OPTION condition.
mysql-test/t/view.test:
Updated test case for bug #28716.
mysql-test/r/view.result:
Updated test case for bug #28716.
The reason for the bug was that replaying of a query on slave could not be possible since its event
was recorded with the killed error. Due to the specific of handling INSERT, which per-row-while-loop is
unbreakable to killing, the query on transactional table should have not appeared in binlog unless
there was a call to a stored routine that got interrupted with killing (and then there must be an error
returned out of the loop).
The offered solution added the following rule for binlogging of INSERT that accounts the above
specifics:
For INSERT on transactional-table if the error was not set the only raised flag
is harmless and is ignored via masking out on time of creation of binlog event.
For both table types the combination of raised error and KILLED flag indicates that there
was potentially partial execution on master and consistency is under the question.
In that case the code continues to binlog an event with an appropriate killed error.
The fix relies on the specified behaviour of stored routine that must propagate the error
to the top level query handling if the thd->killed flag was raised in the routine execution.
The patch adds an arg with the default killed-status-unset value to Query_log_event::Query_log_event.
sql/log_event.cc:
killed_status as the value of thd->killed can be passed as an arg to the constructor.
if the value is different from the default the arg is set to the current thd->killed value.
A caller might need to masquerade thd->killed with THD::NOT_KILLED.
So far only mysql_insert() uses such explicit way to tell the constructor about killing status.
sql/log_event.h:
default arg to the constructor with meaning of killed status of the query.
if the arg is not explicitly provided the status of thd->killed will be snapshot
inside of the constuctor, which is potentially incorrect (see bug#27571)
sql/sql_class.h:
extending killed_state with no-state member.
sql/sql_insert.cc:
ignore the KILLED flag incl KILL_BAD_DATA when the INSERT query event
is created without an `error';
sql/sql_update.cc:
Suggestion how to fix bug#27571 as comments.
mysql-test/r/binlog_killed.result:
new result file
mysql-test/t/binlog_killed.test:
regression tests also apply for bug27563, BUG#27565
into siva.hindu.god:/home/tsmith/m/bk/maint/50
mysql-test/r/type_datetime.result:
Auto merged
mysql-test/t/outfile.test:
Auto merged
mysql-test/t/type_datetime.test:
Auto merged
sql/field.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/my_decimal.h:
Auto merged
sql/mysql_priv.h:
Auto merged
sql/sp.cc:
Auto merged
sql/sql_base.cc:
Auto merged
sql/sql_class.h:
Auto merged
Made year 2000 handling more uniform
Removed year 2000 handling out from calc_days()
The above removes some bugs in date/datetimes with year between 0 and 200
Now we get a note when we insert a datetime value into a date column
For default values to CREATE, don't give errors for warning level NOTE
Fixed some compiler failures
Added library ws2_32 for windows compilation (needed if we want to compile with IOCP support)
Removed duplicate typedef TIME and replaced it with MYSQL_TIME
Better (more complete) fix for: Bug#21103 "DATE column not compared as DATE"
Fixed properly Bug#18997 "DATE_ADD and DATE_SUB perform year2K autoconversion magic on 4-digit year value"
Fixed Bug#23093 "Implicit conversion of 9912101 to date does not match cast(9912101 as date)"
include/my_time.h:
Removed not used define YY_MAGIC_BELOW
Added prototype for year_2000_handling()
mysql-test/r/date_formats.result:
Updated results (fixed bug in date_format() with year < 99
mysql-test/r/func_sapdb.result:
Added more testing of make_date()
mysql-test/r/ps_2myisam.result:
Now we get a note when we insert a datetime value into a date column
mysql-test/r/ps_3innodb.result:
Now we get a note when we insert a datetime value into a date column
mysql-test/r/ps_4heap.result:
Now we get a note when we insert a datetime value into a date column
mysql-test/r/ps_5merge.result:
Now we get a note when we insert a datetime value into a date column
mysql-test/r/ps_7ndb.result:
Now we get a note when we insert a datetime value into a date column
mysql-test/r/strict.result:
zero-year in str_to_date() throws warning in strict
mysql-test/r/type_date.result:
Added test for date conversions
mysql-test/r/type_datetime.result:
Added testcase for datetime to date conversion.
mysql-test/t/date_formats.test:
Added testing of dates < 200
mysql-test/t/func_sapdb.test:
More testing of makedate()
mysql-test/t/type_date.test:
Added test for date conversions
mysql-test/t/type_datetime.test:
Added testcase for datetime to date conversion
sql/field.cc:
Give note if we insert a datetime value in a date field
Don't give notes if we are doing internal test conversions (like from convert_constant_item())
More documentation (store functions can now return '3' to inform that the function did return a NOTE (not warning or error))
Revert some changes in Field_newdate::store() to get more optimal code
Field::set_warning() will now ignore notes if CHECK_FIELD_IGNORE is set.
New parameters to make_truncated_value_warning()
sql/field.h:
Give note if we insert a datetime value in a date field
Don't give notes if we are doing internal test conversions (like from convert_constant_item())
More documentation (store functions can now return '3' to inform that the function did return a NOTE (not warning or error))
Revert some changes in Field_newdate::store() to get more optimal code
Field::set_warning() will now ignore notes if CHECK_FIELD_IGNORE is set.
New parameters to make_truncated_value_warning()
sql/item.cc:
Give note if we insert a datetime value in a date field
Don't give notes if we are doing internal test conversions (like from convert_constant_item())
More documentation (store functions can now return '3' to inform that the function did return a NOTE (not warning or error))
Revert some changes in Field_newdate::store() to get more optimal code
Field::set_warning() will now ignore notes if CHECK_FIELD_IGNORE is set.
New parameters to make_truncated_value_warning()
sql/item.h:
TIME -> MYSQL_TIME
sql/item_cmpfunc.cc:
Don't print notes in convert_constant_item()
sql/item_func.h:
TIME -> MYSQL_TIME
sql/item_timefunc.cc:
New parameters to make_truncated_value_warning()
Moved year 2000 handling out from calc_days()
sql/item_timefunc.h:
TIME -> MYSQL_TIME
sql/my_decimal.cc:
TIME -> MYSQL_TIME
sql/my_decimal.h:
TIME -> MYSQL_TIME
sql/mysql_priv.h:
Added error level to make_truncated_value_warning()
sql/protocol.cc:
TIME -> MYSQL_TIME
sql/protocol.h:
TIME -> MYSQL_TIME
sql/sp.cc:
TIME -> MYSQL_TIME
sql/sql_base.cc:
Make testing of result value of save_in_field() uniform
sql/sql_class.h:
TIME -> MYSQL_TIME
sql/sql_show.cc:
TIME -> MYSQL_TIME
sql/structs.h:
TIME -> MYSQL_TIME
sql/time.cc:
Added error level to make_truncated_value_warning()
sql/tztime.cc:
TIME -> MYSQL_TIME
sql/tztime.h:
TIME -> MYSQL_TIME
sql/unireg.cc:
For default values to CREATE, don't give errors for warning level NOTE
(Fixed failed CREATE when we give a datetime value to a date field)
sql-common/my_time.c:
Added year_2000_handling()
Removed year 2000 handling from calc_daynr()
into vajra.(none):/opt/local/work/mysql-5.0-runtime
sql/item.cc:
Auto merged
sql/item_func.cc:
Auto merged
sql/mysql_priv.h:
Auto merged
sql/set_var.cc:
Auto merged
sql/sql_class.h:
Auto merged
sql/sql_insert.cc:
Auto merged
sql/sql_parse.cc:
Auto merged
sql/sql_prepare.cc:
Auto merged
sql/sql_yacc.yy:
Auto merged
This bug affects multi-row INSERT ... ON DUPLICATE into table
with PRIMARY KEY of AUTO_INCREMENT field and some additional UNIQUE indices.
If the first row in multi-row INSERT contains duplicated values of UNIQUE
indices, then following rows of multi-row INSERT (with either duplicated or
unique key field values) may me applied to _arbitrary_ records of table as
updates.
This bug was introduced in 5.0. Related code was widely rewritten in 5.1, and
5.1 is already free of this problem. 4.1 was not affected too.
When updating the row during INSERT ON DUPLICATE KEY UPDATE, we called
restore_auto_increment(), which set next_insert_id back to 0, but we
forgot to set clear_next_insert_id back to 0.
restore_auto_increment() function has been fixed.
sql/sql_class.h:
Fixed bug #27954.
Added commentary for THD::clear_next_insert_id variable.
sql/handler.cc:
Fixed bug #27954.
When updating the row during INSERT ON DUPLICATE KEY UPDATE, we called
restore_auto_increment(), which set next_insert_id back to 0, but we
forgot to set clear_next_insert_id back to 0.
restore_auto_increment() function has been fixed.
mysql-test/t/insert_update.test:
Added test case for bug #27954.
mysql-test/r/insert_update.result:
Added test case for bug #27954.
into weblab.(none):/home/marcsql/TREE/mysql-5.0-25411_d
sql/item_func.cc:
Auto merged
sql/log_event.cc:
Auto merged
sql/mysql_priv.h:
Auto merged
sql/slave.cc:
Auto merged
sql/sp.cc:
Auto merged
sql/sp_head.cc:
Auto merged
sql/sql_class.cc:
Auto merged
sql/sql_class.h:
Auto merged
sql/sql_lex.cc:
Auto merged
sql/sql_lex.h:
Auto merged
sql/sql_parse.cc:
Auto merged
sql/sql_prepare.cc:
Auto merged
sql/sql_view.cc:
Auto merged
The issue found with bug 25411 is due to the function skip_rear_comments()
which damages the source code while implementing a work around.
The root cause of the problem is in the lexical analyser, which does not
process special comments properly.
For special comments like :
[1] aaa /*!50000 bbb */ ccc
since 5.0 is a version older that the current code, the parser is in lining
the content of the special comment, so that the query to process is
[2] aaa bbb ccc
However, the text of the query captured when processing a stored procedure,
stored function or trigger (or event in 5.1), can be after rebuilding it:
[3] aaa bbb */ ccc
which is wrong.
To fix bug 25411 properly, the lexical analyser needs to return [2] when
in lining special comments.
In order to implement this, some preliminary cleanup is required in the code,
which is implemented by this patch.
Before this change, the structure named LEX (or st_lex) contains attributes
that belong to lexical analysis, as well as attributes that represents the
abstract syntax tree (AST) of a statement.
Creating a new LEX structure for each statements (which makes sense for the
AST part) also re-initialized the lexical analysis phase each time, which
is conceptually wrong.
With this patch, the previous st_lex structure has been split in two:
- st_lex represents the Abstract Syntax Tree for a statement. The name "lex"
has not been changed to avoid a bigger impact in the code base.
- class lex_input_stream represents the internal state of the lexical
analyser, which by definition should *not* be reinitialized when parsing
multiple statements from the same input stream.
This change is a pre-requisite for bug 25411, since the implementation of
lex_input_stream will later improve to deal properly with special comments,
and this processing can not be done with the current implementation of
sp_head::reset_lex and sp_head::restore_lex, which interfere with the lexer.
This change set alone does not fix bug 25411.
sql/item_func.cc:
Refactoring, separate lex_input_stream from st_lex.
sql/log_event.cc:
Refactoring, separate lex_input_stream from st_lex.
sql/mysql_priv.h:
Refactoring, separate lex_input_stream from st_lex.
sql/slave.cc:
Refactoring, separate lex_input_stream from st_lex.
sql/sp.cc:
Refactoring, separate lex_input_stream from st_lex.
sql/sp_head.cc:
Refactoring, separate lex_input_stream from st_lex.
sql/sp_head.h:
Refactoring, separate lex_input_stream from st_lex.
sql/sql_class.cc:
Refactoring, separate lex_input_stream from st_lex.
sql/sql_class.h:
Refactoring, separate lex_input_stream from st_lex.
sql/sql_lex.cc:
Refactoring, separate lex_input_stream from st_lex.
sql/sql_lex.h:
Refactoring, separate lex_input_stream from st_lex.
sql/sql_parse.cc:
Refactoring, separate lex_input_stream from st_lex.
sql/sql_prepare.cc:
Refactoring, separate lex_input_stream from st_lex.
sql/sql_trigger.cc:
Refactoring, separate lex_input_stream from st_lex.
sql/sql_view.cc:
Refactoring, separate lex_input_stream from st_lex.
sql/sql_yacc.yy:
Refactoring, separate lex_input_stream from st_lex.
into bk-internal.mysql.com:/data0/bk/mysql-5.0-marvel
client/mysql.cc:
Auto merged
heap/hp_write.c:
Auto merged
sql/ha_ndbcluster.cc:
Auto merged
sql/handler.cc:
Auto merged
sql/item.cc:
Auto merged
sql/mysqld.cc:
Auto merged
sql/opt_range.cc:
Auto merged
sql/sql_base.cc:
Auto merged
sql/sql_class.cc:
Auto merged
sql/sql_class.h:
Auto merged
sql/sql_delete.cc:
Auto merged
sql/sql_insert.cc:
Auto merged
sql/sql_load.cc:
Auto merged
sql/sql_select.cc:
Auto merged
sql/sql_table.cc:
Auto merged
into sergbook.mysql.com:/usr/home/serg/Abk/mysql-5.0
mysql-test/r/sp.result:
Auto merged
mysql-test/t/sp.test:
Auto merged
sql/ha_ndbcluster.cc:
Auto merged
sql/handler.cc:
Auto merged
sql/mysql_priv.h:
Auto merged
sql/sp_head.cc:
Auto merged
sql/sql_base.cc:
Auto merged
sql/sql_class.h:
Auto merged
sql/sql_insert.cc:
Auto merged
sql/sql_table.cc:
Auto merged
sql/sql_view.cc:
Auto merged
thd->options' OPTION_STATUS_NO_TRANS_UPDATE bit was not restored at the end of SF() invocation, where
SF() modified non-ta table.
As the result of this artifact it was not possible to detect whether there were any side-effects when
top-level query ends.
If the top level query table was not modified and the bit is lost there would be no binlogging.
Fixed with preserving the bit inside of thd->no_trans_update struct. The struct agregates two bool flags
telling whether the current query and the current transaction modified any non-ta table.
The flags stmt, all are dropped at the end of the query and the transaction.
mysql-test/r/sp_trans.result:
results will be changed once again after bug#23333 will be fixed.
mysql-test/t/sp_trans.test:
regression test added
sql/ha_ndbcluster.cc:
replacing thd->options' OPTION_STATUS_NO_TRANS_UPDATE bit and bool thd->no_trans_update
with thd->no_trans_update as struct
sql/handler.cc:
replacing operations with thd->options' OPTION_STATUS_NO_TRANS_UPDATE bit
with the member thd->no_trans_update.all;
converting thd->no_trans_update into struct of bools.
sql/log.cc:
replacing operations with thd->options' OPTION_STATUS_NO_TRANS_UPDATE bit
with the member thd->no_trans_update.all;
converting thd->no_trans_update into struct of bools.
sql/set_var.cc:
replacing operations with thd->options' OPTION_STATUS_NO_TRANS_UPDATE bit
with the member thd->no_trans_update.all;
converting thd->no_trans_update into struct of bools.
sql/sp_head.cc:
replacing operations with thd->options' OPTION_STATUS_NO_TRANS_UPDATE bit
with the member thd->no_trans_update.all;
converting thd->no_trans_update into struct of bools.
sql/sql_class.h:
replacing operations with thd->options' OPTION_STATUS_NO_TRANS_UPDATE bit
with the member thd->no_trans_update.all;
converting thd->no_trans_update into struct of bools.
sql/sql_delete.cc:
replacing operations with thd->options' OPTION_STATUS_NO_TRANS_UPDATE bit
with the member thd->no_trans_update.all;
converting thd->no_trans_update into struct of bools.
sql/sql_insert.cc:
replacing operations with thd->options' OPTION_STATUS_NO_TRANS_UPDATE bit
with the member thd->no_trans_update.all;
converting thd->no_trans_update into struct of bools.
sql/sql_load.cc:
replacing operations with thd->options' OPTION_STATUS_NO_TRANS_UPDATE bit
with the member thd->no_trans_update.all;
converting thd->no_trans_update into struct of bools.
sql/sql_parse.cc:
replacing operations with thd->options' OPTION_STATUS_NO_TRANS_UPDATE bit
with the member thd->no_trans_update.all;
converting thd->no_trans_update into struct of bools.
sql/sql_table.cc:
replacing operations with thd->options' OPTION_STATUS_NO_TRANS_UPDATE bit
with the member thd->no_trans_update.all;
converting thd->no_trans_update into struct of bools.
sql/sql_update.cc:
replacing operations with thd->options' OPTION_STATUS_NO_TRANS_UPDATE bit
with the member thd->no_trans_update.all;
converting thd->no_trans_update into struct of bools.
context was used as an argument of GROUP_CONCAT.
Ensured correct setting of the depended_from field in references
generated for set functions aggregated in outer selects.
A wrong value of this field resulted in wrong maps returned by
used_tables() for these references.
Made sure that a temporary table field is added for any set function
aggregated in outer context when creation of a temporary table is
needed to execute the inner subquery.
mysql-test/r/subselect.result:
Added a test case for bug #27229.
mysql-test/t/subselect.test:
Added a test case for bug #27229.
sql/item.cc:
Fixed bug #27229: crash when a set function aggregated in outer
context was used as an argument of GROUP_CONCAT.
Ensured correct setting of the depended_from field in references
generated for set functions aggregated in outer selects.
sql/item_sum.cc:
Fixed bug #27229: crash when a set function aggregated in outer
context was used as an argument of GROUP_CONCAT.
Added the field aggr_sel to the objects of the class Item_sum.
In any Item_sum object created for a set function this field
has to contain a pointer to the select where the set function
is aggregated.
sql/item_sum.h:
Fixed bug #27229: crash when a set function aggregated in outer
context was used as an argument of GROUP_CONCAT.
Added the field aggr_sel to the objects of the class Item_sum.
In any Item_sum object created for a set function this field
has to contain a pointer to the select where the set function
is aggregated.
Added a method that says whether a set function is aggregated
in outer context and, if so, returns the aggregating select.
Removed the field nest_level_tables_count introduced by the
patch for bug 24484 as aggr_sel->join->tables contains the
sane number.
sql/sql_base.cc:
Fixed bug #27229: crash when a set function aggregated in outer
context was used as an argument of GROUP_CONCAT.
Added the field aggr_sel to the objects of the class Item_sum.
Removed changes introduced by the patch for bug 24484 as
the field leaf_count of the THD class is not used anymore.
sql/sql_class.h:
Fixed bug #27229: crash when a set function aggregated in outer
context was used as an argument of GROUP_CONCAT.
Added the field aggr_sel to the objects of the class Item_sum.
Removed changes introduce by the patch for bug 24484 as
the field leaf_count of the THD class is not used anymore.
sql/sql_insert.cc:
Fixed bug #27229: crash when a set function aggregated in outer
context was used as an argument of GROUP_CONCAT.
Added the field aggr_sel to the objects of the class Item_sum.
Removed changes introduce by the patch for bug 24484 as
the field leaf_count of the THD class is not used anymore.
sql/sql_select.cc:
Fixed bug #27229: crash when a set function aggregated in outer
context was used as an argument of GROUP_CONCAT.
When creating a temporary table a field is added in it for any
set function aggregated in outer context.
into magare.gmz:/home/kgeorge/mysql/autopush/B24484-5.0
mysql-test/r/subselect3.result:
Auto merged
sql/item.h:
Auto merged
sql/item_sum.cc:
Auto merged
sql/opt_range.cc:
Auto merged
sql/sql_base.cc:
Auto merged
sql/sql_class.h:
Auto merged
sql/sql_insert.cc:
Auto merged
sql/sql_select.cc:
Auto merged
To correctly decide which predicates can be evaluated with a given table
the optimizer must know the exact set of tables that a predicate depends
on. If that mask is too wide (refer to non-existing tables) the optimizer
can erroneously skip a predicate.
One such case of wrong table usage mask were the aggregate functions.
The have a all-1 mask (meaning depend on all tables, including non-existent
ones).
Fixed by making a real used_tables mask for the aggregates. The mask is
constructed in the following way :
1. OR the table dependency masks of all the arguments of the aggregate.
2. If all the arguments of the function are from the local name resolution
context and it is evaluated in the same name resolution
context where it is referenced all the tables from that name resolution
context are OR-ed to the dependency mask. This is to denote that an
aggregate function depends on the number of rows it processes.
3. Handle correctly the case of an aggregate function optimization (such that
the aggregate function can be pre-calculated and made a constant).
Made sure that an aggregate function is never a constant (unless subject of a
specific optimization and pre-calculation).
One other flaw was revealed and fixed in the process : references were
not calling the recalculation method for used_tables of their targets.
mysql-test/r/subselect3.result:
Bug #24484: test case
mysql-test/t/subselect3.test:
Bug #24484: test case
sql/item.h:
Bug #24484: Item_ref must update the used tables.
sql/item_sum.cc:
Bug #24484: correct calculation of used_tables for aggregates.
sql/item_sum.h:
Bug #24484: correct calculation of used_tables for aggregates.
sql/opt_range.cc:
Bug #24484: fixed ref resolution in loose index scan
sql/sql_base.cc:
Bug #24484: moved counting of leaf tables inside
setup_tables_and_check_access.
sql/sql_class.h:
Bug #24484: changed table count to more narrow type.
sql/sql_insert.cc:
Bug #24484: moved counting of leaf tables inside
setup_tables_and_check_access. Substract the first
table (and its subtables) of an INSERT statement
from leaf_count.
sql/sql_select.cc:
Bug #24484: correct check for aggregates
touched but not actually changed.
The LAST_INSERT_ID() is reset to 0 if no rows were inserted or changed.
This is the case when an INSERT ... ON DUPLICATE KEY UPDATE updates a row
with the same values as the row contains.
Now the LAST_INSERT_ID() values is reset to 0 only if there were no rows
successfully inserted or touched.
The new 'touched' field is added to the COPY_INFO structure. It holds the
number of rows that were touched no matter whether they were actually
changed or not.
sql/sql_class.h:
Bug#27033: 0 as LAST_INSERT_ID() after INSERT .. ON DUPLICATE if rows were
touched but not actually changed.
The new 'touched' field is added to the COPY_INFO structure. It holds the
number of rows that were touched no matter whether they were actually
changed or not.
mysql-test/r/insert_update.result:
Added a test case for the bug#27033: 0 as LAST_INSERT_ID() after INSERT .. ON DUPLICATE if rows were
touched but not actually changed.
mysql-test/t/insert_update.test:
Added a test case for the bug#27033: 0 as LAST_INSERT_ID() after INSERT .. ON DUPLICATE if rows were
touched but not actually changed.
sql/sql_insert.cc:
Bug#27033: 0 as LAST_INSERT_ID() after INSERT .. ON DUPLICATE if rows were
touched but not actually changed.
Now the LAST_INSERT_ID() values is reset to 0 only if there were no rows
successfully inserted or touched.