ESCAPE has length of 1 if specified and sql_mode is NO_BACKSLASH_ESCAPES
or has length of 0 or 1 in every other situation.
(approved patch applied on a up-to-date tree re-commit)
mysql-test/r/select.result:
results of test for bug 12595
mysql-test/t/select.test:
test for bug #12595 (ESCAPE must be exactly one character long)
sql/item_cmpfunc.cc:
if ESCAPE was in the statement check whether its length is
different than 1. In NO_BACKSLASH_ESCAPES mode only length of 1 is
allowed, otherwise the length could be 0 or 1 character (code point
in the sense of Unicode).
sql/item_cmpfunc.h:
pass variable from the parsing stage - whether
ESCAPE clause was found in the statement
sql/sql_help.cc:
pass FALSE for escape_used_in_parsing because we
want the default mode of no error checking - our internal code.
sql/sql_lex.cc:
initialized variable used to transfer information during
parsing up in the stack when reducing in the grammar
sql/sql_lex.h:
new variable used for transfering information when
reducing in the grammar.
sql/sql_yacc.yy:
initialize Lex->escape_used and then use it when reducing.
This is needed as fix for bug #12595 to distinguish between
situation where ESCAPE was found and when not because internally
we may pass a string an empty string and there is no other way
to find out whether this is correct or not in case of
NO_BACKSLASH_ESCAPES mode, which allows only length of 1 if
ESCAPE is part of the SQL statement.
When fixing Item_func_plus in ORDER BY clause field c is searched in all
opened tables, but because c is an alias it wasn't found there.
This patch adds a flag to select_lex which allows Item_field::fix_fields()
to look up in select's item_list to find aliased fields.
sql/item.cc:
Fix bug#7672 Unknown column error in order clause
When fixing fields in ORDER BY clause allow Item_field::fix_fields() to look up items in select's item list to find aliased fields.
sql/sql_lex.cc:
Fix bug#7672 Unknown column error in order clause
sql/sql_lex.h:
Fix bug#7672 Unknown column error in order clause
Added flag to select_lex allowing Item_field::fix_fields to look up items in select's item list.
sql/sql_select.cc:
Fix bug#7672 Unknown column error in order clause
mysql-test/t/select.test:
Test case for bug#7672 Unknown column error in order clause
mysql-test/r/select.result:
Test case for bug#7672 Unknown column error in order clause
client/mysql.cc:
Don't use c_ptr() for cgets() and ensure buffer is not overwritten
mysql-test/r/cast.result:
More test for CAST(0x.... as signed)
sql/opt_sum.cc:
Fix bugs found during review
- Changed code to be able to remove one if
- Ensure that count == 0 only if is_exact_count == TRUE
sql/sql_delete.cc:
Ensure 'allow_sum_func' is reset before call to setup_conds
sql/sql_lex.cc:
allow_sum_func doesn't have to be reset for each query
(It's to be reset in setup_fields() or before call to setup_conds()
sql/sql_load.cc:
Move set of auto_increment_field_not_null so that it's not set if field value is NULL
sql/sql_prepare.cc:
allow_sum_func doesn't have to be reset for each query
(It's to be reset in setup_fields() or before call to setup_conds()
sql/sql_update.cc:
Ensure 'allow_sum_func' is reset before call to setup_conds
thd->allow_sum_func was left 'true' after previous statement thus allowing
sum funcs to be present in conditions.
thd->allow_sum_func should be set to 0 for each query and each prepared
statement reinitialization. This is done in lex_start() and
reset_stmt_for_execute().
sql/sql_lex.cc:
Fix bug#13180 thd->allow_sum_func wasn't reset obefore query processing.
thd->allow_sum_func is set to 0 in lex_start().
sql/sql_prepare.cc:
Fix bug#13180 thd->allow_sum_func wasn't reset obefore query processing.
thd->allow_sum_func is set to 0 in reset_stmt_for_execute().
mysql-test/t/update.test:
Test case for bug#13180 thd->allow_sum_funcs wasn't reset before query
processing.
mysql-test/r/update.result:
Test case for bug#13180 thd->allow_sum_funcs wasn't reset before query
processing.
This bug occurs when some trigger for table used by DML statement is created
or changed while statement was waiting in lock_tables(). In this situation
prelocking set which we have calculated becames invalid which can easily lead
to errors and even in some cases to crashes.
With proposed patch we no longer silently reopen tables in lock_tables(),
instead caller of lock_tables() becomes responsible for reopening tables and
recalculation of prelocking set.
mysql-test/t/trigger.test:
Added tests for bug #12704 "Server crashes during trigger execution".
Unfortunately these tests rely on the order in which tables are locked
by statement so they are non-determenistic and therefore should be disabled.
sql/lock.cc:
mysql_lock_tables():
Now instead of always reopening altered or dropped tables by itself
mysql_lock_tables() can notify upper level and rely on caller doing this.
sql/mysql_priv.h:
Now mysql_lock_tables() can either reopen deleted or altered tables by itself
or notify caller about such situation through 'need_reopen' argument and rely
on it in this.
Also lock_tables() has new 'need_reopen' out parameter through which it
notifies caller that some tables were altered or dropped so he needs to reopen
them (and rebuild prelocking set some triggers may change or simply appear).
sql/sp.cc:
sp_add_used_routine():
To be able to restore LEX::sroutines_list to its state right after parsing
we now adjust LEX::sroutines_list_own_last/sroutines_list_own_elements when
we add directly used routine.
sp_remove_not_own_routines():
Added procedure for restoring LEX::sroutines/sroutines_list to their state
right after parsing (by throwing out non-directly used routines).
sp_cache_routines_and_add_tables_for_view()/sp_update_stmt_used_routines():
We should use LEX::sroutines_list instead of LEX::sroutines as source of
routines used by view, since LEX::sroutines is not availiable for view
on second attempt to open it (see comment in open_tables() about it).
sql/sp.h:
sp_remove_not_own_routines():
Added procedure for restoring LEX::sroutines/sroutines_list to their state
right after parsing (by throwing out non-directly used routines).
sql/sp_head.cc:
Removed assert which is no longer always true.
sql/sql_base.cc:
reopen_table():
When we re-open table and do shallow copy of TABLE object we should adjust
pointers to it in associated Table_triggers_list object. Removed nil
operation.
open_tables():
Now this function is able to rebuild prelocking set for statement if it is
needed. It also correctly handles FLUSH TABLES which may occur during its
execution.
lock_tables():
Instead of allowing mysql_lock_tables() to silently reopen altered or dropped
tables let us notify caller and rely on that it will do reopen itself.
This solves the problem when trigger suddenly appears or changed during
mysq_lock_tables().
close_tables_for_reopen():
Added routine for properly preparing for reopening of tables and recalculation
of set of prelocked tables.
sql/sql_handler.cc:
Here we let mysql_lock_tables() to reopen dropped or altered tables by itself.
sql/sql_insert.cc:
Here we let mysql_lock_tables() to reopen dropped or altered tables by itself.
sql/sql_lex.cc:
LEX:
Added 'sroutines_list_own_last' and 'sroutines_list_own_elements' members
which are used for keeping state in which 'sroutines_list' was right after
statement parsing (and for restoring of this list to this state).
sql/sql_lex.h:
LEX:
Added 'sroutines_list_own_last' and 'sroutines_list_own_elements' members
which are used for keeping state in which 'sroutines_list' was right after
statement parsing (and for restoring of this list to this state).
Added chop_off_not_own_tables() method to simplify throwing away list
of implicitly used (prelocked) tables.
sql/sql_prepare.cc:
Now instead of silently reopening altered or dropped tables in
lock_tables() we notify caller and rely on that the caller will
reopen tables.
sql/sql_table.cc:
Here we let mysql_lock_tables() to reopen dropped or altered tables by itself.
sql/sql_trigger.cc:
Added Table_triggers_list::set_table() method to adjust Table_triggers_list
to new pointer to TABLE instance.
sql/sql_trigger.h:
Added Table_triggers_list::set_table() method to adjust Table_triggers_list
to new pointer to TABLE instance.
sql/sql_update.cc:
Now instead of silently reopening altered or dropped tables in
lock_tables() we notify caller and rely on that the caller will
reopen tables.
The idea of the patch is to separate statement processing logic,
such as parsing, validation of the parsed tree, execution and cleanup,
from global query processing logic, such as logging, resetting
priorities of a thread, resetting stored procedure cache, resetting
thread count of errors and warnings.
This makes PREPARE and EXECUTE behave similarly to the rest of SQL
statements and allows their use in stored procedures.
This patch contains a change in behaviour:
until recently for each SQL prepared statement command, 2 queries
were written to the general log, e.g.
[Query] prepare stmt from @stmt_text;
[Prepare] select * from t1 <-- contents of @stmt_text
The chagne was necessary to prevent [Prepare] commands from being written
to the general log when executing a stored procedure with Dynamic SQL.
We should consider whether the old behavior is preferrable and probably
restore it.
This patch refixes Bug#7115, Bug#10975 (partially), Bug#10605 (various bugs
in Dynamic SQL reported before it was disabled).
mysql-test/r/not_embedded_server.result:
Since we don't want to log Dynamic SQL in stored procedures,
now the general log gets only one log entry per SQL statement.
mysql-test/r/sp-error.result:
- remove obsolete tests
- a better error message for the case when a stored procedure that
returns a result set is called from a function
mysql-test/r/trigger.result:
- a better error message for the case when a stored procedure that
returns a result set is called from a trigger
mysql-test/t/sp-error.test:
- a better error message for the case when a stored procedure that
returns a result set is called from a function.
- move the comment to its place (end of file).
mysql-test/t/trigger.test:
- a better error message for the case when a stored procedure that
returns a result set is called from a trigger
sql/item_func.cc:
- we need to pass sql_command explicitly to get_var_with_binlog, because
when creating a query for SQL prepared statement thd->lex->sql_command
points at SQLCOM_EXECUTE, which is not listed in the list of update
queries.
sql/log_event.h:
- remove an extra copy of the previous sentence
sql/mysql_priv.h:
- fix declarations of sql_prepare.cc API
sql/share/errmsg.txt:
- a new error message, when one attempts to execute a prepared statement
which is currently being executed (this can happen only in Dynamic SQL
at the moment).
sql/sp_head.cc:
- extend sp_multi_results_command to return different flags for a
command (and rename it)
- add support for SQLCOM_PREPARE,SQLCOM_EXECUTE, SQLCOM_DEALLOCATE
to sp_get_flags_for_command
- replace multiple boolean sp_head members with uint m_flags
- a fix for a crash when user variables are used in a stored procedure
and binlog is on. A temporary fix for Bug#12637 "SP crashes the server
if it has update query with user var & binlog is enabled", which actually
stands for stored functions: now instead of a crash we break
replication if a user variable is used in a stored function which
is executed in prelocked mode.
sql/sp_head.h:
- replace multiple boolean flags of sp_head with uint m_flags;
- add flag CONTAINS_DYNAMIC_SQL
- use this flag to error if a stored procedure with Dynamic SQL is
called from a function or trigger.
sql/sql_class.cc:
- Statement_map::insert should not delete a statement if it exists,
now it's done externally to be able to handle the case when the
statement being deleted is in use.
- remove extra code (free_list is already reset in free_items)
sql/sql_lex.cc:
- add lex->stmt_prepare_mode; we can't rely on thd->command any more,
because we don't reset it any more (Dynamic SQL requirement is that
PS are as little intrusive as possible).
sql/sql_lex.h:
- declare bool LEX::stmt_prepare_mode
sql/sql_parse.cc:
- move prepared statement code to sql_prepare.cc
- change declarations (refactored code)
- better error message when one attempts to use Dynamic SQL or a
stored procedure that returns a result set in a function or trigger.
sql/sql_prepare.cc:
- major refactoring to ensure PREPARE/EXECUTE commands do not reset global THD
state and allow their use in stored procedures.
- add Prepared_statement::flags and use it to ensure no recursive execution
of a prepared statement is possible
- better comments
sql/sql_yacc.yy:
- enable PREPARE/EXECUTE/DEALLOCATE in stored procedures
- produce an error message on attempt to use PREPARE/EXECUTE/DEALLOCATE
in a stored function or trigger
mysql-test/r/sp-dynamic.result:
- sp-dynamic.test results
mysql-test/t/sp-dynamic.test:
- a new test for PREPARE/EXECUTE/DEALLOCATE in stored procedures.
- current_arena to stmt_arena: the thread may have more than one
'current' arenas: one for runtime data, and one for the parsed
tree of a statement. Only one of them is active at any moment.
- set_item_arena -> set_query_arena, because Item_arena was renamed to
Query_arena a while ago
- set_n_backup_item_arena -> set_n_backup_active_arena;
the active arena is the arena thd->mem_root and thd->free_list
are currently pointing at.
- restore_backup_item_arena -> restore_active_arena (with the same
rationale)
- change_arena_if_needed -> activate_stmt_arena_if_needed; this
method sets thd->stmt_arena active if it's not done yet.
sql/item.cc:
Rename.
sql/item_cmpfunc.cc:
Rename.
sql/item_func.cc:
Rename.
sql/item_subselect.cc:
Rename.
sql/item_subselect.h:
Remove an unused forward declaration.
sql/item_sum.h:
Remove an unused forward declaration.
sql/mysql_priv.h:
Remove an unused forward declaration.
sql/sp.cc:
Rename.
sql/sp_head.cc:
Rename.
sql/sql_base.cc:
Rename.
sql/sql_class.cc:
Rename.
sql/sql_class.h:
Rename.
sql/sql_lex.cc:
Rename.
sql/sql_parse.cc:
Rename.
sql/sql_prepare.cc:
Rename.
sql/sql_select.cc:
Rename.
sql/sql_show.cc:
Rename.
sql/sql_union.cc:
Rename.
sql/sql_view.cc:
Rename.
sql/table.cc:
Rename.
"Interleaved SPs execution is now binlogged properly, "SELECT spfunc()" is binlogged too.
The known remaining issue is binlogging/replication of "a routine is deleted while it is executed" scenario.
mysql-test/r/rpl_sp.result:
Fix for BUG#12335: updated test cases/results
mysql-test/t/rpl_sp.test:
Fix for BUG#12335: updated test cases/results
sql/item.cc:
Fix for BUG#12335 (SP replication):
- Added Item_name_const 'function'
- Addede 'delete reuse' to call dtor on item reuse
sql/item.h:
Fix for BUG#12335 (SP replication) : Added Item_name_const 'function' + code cleanup
sql/item_create.cc:
Fix for BUG#12335 (SP replication) : Added Item_name_const 'function'
sql/item_create.h:
Fix for BUG#12335 (SP replication) : Added Item_name_const 'function'
sql/item_func.cc:
Fix for BUG#12335 (SP replication) : binary log is now constrolled from within execute_function.
sql/lex.h:
Fix for BUG#12335 (SP replication) : Added Item_name_const 'function'
sql/log.cc:
Fix for BUG#12335 (SP replication) : Added MYSQL_LOG::{start|stop}_union_events to allow
one to temporary disable binlogging but collect a 'union' information about binlog write
calls.
sql/mysql_priv.h:
Fix for BUG#12335 (SP replication)
sql/sp_head.cc:
Fix for BUG#12335 (SP replication) : Now we use different SP binlogging strategy, grep for
StoredRoutinesBinlogging for details
sql/sp_head.h:
Comments added
sql/sp_pcontext.h:
Comments added
sql/sp_rcontext.h:
Comments added
sql/sql_class.cc:
Fix for BUG#12335 (SP replication) : Now we use different SP binlogging strategy, grep for
StoredRoutinesBinlogging for details
sql/sql_class.h:
Fix for BUG#12335 (SP replication) : Added MYSQL_LOG::{start|stop}_union_events to allow
one to temporary disable binlogging but collect a 'union' information about binlog write
calls.
sql/sql_delete.cc:
Fix for BUG#12335: check THD::query_str_binlog_unsuitable when writing to binlog.
sql/sql_insert.cc:
Fix for BUG#12335: check THD::query_str_binlog_unsuitable when writing to binlog.
sql/sql_lex.cc:
Fix for BUG#12335 (SP replication): Add ability to extract previous returned token from
the tokenizer.
sql/sql_lex.h:
Fix for BUG#12335 (SP replication): Add ability to extract previous returned token from
the tokenizer.
sql/sql_parse.cc:
Fix for BUG#12335 (SP replication) : Now we use different SP binlogging strategy, grep for
StoredRoutinesBinlogging for details
sql/sql_update.cc:
Fix for BUG#12335: check THD::query_str_binlog_unsuitable when writing to binlog.
sql/sql_yacc.yy:
Fix for BUG#12335 (SP replication) : When creating Item_splocal, remember where it is located
in the query.
include/my_global.h:
Safer macros to avoid possible overflows
sql/item_cmpfunc.cc:
Simple optimization
sql/sp_head.cc:
Indentation fixes
Remove not needed "else" levels
Added error checking for 'new'
Simpler reseting of thd->spcont in execute_procedure
sql/sql_base.cc:
Faster new
sql/sql_lex.cc:
Use 'TRUE' instead of 'true'
sql/sql_parse.cc:
Faster new
sql/sql_view.cc:
No need to set 'tables' as it's not used
sql/table.cc:
Simpler DBUG_ASSERT()
mysql-test/t/kill.test:
Moved --disable_reconnect earlier to avoid race condition
sql/sql_help.cc:
Cleanup during review of new code
(Moved variable definitions first in function
sql/sql_insert.cc:
Cleanup during review of new code
sql/sql_lex.cc:
Cleanup during review of new code
sql/sql_parse.cc:
Cleanup during review of new code
Changed potential problem with previous_table_ref where it dependent that TABLE_LIST first element would be next_local
Rearanged code in add_table_to_list() to remove extra if
Combined 2 calls to calloc() to one
sql/sql_view.cc:
Remove extra indentation level
Combined common 'on error' exit
sql/sql_yacc.yy:
Fixed comment style
sql/table.cc:
Cleanup during review of new code
- Changed while() loops to for() loop (to make code more readable)
- Removed not needed initialization of variables
- Removed not needed 'else' cases
- Removed trivial ASSERT's that was checked by previous code
- Moved comment setting last in Natural_join_column::check_grants()
results.
st_select_lex_unit::print() was losing UNION ALL if in statement were present
UNION DISTINCT.
mysql-test/r/view.result:
Test case for bug #10624 Views with multiple UNION and UNION ALL produce incorrect results.
mysql-test/t/view.test:
Test case for bug #10624 Views with multiple UNION and UNION ALL produce incorrect results.
sql/sql_lex.cc:
Fix bug #10624 Views with multiple UNION and UNION ALL produce incorrect results.
into mysql.com:/home/timka/mysql/src/5.0-2486-merge
mysql-test/r/errors.result:
Auto merged
mysql-test/r/fulltext.result:
Auto merged
mysql-test/r/fulltext_order_by.result:
Auto merged
mysql-test/r/innodb.result:
Auto merged
mysql-test/r/join_nested.result:
Auto merged
mysql-test/r/subselect.result:
Auto merged
mysql-test/t/errors.test:
Auto merged
mysql-test/t/fulltext.test:
Auto merged
mysql-test/t/fulltext_order_by.test:
Auto merged
mysql-test/t/innodb.test:
Auto merged
mysql-test/t/join_nested.test:
Auto merged
mysql-test/t/subselect.test:
Auto merged
sql/item.cc:
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
sql/sql_delete.cc:
Auto merged
sql/sql_lex.cc:
Auto merged
sql/sql_lex.h:
Auto merged
sql/sql_parse.cc:
Auto merged
sql/sql_select.cc:
Auto merged
sql/sql_update.cc:
Auto merged
sql/sql_yacc.yy:
Auto merged
sql/table.h:
Auto merged
tests/mysql_client_test.c:
Auto merged
sql/sql_insert.cc:
merge WL#2486
sql/sql_show.cc:
merge WL#2486
"Process NATURAL and USING joins according to SQL:2003".
* Some of the main problems fixed by the patch:
- in "select *" queries the * expanded correctly according to
ANSI for arbitrary natural/using joins
- natural/using joins are correctly transformed into JOIN ... ON
for any number/nesting of the joins.
- column references are correctly resolved against natural joins
of any nesting and combined with arbitrary other joins.
* This patch also contains a fix for name resolution of items
inside the ON condition of JOIN ... ON - in this case items must
be resolved only against the JOIN operands. To support such
'local' name resolution, the patch introduces a stack of
name resolution contexts used at parse time.
NOTICE:
- This patch is not complete in the sense that
- there are 2 test cases that still do not pass -
one in join.test, one in select.test. Both are marked
with a comment "TODO: WL#2486".
- it does not include a new test specific for the task
mysql-test/include/ps_query.inc:
Adjusted according to standard NATURAL/USING join semantics.,
mysql-test/r/bdb.result:
Adjusted according to standard NATURAL/USING join semantics.
mysql-test/r/derived.result:
Adjusted according to standard NATURAL/USING join semantics.
mysql-test/r/errors.result:
The column as a whole cannot be resolved, so different error message.
mysql-test/r/fulltext.result:
Adjusted according to standard JOIN ... ON semantics =>
the ON condition can refer only to the join operands.
mysql-test/r/fulltext_order_by.result:
More detailed error message.
mysql-test/r/innodb.result:
Adjusted according to standard NATURAL/USING join semantics.
This test doesn't pass completetly yet!
mysql-test/r/insert_select.result:
More detailed error message.
mysql-test/r/join.result:
Adjusted according to standard NATURAL/USING join semantics.
NOTICE: there is one test case that still fails, and it is
commeted out and marked with WL#2486 in the test file.
mysql-test/r/join_crash.result:
Adjusted according to standard NATURAL/USING join semantics.
mysql-test/r/join_nested.result:
Adjusted according to standard NATURAL/USING join semantics.
mysql-test/r/join_outer.result:
Adjusted according to standard NATURAL/USING join semantics.
mysql-test/r/multi_update.result:
Adjusted according to standard NATURAL/USING join semantics.
mysql-test/r/null_key.result:
Adjusted according to standard NATURAL/USING join semantics.
mysql-test/r/order_by.result:
Adjusted according to standard NATURAL/USING join semantics.
mysql-test/r/ps_2myisam.result:
Adjusted according to standard NATURAL/USING join semantics.
mysql-test/r/ps_3innodb.result:
Adjusted according to standard NATURAL/USING join semantics.
mysql-test/r/ps_4heap.result:
Adjusted according to standard NATURAL/USING join semantics.
mysql-test/r/ps_5merge.result:
Adjusted according to standard NATURAL/USING join semantics.
mysql-test/r/ps_6bdb.result:
Adjusted according to standard NATURAL/USING join semantics.
mysql-test/r/ps_7ndb.result:
Adjusted according to standard NATURAL/USING join semantics.
mysql-test/r/select.result:
Adjusted according to standard NATURAL/USING join semantics.
NOTICE: there is one failing test case which is commented with
WL#2486 in the test file.
mysql-test/r/subselect.result:
Adjusted according to standard NATURAL/USING join semantics.
mysql-test/r/type_ranges.result:
Adjusted according to standard NATURAL/USING join semantics.
mysql-test/r/union.result:
More detailed error message.
mysql-test/t/bdb.test:
Adjusted according to standard NATURAL/USING join semantics.
mysql-test/t/errors.test:
Adjusted according to standard NATURAL/USING join semantics.
mysql-test/t/fulltext.test:
Adjusted according to standard JOIN ... ON semantics =>
the ON condition can refer only to the join operands.
mysql-test/t/fulltext_order_by.test:
More detailed error message.
mysql-test/t/innodb.test:
Adjusted according to standard NATURAL/USING join semantics.
This test doesn't pass completetly yet!
mysql-test/t/insert_select.test:
More detailed error message.
mysql-test/t/join.test:
Adjusted according to standard NATURAL/USING join semantics.
NOTICE: there is one test case that still fails, and it is
commeted out and marked with WL#2486 in the test file.
mysql-test/t/join_crash.test:
Adjusted according to standard NATURAL/USING join semantics.
mysql-test/t/join_nested.test:
Adjusted according to standard NATURAL/USING join semantics.
mysql-test/t/join_outer.test:
Adjusted according to standard NATURAL/USING join semantics.
mysql-test/t/null_key.test:
Adjusted according to standard NATURAL/USING join semantics.
mysql-test/t/order_by.test:
Adjusted according to standard NATURAL/USING join semantics.
mysql-test/t/select.test:
Adjusted according to standard NATURAL/USING join semantics.
NOTICE: there is one test case that still fails, and it is
commeted out and marked with WL#2486 in the test file.
mysql-test/t/subselect.test:
Adjusted according to standard NATURAL/USING join semantics.
mysql-test/t/type_ranges.test:
Adjusted according to standard NATURAL/USING join semantics.
mysql-test/t/union.test:
More detailed error message.
sql/item.cc:
- extra parameter to find_field_in_tables
- find_field_in_real_table renamed to find_field_in_table
- fixed comments/typos
sql/item.h:
- added [first | last]_name_resolution_table to class
Name_resolution_context
- commented old code
- standardized formatting
sql/mysql_priv.h:
- refactored the find_field_in_XXX procedures,
- added a new procedure for natural join table references,
- renamed the find_field_in_XXX procedures to clearer names
sql/sp.cc:
- pass the top-most list of the FROM clause to setup_tables
- extra parameter to find_field_in_tables
sql/sql_acl.cc:
- renamed find_field_in_table => find_field_in_table_ref
- extra parameter to find_field_in_table_ref
- commented old code
sql/sql_base.cc:
This file contains the core of the implementation of the processing
of NATURAL/USING joins (WL#2486).
- added many comments to old code
- refactored the group of find_field_in_XXX procedures, and added a
new procedure for natural joins. There is one find_field_in_XXX procedure
per each type of table reference (stored table, merge view, or natural
join); one meta-procedure that selects the correct one depeneding on the
table reference; and one procedure that goes over a list of table
referenes.
- NATURAL/USING joins are processed through the procedures:
mark_common_columns, store_natural_using_join_columns,
store_top_level_join_columns, setup_natural_join_row_types.
The entry point to processing NATURAL/USING joins is the
procedure 'setup_natural_join_row_types'.
- Replaced the specialized Field_iterator_XXX iterators with one
generic iterator over the fields of a table reference.
- Simplified 'insert_fields' and 'setup_conds' due to encapsulation of
the processing of natural joins in a separate set of procedures.
sql/sql_class.h:
- Commented old code.
sql/sql_delete.cc:
- Pass the FROM clause to setup_tables.
sql/sql_help.cc:
- pass the end name resolution table to find_field_in_tables
- adjust the list of tables for name resolution
sql/sql_insert.cc:
- Changed the code that saves and restores the current context to
support the list of tables for name resolution -
context->first_name_resolution_table, and
table_list->next_name_resolution_table.
Needed to support an ugly trick to resolve inserted columns only in
the first table.
- Added Name_resolution_context::[first | last]_name_resolution_table.
- Commented old code
sql/sql_lex.cc:
- set select_lex.parent_lex correctly
- set correct state of the current name resolution context
sql/sql_lex.h:
- Added a stack of name resolution contexts to support local
contexts for JOIN ... ON conditions.
- Commented old code.
sql/sql_load.cc:
- Pass the FROM clause to setup_tables.
sql/sql_olap.cc:
- Pass the FROM clause to setup_tables.
sql/sql_parse.cc:
- correctly set SELECT_LEX::parent_lex
- set the first table of the current name resoltion context
- added support for NATURAL/USING joins
- commented old code
sql/sql_select.cc:
- Pass the FROM clause to setup_tables.
- Pass the end table to find_field_in_tables
- Improved comments
sql/sql_show.cc:
- Set SELECT_LEX::parent_lex.
sql/sql_update.cc:
- Pass the FROM clause to setup_tables.
sql/sql_yacc.yy:
- Added support for a stack of name resolution contexts needed to
implement name resolution for JOIN ... ON. A context is pushed
for each new JOIN ... ON, and popped afterwards.
- Added support for NATURAL/USING joins.
sql/table.cc:
- Added new class Natural_join_column to hide the heterogeneous
representation of column references for stored tables and for
views.
- Added a new list TABLE_LIST::next_name_resolution_table to
support name resolution with NATURAL/USING joins. Also added
other members to TABLE_LIST to support NATURAL/USING joins.
- Added a generic iterator over the fields of table references
of various types - class Field_iterator_table_ref
sql/table.h:
- Added new class Natural_join_column to hide the heterogeneous
representation of column references for stored tables and for
views.
- Added a new list TABLE_LIST::next_name_resolution_table to
support name resolution with NATURAL/USING joins. Also added
other members to TABLE_LIST to support NATURAL/USING joins.
- Added a generic iterator over the fields of table references
of various types - class Field_iterator_table_ref
tests/mysql_client_test.c:
Adjusted according to standard NATURAL JOIN syntax.
mysql-test/r/sp.result:
Auto merged
mysql-test/r/view.result:
Auto merged
mysql-test/t/view.test:
Auto merged
sql/item_func.cc:
Auto merged
sql/sp.cc:
Auto merged
sql/sp_head.cc:
Auto merged
sql/sp_head.h:
Auto merged
sql/sql_base.cc:
Auto merged
sql/sql_class.cc:
Auto merged
sql/sql_class.h:
Auto merged
sql/sql_lex.cc:
Auto merged
sql/sql_parse.cc:
Auto merged
sql/sql_trigger.h:
Auto merged
its body, but lets each statement to get/release its own locks. This allows a broader set
of statements to be executed inside PROCEDUREs (but breaks replication)
This patch should fix BUG#8072, BUG#8766, BUG#9563, BUG#11126
mysql-test/r/sp-security.result:
Drop tables this test attempts to create
mysql-test/r/sp-threads.result:
Update test results
mysql-test/r/sp.result:
Disabled a test that triggers BUG#11986, cleanup used tables when tests start.
mysql-test/r/view.result:
Enabled a test case that now works with prelocking-free SPs
mysql-test/t/sp-security.test:
Drop tables this test attempts to create
mysql-test/t/sp.test:
Disabled a test that triggers BUG#11986, cleanup used tables when tests start.
mysql-test/t/view.test:
Enabled a test case that now works with prelocking-free SPs
sql/handler.cc:
Rename: thd->transaction.in_sub_stmt -> thd->in_sub_stmt
sql/item_func.cc:
Rename: thd->transaction.in_sub_stmt -> thd->in_sub_stmt
sql/sp.cc:
Non-prelocked SP execution: Added support for skipping prelocking of procedure body for
"CALL proc(...)" statements.
sql/sp.h:
Non-prelocked SP execution: Added support for skipping prelocking of procedure body for
"CALL proc(...)" statements.
sql/sp_cache.h:
Added comments
sql/sp_head.cc:
Non-prelocked SP execution:
* Try to unlock tables after PROCEDURE arguments have been evaluated.
* Make sp_lex_keeper be able to execute in 2 modes: A) when already in prelocked mode
B) when its statement enters/leaves prelocked mode itself.
sql/sp_head.h:
Non-prelocked SP execution: Make sp_lex_keeper to additionally keep list of tables it
needs to prelock when its statement enters/leaves prelocked mode on its own.
sql/sql_base.cc:
Non-prelocked SP execution: Make open_tables() to
* detect 'CALL proc(...)' and not to do prelocking for procedure body statements.
* Make lex->query_tables_last to point precisely to a boundary in lex->query_tables
list where 'own' tables and views' tables end and added-for-prelocking tables begin.
(it was not true before - view's tables could end up after query_tables_own_last)
sql/sql_class.cc:
Rename: thd->transaction.in_sub_stmt -> thd->in_sub_stmt
sql/sql_class.h:
Rename: thd->transaction.in_sub_stmt -> thd->in_sub_stmt
sql/sql_lex.cc:
Non-prelocked SP execution: More rigourous cleanup in st_lex::cleanup_after_one_table_open()
sql/sql_parse.cc:
Rename: thd->transaction.in_sub_stmt -> thd->in_sub_stmt, remove outdated comments
sql/sql_trigger.h:
Rename: thd->transaction.in_sub_stmt -> thd->in_sub_stmt
into mysql.com:/home/my/mysql-5.0
BitKeeper/etc/ignore:
auto-union
BitKeeper/deleted/.del-ctype_cp932.test:
Auto merged
BitKeeper/deleted/.del-isam.test~834fb0ee8196c445:
Auto merged
include/thr_lock.h:
Auto merged
mysql-test/t/alias.test:
Auto merged
mysql-test/t/alter_table.test:
Auto merged
mysql-test/t/archive.test:
Auto merged
mysql-test/t/backup.test:
Auto merged
mysql-test/t/bool.test:
Auto merged
mysql-test/t/connect.test:
Auto merged
mysql-test/t/count_distinct2.test:
Auto merged
mysql-test/t/create.test:
Auto merged
mysql-test/t/ctype_many.test:
Auto merged
mysql-test/t/ctype_ucs_binlog.test:
Auto merged
mysql-test/t/date_formats.test:
Auto merged
mysql-test/t/delayed.test:
Auto merged
mysql-test/t/derived.test:
Auto merged
mysql-test/t/distinct.test:
Auto merged
mysql-test/t/drop.test:
Auto merged
mysql-test/t/endspace.test:
Auto merged
mysql-test/t/flush.test:
Auto merged
mysql-test/t/fulltext.test:
Auto merged
mysql-test/t/fulltext_order_by.test:
Auto merged
mysql-test/t/func_compress.test:
Auto merged
mysql-test/t/func_concat.test:
Auto merged
mysql-test/t/func_date_add.test:
Auto merged
mysql-test/t/func_equal.test:
Auto merged
mysql-test/t/func_if.test:
Auto merged
mysql-test/t/func_sapdb.test:
Auto merged
mysql-test/t/func_set.test:
Auto merged
mysql-test/t/func_str.test:
Auto merged
mysql-test/t/gis-rtree.test:
Auto merged
mysql-test/t/gis.test:
Auto merged
mysql-test/t/grant.test:
Auto merged
mysql-test/t/grant2.test:
Auto merged
mysql-test/t/grant_cache.test:
Auto merged
mysql-test/t/heap.test:
Auto merged
mysql-test/t/heap_btree.test:
Auto merged
mysql-test/t/heap_hash.test:
Auto merged
mysql-test/t/init_connect.test:
Auto merged
mysql-test/t/insert_select.test:
Auto merged
mysql-test/t/insert_update.test:
Auto merged
mysql-test/t/key.test:
Auto merged
mysql-test/t/keywords.test:
Auto merged
mysql-test/t/limit.test:
Auto merged
mysql-test/t/lock.test:
Auto merged
mysql-test/t/lowercase_table.test:
Auto merged
mysql-test/t/lowercase_table3.test:
Auto merged
mysql-test/t/merge.test:
Auto merged
mysql-test/t/mix_innodb_myisam_binlog.test:
Auto merged
mysql-test/t/myisam.test:
Auto merged
mysql-test/t/mysqlbinlog2.test:
Auto merged
mysql-test/t/ndb_alter_table.test:
Auto merged
mysql-test/t/ndb_autodiscover.test:
Auto merged
mysql-test/t/ndb_charset.test:
Auto merged
mysql-test/t/ndb_grant.later:
Auto merged
mysql-test/t/ndb_index_ordered.test:
Auto merged
mysql-test/t/ndb_index_unique.test:
Auto merged
mysql-test/t/ndb_restore.test:
Auto merged
mysql-test/t/ndb_types.test:
Auto merged
mysql-test/t/ndb_update.test:
Auto merged
mysql-test/t/null.test:
Auto merged
mysql-test/t/null_key.test:
Auto merged
mysql-test/t/olap.test:
Auto merged
mysql-test/t/openssl_1.test:
Auto merged
mysql-test/t/order_by.test:
Auto merged
mysql-test/t/ps.test:
Auto merged
mysql-test/t/ps_1general.test:
Auto merged
mysql-test/t/ps_4heap.test:
Auto merged
mysql-test/t/ps_5merge.test:
Auto merged
mysql-test/t/query_cache.test:
Auto merged
mysql-test/t/replace.test:
Auto merged
mysql-test/t/row.test:
Auto merged
mysql-test/t/rpl000001.test:
Auto merged
mysql-test/t/rpl000015.test:
Auto merged
mysql-test/t/rpl000017.test:
Auto merged
mysql-test/t/rpl000018.test:
Auto merged
mysql-test/t/rpl_EE_error.test:
Auto merged
mysql-test/t/rpl_change_master.test:
Auto merged
mysql-test/t/rpl_charset.test:
Auto merged
mysql-test/t/rpl_create_database.test:
Auto merged
mysql-test/t/rpl_ddl.test:
Auto merged
mysql-test/t/rpl_deadlock.test:
Auto merged
mysql-test/t/rpl_empty_master_crash.test:
Auto merged
mysql-test/t/rpl_error_ignored_table.test:
Auto merged
mysql-test/t/rpl_flush_log_loop.test:
Auto merged
mysql-test/t/rpl_flush_tables.test:
Auto merged
mysql-test/t/rpl_get_lock.test:
Auto merged
mysql-test/t/rpl_heap.test:
Auto merged
mysql-test/t/rpl_loaddata.test:
Auto merged
mysql-test/t/rpl_loaddata_rule_m.test:
Auto merged
mysql-test/t/rpl_log.test:
Auto merged
mysql-test/t/rpl_log_pos.test:
Auto merged
mysql-test/t/rpl_max_relay_size.test:
Auto merged
mysql-test/t/rpl_multi_query.test:
Auto merged
mysql-test/t/rpl_openssl.test:
Auto merged
mysql-test/t/rpl_redirect.test:
Auto merged
mysql-test/t/rpl_relayrotate.test:
Auto merged
mysql-test/t/rpl_replicate_do.test:
Auto merged
mysql-test/t/rpl_reset_slave.test:
Auto merged
mysql-test/t/rpl_server_id2.test:
Auto merged
mysql-test/t/rpl_temporary.test:
Auto merged
mysql-test/t/rpl_timezone.test:
Auto merged
mysql-test/t/rpl_user_variables.test:
Auto merged
mysql-test/t/show_check.test:
Auto merged
mysql-test/t/subselect.test:
Auto merged
mysql-test/t/symlink.test:
Auto merged
mysql-test/t/synchronization.test:
Auto merged
mysql-test/t/system_mysql_db.test:
Auto merged
mysql-test/t/system_mysql_db_fix.test:
Auto merged
mysql-test/t/temp_table.test:
Auto merged
mysql-test/t/timezone2.test:
Auto merged
mysql-test/t/timezone_grant.test:
Auto merged
mysql-test/t/type_float.test:
Auto merged
mysql-test/t/type_ranges.test:
Auto merged
mysql-test/t/type_timestamp.test:
Auto merged
mysql-test/t/union.test:
Auto merged
mysql-test/t/update.test:
Auto merged
mysql-test/t/user_var-binlog.test:
Auto merged
mysql-test/t/warnings.test:
Auto merged
mysys/thr_lock.c:
Auto merged
sql/slave.cc:
Auto merged
sql/sql_base.cc:
Auto merged
sql/sql_lex.cc:
Auto merged
sql/sql_select.cc:
Auto merged
support-files/mysql.spec.sh:
Auto merged
BitKeeper/deleted/.del-rpl_trunc_binlog.test~961b1f6ac73d37c8:
Simple merge
mysql-test/r/ps_grant.result:
Simple merge
mysql-test/t/analyse.test:
Simple merge
mysql-test/t/auto_increment.test:
Simple merge
mysql-test/t/bdb.test:
Simple merge
mysql-test/t/bigint.test:
Simple merge
mysql-test/t/case.test:
Simple merge
mysql-test/t/cast.test:
Simple merge
mysql-test/t/check.test:
Simple merge
mysql-test/t/count_distinct.test:
Simple merge
mysql-test/t/ctype_latin1_de.test:
Simple merge
mysql-test/t/ctype_uca.test:
Simple merge
mysql-test/t/ctype_ucs.test:
Simple merge
mysql-test/t/ctype_utf8.test:
Simple merge
mysql-test/t/delete.test:
Simple merge
mysql-test/t/flush_block_commit.test:
Simple merge
mysql-test/t/func_default.test:
Simple merge
mysql-test/t/func_gconcat.test:
Simple merge
mysql-test/t/func_group.test:
Aligned code with 4.1
mysql-test/t/func_in.test:
Simple merge
mysql-test/t/func_math.test:
Simple merge
mysql-test/t/func_misc.test:
Simple merge
mysql-test/t/func_test.test:
Simple merge
mysql-test/t/func_time.test:
Simple merge
mysql-test/t/group_by.test:
Simple merge
mysql-test/t/having.test:
Simple merge
mysql-test/t/innodb.test:
Simple merge
mysql-test/t/insert.test:
Simple merge
mysql-test/t/join_outer.test:
Simple merge
mysql-test/t/kill.test:
Simple merge
mysql-test/t/loaddata.test:
Simple merge
mysql-test/t/lock_multi.test:
Simple merge
mysql-test/t/multi_update.test:
Simple merge
mysql-test/t/mysqlbinlog.test:
Simple merge
mysql-test/t/mysqldump.test:
Aligned code with 4.1
mysql-test/t/mysqltest.test:
Simple merge
mysql-test/t/ndb_basic.test:
Simple merge
mysql-test/t/ndb_cache.test:
Simple merge
mysql-test/t/ndb_subquery.test:
Simple merge
mysql-test/t/ps_grant.test:
Simple merge
mysql-test/t/range.test:
Simple merge
mysql-test/t/rpl_drop_temp.test:
Simple merge
mysql-test/t/rpl_loaddata_rule_s.test:
Simple merge
mysql-test/t/rpl_loaddatalocal.test:
Simple merge
mysql-test/t/rpl_rotate_logs.test:
Simple merge
mysql-test/t/rpl_until.test:
Simple merge
mysql-test/t/rpl_variables.test:
Simple merge
mysql-test/t/select.test:
Simple merge
mysql-test/t/sql_mode.test:
Simple merge
mysql-test/t/type_blob.test:
Simple merge
mysql-test/t/type_decimal.test:
Simple merge
mysql-test/t/user_var.test:
Simple merge
mysql-test/t/variables.test:
Simple merge
sql/lock.cc:
Simple optimization
sql/mysql_priv.h:
Simple merge
sql/sql_table.cc:
Simple merge
sql/table.cc:
Simple merge
sql/unireg.cc:
Simple merge
mysql-test/r/ps_grant.result:
Deallocate prepare statements
Moved test for 'show full processlist' to not_embedded_server.test becasue it's shouldn't be here and it could fail on a slow computer where previous connections has not yet disconnected
mysql-test/t/ps_grant.test:
Deallocate prepare statements
Moved test for 'show full processlist' to not_embedded_server.test becasue it's shouldn't be here and it could fail on a slow computer where previous connections has not yet disconnected
sql/sql_lex.cc:
Fixed typo
mysql-test/r/not_embedded_server.result:
New BitKeeper file ``mysql-test/r/not_embedded_server.result''
mysql-test/t/not_embedded_server.test:
New BitKeeper file ``mysql-test/t/not_embedded_server.test''
BitKeeper/etc/ignore:
added ndb/tools/ndb_config
syntax in binlog which stops replication":
disallow the use of parameter markers which can lead to generation
of malformed binlog queries.
mysql-test/r/ps.result:
Test results fixed: a test case for Bug#11299
mysql-test/t/ps.test:
A test case for Bug#11299
sql/sql_lex.cc:
Introduce a new parser token for a parameter marker. Make sure
that a parameter marker can not be used in a query which, when
transformed to a binlog query, becomes grammatically incorrect.
sql/sql_yacc.yy:
The check for COM_PREPARE has been moved into the lexer.
mysql-test/var:
New BitKeeper file ``mysql-test/var''
into mysql.com:/home/dlenev/src/mysql-5.0-mysqlproc
mysql-test/r/sp-error.result:
Auto merged
mysql-test/t/sp-error.test:
Auto merged
sql/mysql_priv.h:
Auto merged
sql/sp.h:
Auto merged
sql/sql_base.cc:
Auto merged
sql/sql_lex.cc:
Auto merged
sql/sql_lex.h:
Auto merged
sql/share/errmsg.txt:
Manual merge.
sql/sp.cc:
Manual merge.
of stored routines definitions even if we already have some tables open and
locked. To avoid deadlocks in this case we have to put certain restrictions
on locking of mysql.proc table.
This allows to use stored routines safely under LOCK TABLES without explicitly
mentioning mysql.proc in the list of locked tables. It also fixes bug #11554
"Server crashes on statement indirectly using non-cached function".
mysql-test/r/sp-error.result:
Added test which checks that now we can read stored routines definitions
under LOCK TABLES even if we have not locked mysql.proc explicitly. Also
added check for restrictions which this ability puts on mysql.proc locking.
Updated test for bug #9566 to correspond this new situation.
mysql-test/r/sp-threads.result:
Added test for bug #11554 "Server crashes on statement indirectly using
non-cached function".
mysql-test/t/sp-error.test:
Added test which checks that now we can read stored routines definitions
under LOCK TABLES even if we have not locked mysql.proc explicitly. Also
added check for restrictions which this ability puts on mysql.proc locking.
Updated test for bug #9566 to correspond this new situation.
mysql-test/t/sp-threads.test:
Added test for bug #11554 "Server crashes on statement indirectly using
non-cached function".
sql/lock.cc:
get_lock_data():
To be able to open and lock for reading system tables like 'mysql.proc',
when we already have some tables opened and locked, and avoid deadlocks
we have to disallow write-locking of these tables with any other tables.
sql/mysql_priv.h:
open_table() has new parameter which allows to open table even if some-one
has done a flush or holding namelock on it.
sql/share/errmsg.txt:
Added error message saying that one cannot write-lock some of system tables
with any other tables.
sql/sp.cc:
open_proc_table_for_read()/close_proc_table():
Added functions to be able open and close mysql.proc table when we already
have some tables open and locked.
open_proc_table_for_update():
Added function to simplify opening of mysql.proc for updates.
db_find_routine_aux()/db_find_routine()/db_update_routine()/...
Moved responsibility for opening mysql.proc table from db_find_routine_aux()
one level up, since this level knows better which type of table access for
reading of for update it needs.
sp_function_exists():
Removed unused function.
sql/sp.h:
sp_function_exists():
Removed unused function.
sql/sql_base.cc:
open_table():
Added new parameter which allows to open table even if some-one has done a
flush or holding namelock on it.
open_unireg_entry():
Mark 'mysql.proc' as a system table which has special restrictions on its
locking, but thanks to them can be open and locked even if we already have
some open and locked.
sql/sql_class.cc:
Moved THD members holding information about open and locked tables to separate
Open_tables_state class to be able to save/restore this state easier.
Added THD::push_open_tables_state()/pop_open_tables_state() methods for
saving/restoring this state.
sql/sql_class.h:
Moved THD members holding information about open and locked tables to separate
Open_tables_state class to be able to save/restore this state easier.
Added THD::push_open_tables_state()/pop_open_tables_state() methods for
saving/restoring this state.
sql/sql_lex.cc:
Removed LEX::proc_table member which was not really used.
sql/sql_lex.h:
Removed LEX::proc_table member which was not really used.
sql/sql_table.cc:
open_table() has new parameter which allows to open table even if some-one
has done a flush or holding namelock on it.
sql/table.h:
Added TABLE_SHARE::system_table indicating that this table is system table
like 'mysql.proc' and we want to be able to open and read-lock it even when
we already have some tables open and locked (and because of this we have
to put some restrictions on write locking it).
a table" with main tree.
mysql-test/r/trigger.result:
Temporalily disable part of test which exposes bug #11554 (work on which is in
progress).
mysql-test/t/sp-error.test:
After merge fix.
Fixed wrong delimiter command.
mysql-test/t/trigger.test:
Temporalily disable part of test which exposes bug #11554 (work on which is in
progress).
sql/sp.cc:
After merge fix.
Item_arena was renamed to Query_arena.
sql/sp.h:
After merge fix.
Item_arena was renamed to Query_arena.
sql/sql_lex.cc:
After merge fix.
LEX::spfuns/spprocs hashes were replaces with one LEX::sroutines hash.
into mysql.com:/home/dlenev/src/mysql-5.0-bg8406
mysql-test/r/sp.result:
Auto merged
mysql-test/r/trigger.result:
Auto merged
mysql-test/t/sp.test:
Auto merged
mysql-test/t/trigger.test:
Auto merged
sql/item_func.cc:
Auto merged
sql/sp.cc:
Auto merged
sql/sp_head.h:
Auto merged
sql/sql_base.cc:
Auto merged
sql/sql_lex.cc:
Auto merged
sql/sql_lex.h:
Auto merged
sql/sql_parse.cc:
Auto merged
sql/sql_trigger.cc:
Auto merged
mysql-test/r/sp-error.result:
Manual merge.
mysql-test/t/sp-error.test:
Manual merge.
sql/sp_head.cc:
Manual merge.
sql/sql_yacc.yy:
Manual merge.
crash if referencing a table" and several other related bugs.
Fix for bug #11834 "Re-execution of prepared statement with dropped function
crashes server." which was spotted during work on previous bugs.
Also couple of nice cleanups:
- Replaced two separate hashes for stored routines used by statement with one.
- Now instead of doing one pass through all routines used in statement for
caching them and then doing another pass for adding their tables to table
list, we do only one pass during which do both things.
mysql-test/r/sp-error.result:
Added test for bug #11834 "Re-execution of prepared statement with dropped
function crashes server" also covering handling of prepared statements
which use stored functions but does not require prelocking.
mysql-test/r/sp.result:
Updated test for LOCK TABLES with views in table list.
(Old version of statement used in this test will work ok now, since prelocking
algorithm was tuned and will lock only one multi-set of tables for each routine
even if this routine is used in several different views).
mysql-test/r/trigger.result:
Added several tests for triggers using tables.
mysql-test/t/sp-error.test:
Added test for bug #11834 "Re-execution of prepared statement with dropped
function crashes server" also covering handling of prepared statements
which use stored functions but does not require prelocking.
mysql-test/t/sp.test:
Updated comment about recursive views to reflect current situation.
Updated test for LOCK TABLES with views in table list.
(Old version of statement used in this test will work ok now, since prelocking
algorithm was tuned and will lock only one multi-set of tables for each routine
even if this routine is used in several different views).
mysql-test/t/trigger.test:
Added several tests for triggers using tables.
sql/item_func.cc:
Item_func_sp::cleanup():
By next statement execution stored function can be dropped or altered so
we can't assume that sp_head object for it will be still valid.
sql/sp.cc:
- Added Sroutine_hash_entry structure that represents element in the set of
stored routines used by statement or routine. We can't as before use
LEX_STRING for this purprose because we want link all elements of this set
in list.
- Replaced sp_add_to_hash() with sp_add_used_routine() which takes into account
that now we use one hash for stored routines used by statement instead of two
and which mantains list linking all elelemnts in this hash.
- Renamed sp_merge_hash() to sp_update_sp_used_routines().
- Introduced sp_update_stmt_used_routines() for adding elements to the set of
routines used by statement from another similar set for statement or routine.
This function will also mantain list linking elements of destination set.
- Now instead of one sp_cache_routines() function we have family of
sp_cache_routines_and_add_tables() functions which are also responsible for
adding tables used by routines being cached to statement table list. Nice
optimization - thanks to list linking all elements in the hash of routines
used by statement we don't need to perform several iterations over this hash
(as it was before in cases when we have added new elements to it).
sql/sp.h:
Added declarations of functions used for manipulations with set (hash) of stored
routines used by statement.
sql/sp_head.cc:
sp_name::init_qname():
Now sp_name also holds key identifying routine in the set (hash) of
stored routines used by statement.
sp_head:
Instead of two separate hashes sp_funs/m_spprocs representing sets of stored
routines used by this routine we use one hash - m_sroutines.
sp_instr_set_trigger_field:
Added support for subqueries in assignments to row accessors in triggers.
Removed definition of sp_add_sp_tables_to_table_list() and auxilary functions
since now we don't have separate stage on which we add tables used by routines
used by statement to table list for prelocking. We do it on the same stage as
we load those routines in SP cache. So all this functionality moved to
sp_cache_routines_and_add_tables() family of functions.
sql/sp_head.h:
sp_name:
Now this class also holds key identifying routine in the set (hash) of stored
routines used by statement.
sp_head:
Instead of two separate hashes sp_funs/m_spprocs representing sets of stored
routines used by this routine we use one hash - m_sroutines.
sp_instr_set_trigger_field:
Added support for subqueries in assignments to row accessors in triggers.
Removed declaration of sp_add_sp_tables_to_table_list() since now we don't have
separate stage on which we add tables used by routines used by statement to
table list for prelocking. We do it on the same stage as we load those routines
in SP cache.
sql/sql_base.cc:
open_tables():
- LEX::spfuns/spprocs hashes were replaced with one LEX::sroutines hash.
- Now instead of doing one pass through all routines used in statement for
caching them and then doing another pass for adding their tables to table
list, we do only one pass during which do both things. It is easy to do
since all routines in the set of routines used by statement are linked in
the list. This also allows us to calculate table list for prelocking more
precisely.
- Now triggers properly inform prelocking algorithm about tables they use.
sql/sql_lex.cc:
lex_start():
Replaced LEX::spfuns/spprocs with with one LEX::sroutines hash.
Added LEX::sroutines_list list linking all elements in this hash.
st_lex::st_lex():
Moved definition of LEX constructor to sql_lex.cc file to be able
use sp_sroutine_key declaration from sp.h in it.
sql/sql_lex.h:
LEX:
Replaced two separate hashes for stored routines used by statement with one.
Added list linking all elements in this hash to be able to iterate through all
elements and add new elements to this hash at the same time.
Moved constructor definition to sql_lex.cc.
sql/sql_parse.cc:
mysql_execute_command():
Replaced LEX::spfuns/spprocs with one LEX::sroutines hash.
sql/sql_trigger.cc:
Added missing GNU GPL notice.
Table_triggers_list::check_n_load()
Added initialization of sroutines_key which stores key representing
triggers of this table in the set (hash) of routines used by this statement.
sql/sql_trigger.h:
Added missing GNU GPL notice.
Table_triggers_list:
Added sroutines_key member to store key representing triggers of this
table in the set (hash) of routines used by this statement.
Declared sp_cache_routines_and_add_tables_for_triggers() as friend since
it needs access to sroutines_key and trigger bodies.
sql/sql_yacc.yy:
- Now we use sp_add_used_routine() instead of sp_add_to_hash() for adding
elements to the set of stored routines used in statement.
- Enabled support of subqueries as right sides in assignments to triggers' row
accessors.
into mysql.com:/home/jimw/my/mysql-5.0-clean
VC++Files/sql/mysqld.dsp:
Auto merged
sql/ha_federated.cc:
Auto merged
sql/sql_acl.cc:
Auto merged
sql/sql_insert.cc:
Auto merged
sql/sql_lex.cc:
Auto merged
sql/sql_lex.h:
Auto merged
sql/sql_union.cc:
Auto merged
sql/sql_yacc.yy:
Auto merged
sql/table.cc:
Auto merged
sql/item_strfunc.cc:
SCCS merged
sql/sql_lex.cc:
Auto merged
sql/sql_lex.h:
Auto merged
sql/sql_table.cc:
Auto merged
mysql-test/r/view.result:
SCCS merged
mysql-test/t/view.test:
SCCS merged
mysql-test/r/view.result:
checking views after some view with error (BUG#11337)
mysql-test/t/view.test:
checking views after some view with error (BUG#11337)
sql/sql_lex.cc:
environment cleaning up for processing view one by one
sql/sql_lex.h:
methods for lex cleunup during view processing one by one
sql/sql_table.cc:
fixed environment creation and cleaning up for processing view one by one (BUG#11337)
include/my_bitmap.h:
new bitmap operation
mysql-test/r/view.result:
added warnings
Correct inserting data check (absence of default value) for view underlying tables (BUG#6443)
mysql-test/t/view.test:
Correct inserting data check (absence of default value) for view underlying tables (BUG#6443)
mysys/my_bitmap.c:
new bitmap operation
sql/field.h:
index of field in table added
sql/item.cc:
Name resolution context added
table list removed from fix_fields() arguments
sql/item.h:
Name resolution context added
table list removed from fix_fields() arguments
sql/item_cmpfunc.cc:
table list removed from fix_fields() arguments
sql/item_cmpfunc.h:
table list removed from fix_fields() arguments
sql/item_func.cc:
table list removed from fix_fields() arguments
sql/item_func.h:
table list removed from fix_fields() arguments
sql/item_row.cc:
table list removed from fix_fields() arguments
sql/item_row.h:
table list removed from fix_fields() arguments
sql/item_strfunc.cc:
fixed server crash on NULL argument
sql/item_strfunc.h:
table list removed from fix_fields() arguments
sql/item_subselect.cc:
table list removed from fix_fields() arguments
sql/item_subselect.h:
table list removed from fix_fields() arguments
sql/item_sum.cc:
table list removed from fix_fields() arguments
sql/item_sum.h:
table list removed from fix_fields() arguments
sql/item_timefunc.cc:
table list removed from fix_fields() arguments
sql/item_timefunc.h:
table list removed from fix_fields() arguments
sql/item_uniq.h:
table list removed from fix_fields() arguments
sql/log_event.cc:
Name resolution context added
sql/log_event.h:
Name resolution context added
sql/mysql_priv.h:
Name resolution context added
sql/set_var.cc:
table list removed from fix_fields() arguments
sql/share/errmsg.txt:
new error message
sql/sp.cc:
Name resolution context added
sql/sp_head.cc:
table list removed from fix_fields() arguments
sql/sp_head.h:
Name resolution context added
sql/sql_base.cc:
table list removed from fix_fields() arguments
Name resolution context added
sql/sql_class.cc:
renamed variable
sql/sql_delete.cc:
Name resolution context added
sql/sql_derived.cc:
Name resolution context added
sql/sql_do.cc:
table list removed from fix_fields() arguments
sql/sql_handler.cc:
Name resolution context added
sql/sql_help.cc:
Name resolution context added
sql/sql_insert.cc:
Name resolution context added
table list removed from fix_fields() arguments
sql/sql_lex.cc:
Name resolution context added
sql/sql_lex.h:
removed resolve mode (information stored into name resolution context)
sql/sql_load.cc:
table list removed from fix_fields() arguments
sql/sql_olap.cc:
Name resolution context added
sql/sql_parse.cc:
Name resolution context added
sql/sql_prepare.cc:
table list removed from fix_fields() arguments
sql/sql_select.cc:
table list removed from fix_fields() arguments
sql/sql_show.cc:
Name resolution context added
sql/sql_trigger.cc:
table list removed from fix_fields() arguments
sql/sql_udf.h:
table list removed from fix_fields() arguments
sql/sql_union.cc:
Name resolution context added
sql/sql_update.cc:
Name resolution context added
sql/sql_view.cc:
Name resolution context added
sql/sql_view.h:
table list removed from fix_fields() arguments
sql/sql_yacc.yy:
Name resolution context added
sql/table.cc:
Name resolution context added
merged view processing moved
sql/table.h:
merged view processing moved
VC++Files/sql/mysqld.dsp:
Link debug server against debug yassl
sql/examples/ha_archive.cc:
Fix type for variables used to store number of rows
Add cast when reading current position
sql/examples/ha_archive.h:
Fix variables used to store rows to ha_rows
sql/ha_federated.cc:
Remove unused variables, fix type of variable used to store query id
sql/item_strfunc.cc:
Remove unused variables
sql/sql_acl.cc:
Remove unused variables
sql/sql_lex.cc:
Add casts to fix type used for counting number of rows
sql/sql_lex.h:
Fix size of options to be ulong again
sql/sql_insert.cc:
Fix type of query id value
sql/sql_union.cc:
Cast value for number of rows to ha_rows
sql/sql_yacc.yy:
Remove unused variable
sql/table.cc:
Add casts for handling key_part lengths
into mysql.com:/opt/local/work/mysql-5.0-10736
sql/sql_class.h:
Auto merged
sql/sql_lex.cc:
Auto merged
sql/sql_prepare.cc:
Auto merged
sql/sql_yacc.yy:
Auto merged
don't evaluate subqueries during statement prepare, even if they
are not correlated.
With post-review fixes.
sql/mysql_priv.h:
Add UNCACHEABLE_PREPARE to mark subqueries as non-constant in
mysql_stmt_prepare
sql/sql_lex.cc:
Add a missing assert: noone can call unit::set_limit from
mysql_stmt_prepare.
sql/sql_lex.h:
Comment fixed.
sql/sql_parse.cc:
Mark new SELECT_LEXes as uncacheable if they created during
statement prepare.
sql/sql_prepare.cc:
Switch off the uncacheable flag when prepare is done.
error for LIMIT placeholder".
The patch adds grammar support for LIMIT ?, ? and changes the
type of ST_SELECT_LEX::select_limit,offset_limit from ha_rows to Item*,
so that it can point to Item_param.
mysql-test/include/ps_modify.inc:
Fix existing tests: now LIMIT can contain placeholders.
mysql-test/include/ps_query.inc:
Fix existing tests: now LIMIT can contain placeholders.
mysql-test/r/ps.result:
Add basic test coverage for LIMIT ?, ? and fix test results.
mysql-test/r/ps_2myisam.result:
Fix test results: now LIMIT can contain placeholders.
mysql-test/r/ps_3innodb.result:
Fix test results: now LIMIT can contain placeholders.
mysql-test/r/ps_4heap.result:
Fix test results: now LIMIT can contain placeholders.
mysql-test/r/ps_5merge.result:
Fix test results: now LIMIT can contain placeholders.
mysql-test/r/ps_6bdb.result:
Fix test results: now LIMIT can contain placeholders.
mysql-test/r/ps_7ndb.result:
Fix test results: now LIMIT can contain placeholders.
mysql-test/t/ps.test:
Add basic test coverage for LIMIT ?, ?.
sql/item.h:
Add a short-cut for (ulonglong) val_int() to Item.
Add a constructor to Item_int() that accepts ulonglong.
Simplify Item_uint constructor by using the c-tor above.
sql/item_subselect.cc:
Now select_limit has type Item *.
We can safely create an Item in Item_exists_subselect::fix_length_and_dec():
it will be allocated in runtime memory root and freed in the end of
execution.
sql/sp_head.cc:
Add a special initalization state for stored procedures to
be able to easily distinguish the first execution of a stored procedure
from prepared statement prepare.
sql/sql_class.h:
Introduce new state 'INITIALIZED_FOR_SP' to be able to easily distinguish
the first execution of a stored procedure from prepared statement prepare.
sql/sql_derived.cc:
- use unit->set_limit() to set unit->select_limit_cnt, offset_limit_cnt
evreryplace. Add a warning about use of set_limit in
mysql_derived_filling.
sql/sql_error.cc:
- use unit->set_limit() to set unit->select_limit_cnt, offset_limit_cnt
evreryplace.
- this change is also aware of bug#11095 "show warnings limit 0 returns
all rows instead of zero rows", so the one who merges the bugfix from
4.1 can use local version of sql_error.cc.
sql/sql_handler.cc:
- use unit->set_limit() to initalize
unit->select_limit_cnt,offset_limit_cnt everyplace.
sql/sql_lex.cc:
Now ST_SELECT_LEX::select_limit, offset_limit have type Item *
sql/sql_lex.h:
Now ST_SELECT_LEX::select_limit, offset_limit have type Item *
sql/sql_parse.cc:
- use unit->set_limit() to initalize
unit->select_limit_cnt,offset_limit_cnt everyplace.
- we can create an Item_int to set global limit of a statement:
it will be created in the runtime mem root and freed in the end of
execution.
sql/sql_repl.cc:
Use unit->set_limit to initialize limits.
sql/sql_select.cc:
- select_limit is now Item* so the proper way to check for default value
is to compare it with NULL.
sql/sql_union.cc:
Evaluate offset_limit_cnt using the new type of ST_SELECT_LEX::offset_limit
sql/sql_view.cc:
Now ST_SELECT_LEX::select_limit, offset_limit have type Item *
sql/sql_yacc.yy:
Add grammar support for LIMIT ?, ? clause.
into mysql.com:/opt/local/work/mysql-5.0-7306-new
sql/item_subselect.cc:
Auto merged
sql/mysql_priv.h:
Auto merged
sql/opt_range.cc:
Auto merged
sql/sql_base.cc:
Auto merged
sql/sql_insert.cc:
Auto merged
sql/sql_lex.cc:
Auto merged
sql/sql_lex.h:
Auto merged
sql/sql_olap.cc:
Auto merged
sql/sql_parse.cc:
Auto merged
sql/sql_select.cc:
Auto merged
"the server side preparedStatement error for LIMIT placeholder",
which moves all uses of LIMIT clause from PREPARE to OPTIMIZE
and later steps.
After-review fixes.
mysql-test/r/group_min_max.result:
Test results fixed for EXPLAINs when using GROUP_MIN_MAX access plan.
sql/item_subselect.cc:
Move setting of the internal LIMIT used for IN/ALL/ANY/EXISTS
subqueries to one place: Item_exists_subselect::fix_length_and_dec().
This implies that unit->select_limit_cnt is not set until the item is
fixed. This is OK, as now LIMIT values are not used until JOIN::optimize.
sql/mysql_priv.h:
setup_tables no longer needs a special flag for the case when
it's called from JOIN::reinit() (we don't need to call setup_tables
between two executions of a correlated subquery).
sql/opt_range.cc:
Fix a glitch in GROUP_MIN_MAX access plan: we should use table metadata,
not field data, to evaluate max_used_key_length, which is then
used for explain.
sql/sp.cc:
- setup_tables signature changed.
sql/sql_base.cc:
- setup_tables no longer needs a special mode for subqueries.
Unused checks were removed.
sql/sql_delete.cc:
- setup_tables signature changed
sql/sql_help.cc:
- setup_tables signature changed
sql/sql_insert.cc:
- setup_tables signature changed
sql/sql_lex.cc:
Consolidate setting of internal LIMIT for IN/ALL/ANY/EXISTS subqeries
in one place, and hence remove it from st_select_lex::test_limit().
sql/sql_lex.h:
Cleanup signature of st_select_lex_unit::init_prepare_fake_select_lex().
sql/sql_load.cc:
- setup_tables signature changed
sql/sql_olap.cc:
- setup_tables signature changed
sql/sql_parse.cc:
- st_select_lex_unit::set_limit() signature changed
sql/sql_select.cc:
Move setting of JOIN::select_limit from JOIN::prepare
to JOIN::optimize. At prepare, limit is unknown yet.
Remove excessive cleanups from JOIN::reinit which were overwriting
join->join_tab[i]->table->used_keys. This fixes the bug which was triggered
by the change in item_subselect.cc.
sql/sql_union.cc:
Class st_select_lex_unit was changed to avoid calls to
st_select_lex_unit::set_limit from places where it may be unknown.
Now unit->select_limit_cnt is set at ::exec().
st_select_lex_unit::init_prepare_fake_select_lex():
- move out set_limit functionality
- remove a few lines of dead code.
st_select_lex_unit::prepare():
- now we don't call set_limit at the time of prepare, so the value
of unit->select_limit_cnt may be unknown here. Use sl->select_limit
instead.
st_select_lex_unit::exec():
- cleanup
- call set_limit explicitly as it has been moved out of
init_prepare_fake_select_lex.
sql/sql_update.cc:
- setup_tables signature changed
BitKeeper/deleted/.del-ha_isam.cc~4dce65904db2675e:
Auto merged
BitKeeper/deleted/.del-ha_isammrg.cc~dc682e4755d77a2e:
Auto merged
client/sql_string.cc:
Auto merged
client/sql_string.h:
Auto merged
include/my_global.h:
Auto merged
include/my_sys.h:
Auto merged
mysql-test/mysql-test-run.sh:
Auto merged
mysys/my_open.c:
Auto merged
mysys/raid.cc:
Auto merged
ndb/src/kernel/blocks/dbtux/Dbtux.hpp:
Auto merged
sql/field.cc:
Auto merged
sql/ha_berkeley.cc:
Auto merged
sql/ha_blackhole.cc:
Auto merged
sql/ha_heap.cc:
Auto merged
sql/ha_innodb.cc:
Auto merged
sql/ha_myisam.cc:
Auto merged
sql/ha_myisammrg.cc:
Auto merged
sql/ha_ndbcluster.cc:
Auto merged
sql/handler.cc:
Auto merged
sql/item.cc:
Auto merged
sql/item_cmpfunc.cc:
Auto merged
sql/item_func.cc:
Auto merged
sql/item_geofunc.cc:
Auto merged
sql/item_strfunc.cc:
Auto merged
sql/item_subselect.cc:
Auto merged
sql/item_sum.cc:
Auto merged
sql/item_timefunc.cc:
Auto merged
sql/item_uniq.cc:
Auto merged
sql/item_uniq.h:
Auto merged
sql/log_event.cc:
Auto merged
sql/log_event.h:
Auto merged
sql/procedure.cc:
Auto merged
sql/protocol.cc:
Auto merged
sql/protocol_cursor.cc:
Auto merged
sql/set_var.cc:
Auto merged
sql/sql_analyse.cc:
Auto merged
sql/sql_analyse.h:
Auto merged
sql/sql_lex.cc:
Auto merged
sql/sql_map.cc:
Auto merged
sql/sql_olap.cc:
Auto merged
sql/sql_string.cc:
Auto merged
sql/sql_udf.cc:
Auto merged
sql/tztime.cc:
Auto merged
sql/opt_range.cc:
Manual merge
sql/sql_parse.cc:
Use select_lex pointer instead of lex->select_lex
sql/sql_repl.cc:
Function moved to log.cc, fix made there instead
sql/sql_class.cc:
Auto merged
sql/sql_select.cc:
Auto merged
Faster detection of wrong table names (like PRN) on windows
include/my_sys.h:
Added check_if_legal_filename()
mysys/my_access.c:
Added check_if_legal_filename()
Set errno if my_access() fails
mysys/my_fopen.c:
USe check_if_legal_filename() instead of my_access() to detect wrong file names on windows
mysys/my_open.c:
USe check_if_legal_filename() instead of my_access() to detect wrong file names on windows
sql/sql_lex.cc:
Portability fix
sql/sql_parse.cc:
Simple cleanup
sql/sql_repl.cc:
Cleanup during code review
Added BUILD scripts for icc
Fixed (one time) memory leak in grant handling
config/ac-macros/misc.m4:
Remove warnings flags from icc when compiling with -Werror
configure.in:
Remove warnings flags from icc when compiling with -Werror
extra/replace.c:
Fix warnings from icc
include/my_dbug.h:
Fix warnings from icc
sql/gen_lex_hash.cc:
Fix warnings from icc
sql/mysql_priv.h:
Add missing variables
sql/mysqld.cc:
Fix warnings from icc:
- made a lot of variables static
- Removing some not used variables
- Fixed wrong printf()
- removed extern "C" from some functions
sql/spatial.h:
Fix warnings from icc
sql/sql_acl.cc:
Fixed memory leak
sql/sql_lex.cc:
Fix warnings from icc
sql/sql_lex.h:
Fix warnings from icc