An error occurred fetching the project authors.
- 08 Aug, 2006 1 commit
-
-
unknown authored
Correct memory leak fix sql/unireg.h: Correct memory leak fix sql/table.cc: Correct memory leak fix sql/sql_view.h: Correct memory leak fix sql/sql_view.cc: Correct memory leak fix sql/sql_lex.h: Correct memory leak fix sql/sql_base.cc: Correct memory leak fix
-
- 31 Jul, 2006 1 commit
-
-
unknown authored
When executing ALTER TABLE all the attributes of the view were overwritten. This is contrary to the user's expectations. So some of the view attributes are preserved now : namely security and algorithm. This means that if they are not specified in ALTER VIEW their values are preserved from CREATE VIEW instead of being defaulted. mysql-test/r/view.result: Bug #21080: ALTER VIEW makes user restate SQL SECURITY mode, and ALGORITHM - test suite mysql-test/t/view.test: Bug #21080: ALTER VIEW makes user restate SQL SECURITY mode, and ALGORITHM - test suite sql/sql_lex.h: Bug #21080: ALTER VIEW makes user restate SQL SECURITY mode, and ALGORITHM - must make create_view_suid a tristate : on/off/unspecified sql/sql_view.cc: Bug #21080: ALTER VIEW makes user restate SQL SECURITY mode, and ALGORITHM - open the view to get it's attributes and put then as defaults for ALTER VIEW sql/sql_yacc.yy: Bug #21080: ALTER VIEW makes user restate SQL SECURITY mode, and ALGORITHM - must make create_view_suid a tristate : on/off/unspecified sql/table.h: Bug #21080: ALTER VIEW makes user restate SQL SECURITY mode, and ALGORITHM - must make create_view_suid a tristate : on/off/unspecified
-
- 27 Jul, 2006 1 commit
-
-
unknown authored
can be not replicable. Now CREATE statements for writing in the binlog are created as follows: - the beginning of the statement is re-created; - the rest of the statement is copied from the original query. The problem appears when there is a version-specific comment (produced by mysqldump), started in the re-created part of the statement and closed in the copied part -- there is closing comment-parenthesis, but there is no opening one. The proper fix could be to re-create original statement, but we can not implement it in 5.0. So, for 5.0 the fix is just to cut closing comment-parenthesis. This technique is also used for SHOW CREATE PROCEDURE statement (so we are able to reuse existing code). mysql-test/r/rpl_sp.result: Updated result file. mysql-test/r/rpl_trigger.result: Updated result file. mysql-test/r/rpl_view.result: Updated result file. mysql-test/t/rpl_sp.test: Added test case for BUG#20438. mysql-test/t/rpl_trigger.test: Added test case for BUG#20438. mysql-test/t/rpl_view.test: Added test case for BUG#20438. sql/sp.cc: Trim comments at the end. sql/sp_head.cc: Moved this code to the separate function to be re-used. sql/sql_lex.cc: Added a new function. sql/sql_lex.h: Added a new function. sql/sql_trigger.cc: Trim comments at the end. sql/sql_view.cc: Trim comments at the end.
-
- 03 Jul, 2006 1 commit
-
-
unknown authored
-
- 30 Jun, 2006 1 commit
-
-
unknown authored
sql/sql_lex.cc: Remove an unused thread key. sql/sql_lex.h: Remove an unused thread key, current_lex. sql/sql_parse.cc: Remove an unused thread key, current_lex macro.
-
- 27 Jun, 2006 1 commit
-
-
unknown authored
The problem was that we restored SQL_CACHE, SQL_NO_CACHE flags in SELECT statement from internal structures based on value set later at runtime, not the original value set by the user. The solution is to remember that original value. mysql-test/r/auto_increment.result: Update result to not report SQL_NO_CACHE if it wasn't there at first place. mysql-test/r/func_compress.result: Update result to not report SQL_NO_CACHE if it wasn't there at first place. mysql-test/r/func_math.result: Update result to not report SQL_NO_CACHE if it wasn't there at first place. mysql-test/r/func_system.result: Update result to not report SQL_NO_CACHE if it wasn't there at first place. mysql-test/r/func_time.result: Update result to not report SQL_NO_CACHE if it wasn't there at first place. mysql-test/r/information_schema.result: Update result to not report SQL_NO_CACHE if it wasn't there at first place. mysql-test/r/query_cache.result: Update result to not report SQL_NO_CACHE if it wasn't there at first place. mysql-test/r/rpl_get_lock.result: Update result to not report SQL_NO_CACHE if it wasn't there at first place. mysql-test/r/rpl_master_pos_wait.result: Update result to not report SQL_NO_CACHE if it wasn't there at first place. mysql-test/r/show_check.result: Add result for bug#17203. mysql-test/r/subselect.result: Update result to not report SQL_NO_CACHE if it wasn't there at first place. mysql-test/r/type_blob.result: Update result to not report SQL_NO_CACHE if it wasn't there at first place. mysql-test/r/variables.result: Update result to not report SQL_NO_CACHE if it wasn't there at first place. mysql-test/r/view.result: Update result to not report SQL_NO_CACHE if it wasn't there at first place. mysql-test/t/show_check.test: Add test case for bug#17203. sql/sql_lex.cc: Reset SELECT_LEX::sql_cache together with SELECT_LEX::options. sql/sql_lex.h: Add SELECT_LEX::sql_cache field to store original user setting. sql/sql_select.cc: Output SQL_CACHE and SQL_NO_CACHE depending on stored original user setting. sql/sql_yacc.yy: Make effect of SQL_CACHE and SQL_NO_CACHE mutually exclusive. Ignore SQL_CACHE if SQL_NO_CACHE was used. Remember what was set by the user. Reset SELECT_LEX::sql_cache together with SELECT_LEX::options.
-
- 26 Jun, 2006 1 commit
-
-
unknown authored
Bug#19022 "Memory bug when switching db during trigger execution" Bug#17199 "Problem when view calls function from another database." Bug#18444 "Fully qualified stored function names don't work correctly in SELECT statements" Documentation note: this patch introduces a change in behaviour of prepared statements. This patch adds a few new invariants with regard to how THD::db should be used. These invariants should be preserved in future: - one should never refer to THD::db by pointer and always make a deep copy (strmake, strdup) - one should never compare two databases by pointer, but use strncmp or my_strncasecmp - TABLE_LIST object table->db should be always initialized in the parser or by creator of the object. For prepared statements it means that if the current database is changed after a statement is prepared, the database that was current at prepare remains active. This also means that you can not prepare a statement that implicitly refers to the current database if the latter is not set. This is not documented, and therefore needs documentation. This is NOT a change in behavior for almost all SQL statements except: - ALTER TABLE t1 RENAME t2 - OPTIMIZE TABLE t1 - ANALYZE TABLE t1 - TRUNCATE TABLE t1 -- until this patch t1 or t2 could be evaluated at the first execution of prepared statement. CURRENT_DATABASE() still works OK and is evaluated at every execution of prepared statement. Note, that in stored routines this is not an issue as the default database is the database of the stored procedure and "use" statement is prohibited in stored routines. This patch makes obsolete the use of check_db_used (it was never used in the old code too) and all other places that check for table->db and assign it from THD::db if it's NULL, except the parser. How this patch was created: THD::{db,db_length} were replaced with a LEX_STRING, THD::db. All the places that refer to THD::{db,db_length} were manually checked and: - if the place uses thd->db by pointer, it was fixed to make a deep copy - if a place compared two db pointers, it was fixed to compare them by value (via strcmp/my_strcasecmp, whatever was approproate) Then this intermediate patch was used to write a smaller patch that does the same thing but without a rename. TODO in 5.1: - remove check_db_used - deploy THD::set_db in mysql_change_db See also comments to individual files. mysql-test/r/create.result: Modify the result file: a database can never be NULL. mysql-test/r/ps.result: Update test results (Bug#17199 et al) mysql-test/r/sp.result: Update test results (Bug#17199 et al) mysql-test/t/create.test: Update the id of the returned error. mysql-test/t/ps.test: Add test coverage for prepared statements and current database. In scope of work on Bug#17199 "Problem when view calls function from another database." mysql-test/t/sp.test: Add a test case for Bug#17199 "Problem when view calls function from another database." and Bug#18444 "Fully qualified stored function names don't work correctly in SELECT statements". Test a complementary problem. sql/item_strfunc.cc: Touch the code that reads thd->db (cleanup). sql/log_event.cc: While we are at it, replace direct access to thd->db with a method. Should simplify future conversion of THD::db to LEX_STRING. sql/slave.cc: While we are at it, replace direct access to thd->db with a method. Should simplify future conversion of THD::db to LEX_STRING. sql/slave.h: Remove a declaration for a method that is used only in one module. sql/sp.cc: Rewrite sp_use_new_db: this is a cleanup that I needed in order to understand this function and ensure that it has no bugs. sql/sp.h: Add a new declaration for sp_use_new_db (uses LEX_STRINGs) and a comment. sql/sp_head.cc: - drop sp_name_current_db_new - a creator of sp_name class that was used when sp_name was created for an identifier without an explicitly initialized database. Now we pass thd->db to constructor of sp_name right in the parser. - rewrite sp_head::init_strings: name->m_db is always set now - use the new variant of sp_use_new_db - we don't need to update thd->db with SP MEM_ROOT pointer anymore when parsing a stored procedure, as noone will refer to it (yes!) sql/sp_head.h: - remove unneded methods and members sql/sql_class.h: - introduce 3 THD methods to work with THD::db: .set_db to assign the current database .reset_db to reset the current database (temporarily) or set it to NULL .opt_copy_db_to - to deep-copy thd->db to a pointer if it's not NULL sql/sql_db.cc: While we are at it, replace direct access to thd->db with a method. Should simplify future conversion of THD::db to LEX_STRING. sql/sql_insert.cc: - replace checks with asserts: table_list->db must be always set in the parser. sql/sql_lex.h: - add a comment sql/sql_parse.cc: - implement the invariant described in the changeset comment. - remove juggling with lex->sphead in SQLCOM_CREATE_PROCEDURE: now db_load_routine uses its own LEX object and doesn't damage the main LEX. - add DBUG_ASSERT(0) to unused "check_db_used" sql/sql_table.cc: - replace a check with an assert (table_ident->db) sql/sql_trigger.cc: While we are at it, replace direct access to thd->db with a method. Should simplify future conversion of THD::db to LEX_STRING. sql/sql_udf.cc: - use thd->set_db instead of direct modification of to thd->db sql/sql_view.cc: - replace a check with an assert (view->db) sql/sql_yacc.yy: - make sure that we always copy table->db or name->db or ident->db or select_lex->db from thd->db if the former is not set. If thd->db is not set but is accessed, return an error. sql/tztime.cc: - be nice, never copy thd->db by pointer.
-
- 07 Jun, 2006 1 commit
-
-
unknown authored
The st_lex::which_check_option_applicable() function controls for which statements WITH CHECK OPTION clause should be taken into account. REPLACE and REPLACE_SELECT wasn't in the list which results in allowing REPLACE to insert wrong rows in a such view. The st_lex::which_check_option_applicable() now includes REPLACE and REPLACE_SELECT in the list of statements for which WITH CHECK OPTION clause is applicable. mysql-test/t/replace.test: Added test case for bug#19789: REPLACE was allowed for a VIEW with CHECK OPTION enabled. mysql-test/r/replace.result: Added test case for bug#19789: REPLACE was allowed for a VIEW with CHECK OPTION enabled. sql/sql_lex.h: Fixed bug#19789: REPLACE was allowed for a VIEW with CHECK OPTION enabled. The st_lex::which_check_option_applicable() now includes REPLACE and REPLACE_SELECT in the list of statements for which WITH CHECK OPTION clause is applicable.
-
- 30 May, 2006 1 commit
-
-
unknown authored
Bug#18282 "INFORMATION_SCHEMA.TABLES provides inconsistent info about invalid views" This bug caused crashes or resulted in wrong data being returned when one tried to obtain information from I_S tables about views using stored functions. It was caused by the fact that we were using LEX representing statement which were doing select from I_S tables as active LEX when contents of I_S table were built. So state of this LEX both affected and was affected by open_tables() calls which happened during this process. This resulted in wrong behavior and in violations of some of invariants which caused crashes. This fix tries to solve this problem by properly saving/resetting and restoring part of LEX which affects and is affected by the process of opening tables and views in get_all_tables() routine. To simplify things we separated this part of LEX in a new class and made LEX its descendant. mysql-test/r/information_schema_db.result: test case mysql-test/t/information_schema_db.test: test case sql/sql_lex.cc: To simplify saving/resetting and restoring part of LEX which affects and is affected by the process of opening tables and views we moved it to new class Query_tables_list and made LEX descendant of this class. Also introduced two LEX methods which can be used to save and reset or to restore this state. sql/sql_lex.h: To simplify saving/resetting and restoring part of LEX which affects and is affected by the process of opening tables and views we moved it to new class Query_tables_list and made LEX descendant of this class. Also introduced two LEX methods which can be used to save and reset or to restore this state. sql/sql_show.cc: Now in get_all_tables() routine we properly save/reset and restore part of LEX (statement table list and information about routines used) which affects and is affected by the process of opening tables and views. sql/sql_table.cc: Now we clean-up LEX after opening table (view) in two stages. In the first stage we call LEX::cleanup_after_one_table_open() to clean-up selects lists and derived tables state. In the second stage which happens after close_thread_tables() is invoked we call Query_tables_list::reset_query_tables_list(FALSE) to rollback changes in Query_tables_list.
-
- 07 May, 2006 1 commit
-
-
unknown authored
A query with a group by and having clauses could return a wrong result set if the having condition contained a constant conjunct evaluated to FALSE. It happened because the pushdown condition for table with grouping columns lost its constant conjuncts. Pushdown conditions are always built by the function make_cond_for_table that ignores constant conjuncts. This is apparently not correct when constant false conjuncts are present. mysql-test/r/having.result: Added a test case for bug #14927. mysql-test/t/having.test: Added a test case for bug #14927. sql/sql_lex.cc: Fixed bug #14927. Initialized fields for having conditions in st_select_lex::init_query(). sql/sql_lex.h: Fixed bug #14927. Added a field to restore having condititions for execution in SP and PS. sql/sql_prepare.cc: Fixed bug #14927. Added code to restore havinf conditions for execution in SP and PS. sql/sql_select.cc: Fixed bug #14927. Performed evaluation of constant expressions in having clauses. If the having condition contains a constant conjunct that is always false an empty result set is returned after the optimization phase. In this case the corresponding EXPLAIN command now returns "Impossible HAVING" in the last column.
-
- 21 Apr, 2006 1 commit
-
-
unknown authored
The bug caused wrong result sets for union constructs of the form (SELECT ... ORDER BY order_list1 [LIMIT n]) ORDER BY order_list2. For such queries order lists were concatenated and limit clause was completely neglected. mysql-test/r/order_by.result: Added a test case for bug #18767. mysql-test/t/order_by.test: Added a test case for bug #18767. sql/sql_lex.h: Fixed bug #18767. Placed the code the created a fake SELECT_LEX into a separate function. sql/sql_parse.cc: Fixed bug #18767. Placed the code the created a fake SELECT_LEX into a separate function. sql/sql_select.cc: Fixed bug #18767. Changed the condition on which a SELECT is treated as part of a UNION. The SELECT in (SELECT ... ORDER BY order_list1 [LIMIT n]) ORDER BY order_list2 now is handled in the same way as the first SELECT in a UNION sequence. sql/sql_union.cc: Fixed bug #18767. Changed the condition at which a SELECT is treated as part of a UNION. The SELECT in (SELECT ... ORDER BY order_list1 [LIMIT n]) ORDER BY order_list2 now is handled in the same way as the first SELECT in a UNION sequence. sql/sql_yacc.yy: Fixed bug #18767. Changed the condition at which a SELECT is treated as part of a UNION. The SELECT in (SELECT ... ORDER BY order_list1 [LIMIT n]) ORDER BY order_list2 now is handled in the same way as the first SELECT in a UNION sequence. In the same way is handled the SELECT in (SELECT ... LIMIT n) ORDER BY order list. Yet if there is neither ORDER BY nor LIMIT in the single-select union construct (SELECT ...) ORDER BY order_list then it is still handled as simple select with an order clause.
-
- 10 Mar, 2006 1 commit
-
-
unknown authored
This patch does 1) fix my build breakage 2) Complete the removal of all symbols which could clash with another parser. sql/mysql_priv.h: Porting update sql/mysqld.cc: Porting update sql/sp.cc: Porting update sql/sql_lex.cc: Porting update sql/sql_lex.h: Porting update sql/sql_parse.cc: Porting update sql/sql_prepare.cc: Portinng update sql/sql_trigger.cc: Porting update sql/sql_view.cc: Porting update
-
- 09 Mar, 2006 1 commit
-
-
unknown authored
Makes you wonder what I am up to, doesn't? configure.in: Adjusts bison to not create symbols that clash. sql/sql_analyse.cc: Adding define to make sure sql_yacc.h gets included. sql/sql_lex.cc: Fixing it so that sql_yacc.h is included sql/sql_lex.h: Fixing include rules sql/sql_parse.cc: Adding flag to compile sql_yacc.yy
-
- 02 Mar, 2006 1 commit
-
-
unknown authored
The idea is to add DEFINER-clause in CREATE PROCEDURE and CREATE FUNCTION statements. Almost all support of definer in stored routines had been already done before this patch. NOTE: this patch changes behaviour of dumping stored routines in mysqldump. Before this patch, mysqldump did not dump DEFINER-clause for stored routines and this was documented behaviour. In order to get full information about stored routines, one should have dumped mysql.proc table. This patch changes this behaviour, so that DEFINER-clause is dumped. Since DEFINER-clause is not supported in CREATE PROCEDURE | FUNCTION statements before this patch, the clause is covered by additional version-specific comments. client/mysqldump.c: Updated the code for dumping stored routines: cover DEFINER-clause into version-specific comment. mysql-test/r/gis.result: Updated result file after adding DEFINER-clause. mysql-test/r/information_schema.result: Updated result file after adding DEFINER-clause. mysql-test/r/mysqldump.result: Updated result file after adding DEFINER-clause. mysql-test/r/rpl_ddl.result: Updated result file after adding DEFINER-clause. mysql-test/r/rpl_sp.result: Updated result file after adding DEFINER-clause. mysql-test/r/rpl_trigger.result: Updated result file after adding DEFINER-clause. mysql-test/r/sp-security.result: Updated result file after adding DEFINER-clause. mysql-test/r/sp.result: Updated result file after adding DEFINER-clause. mysql-test/r/sql_mode.result: Updated result file after adding DEFINER-clause. mysql-test/t/sp-security.test: Updated result file after adding DEFINER-clause. sql/sp.cc: Added DEFINER-clause. sql/sp_head.cc: Added a new convenient variant of set_definer() operation. sql/sp_head.h: Updated result file after adding DEFINER-clause. sql/sql_lex.h: Renamed trigger_definition_begin into stmt_definition_begin to be used for triggers and stored routines. sql/sql_parse.cc: Check DEFINER-clause. sql/sql_trigger.cc: Renamed trigger_definition_begin into stmt_definition_begin to be used for triggers and stored routines. sql/sql_yacc.yy: Added DEFINER-clause.
-
- 01 Feb, 2006 1 commit
-
-
unknown authored
A query with a group by and having clauses could return a wrong result set if the having condition contained a constant conjunct evaluated to FALSE. It happened because the pushdown condition for table with grouping columns lost its constant conjuncts. Pushdown conditions are always built by the function make_cond_for_table that ignores constant conjuncts. This is apparently not correct when constant false conjuncts are present. mysql-test/r/having.result: Added A test case for bug #14927. mysql-test/t/having.test: Added A test case for bug #14927. sql/sql_lex.cc: Fixed bug #14927. Initialized fields for having conditions in st_select_lex::init_query(). sql/sql_lex.h: Fixed bug #14927. Added a field to restore having condititions for execution in SP and PS. sql/sql_prepare.cc: Fixed bug #14927. Added code to restore havinf conditions for execution in SP and PS. sql/sql_select.cc: Fixed bug #14927. Performed evaluation of constant expressions in having clauses. If the having condition contains a constant conjunct that is always false an empty result set is returned after the optimization phase. In this case the corresponding EXPLAIN command now returns "Impossible HAVING" in the last column.
-
- 02 Dec, 2005 1 commit
-
-
unknown authored
of SELECT from query begining, to be independet of query buffer allocation. Correct procedure used to find beginning of the current statement during parsing (BUG#14885). mysql-test/r/view.result: BUG#14885 test suite. mysql-test/t/view.test: BUG#14885 test suite. sql/sp_head.cc: The debug print statement fixed to prevent crash in case of NULL in m_next_cached_sp. sql/sql_lex.h: Now we shall store only position (index of first character) of SELECT from query beginning. sql/sql_view.cc: Position of the SELECT used to output it to .frm. sql/sql_yacc.yy: Now we shall store only position (index of first character) of SELECT from query beginning. Correct procedure used to find beginning of the current statement during parsing.
-
- 28 Nov, 2005 1 commit
-
-
unknown authored
Post-review fixes according to Monty's review. sql/item.h: Unite all code that stores and restores the state of a name resolution context into a class to represent the state, and methods to save/restore that state. sql/mysql_priv.h: Reorder parameters so that length is after the name of a field, and database is before table name. sql/sql_acl.cc: Reorder parameters so that length is after the name of a field, and database is before table name. sql/sql_base.cc: * Reorder parameters so that length is after the name of a field, and database is before table name. * Added new method - Field_iterator_table_ref::get_natural_column_ref to avoid unnecessary code when it is knwon that no new columns will be created when accessing natural join columns. sql/sql_insert.cc: Unite all code that stores and restores the state of a name resolution context into a class to represent the state, and methods to save/restore that state. sql/sql_lex.cc: Removed obsolete comment. sql/sql_lex.h: Return error from push_contex() if there is no memory. sql/sql_list.h: Extended base_list_iterator, List_iterator, and List_iterator_fast with an empty constructor, and init() methods, so that one doesn't have to construct a new iterator object every time one needs to iterate over a new list. sql/sql_parse.cc: Moved common functionality from the parser into one function, and renamed the function to better reflect what it does. sql/sql_yacc.yy: Moved common functionality from the parser into one function, and renamed the function to better reflect what it does. sql/table.cc: * Extended base_list_iterator, List_iterator, and List_iterator_fast with an empty constructor, and init() methods, so that one doesn't have to construct a new iterator object every time one needs to iterate over a new list. * Added new method Field_iterator_table_ref::get_natural_column_ref to be used in cases when it is known for sure that no new columns should be created. sql/table.h: - column_ref_it no longer allocated for each new list of columns - new method get_natural_join_column for faster/simpler access to natural join columns.
-
- 17 Nov, 2005 1 commit
-
-
unknown authored
Since long, the compiled code of stored routines has been printed in the trace file when starting mysqld with the "--debug" flag. (At creation time only, and only in debug builds of course.) This has been helpful when debugging stored procedure execution, but it's a bit awkward to use. Also, the printing of some of the instructions is a bit terse, in particular for sp_instr_stmt where only the command code was printed. This improves the printout of several of the instructions, and adds the debugging- only commands "show procedure code <name>" and "show function code <name>". (In non-debug builds they are not available.) sql/lex.h: New symbol for debug-only command (e.g. show procedure code). sql/sp_head.cc: Fixed some minor debug-mode bugs in show_create_*(). New method for debugging: sp_head::show_routine_code() - returns the "assembly code" for a stored routine as a result set. Improved the print() methods for many sp_instr* classes, particularly for sp_instr_stmt where the query string is printed as well (up to a max length, just to give a hint of which statement it is). Also print the names of variables and cursors in some instruction. sql/sp_head.h: New debugging-only method in sp_head: show_routine_code(). Added offset member to sp_instr_cpush for improved debug printing. sql/sp_pcontext.cc: Moved find_pvar(uint i) method from sp_pcontext.h, and made it work for all frames, not just the first one. (For debugging purposes) Added a similar find_cursor(uint i, ...) method, for debugging. sql/sp_pcontext.h: Moved find_pvar(uint i) method to sp_pcontext.cc. Added a similar find_cursor(uint i, ...) method, for debugging. sql/sql_lex.h: Added new sql_command codes for debugging. sql/sql_parse.cc: Added new commands for debugging, e.g. "show procedure code". sql/sql_yacc.yy: Added new commands for debugging purposes: "show procedure code ..." and "show function code ...". These are only enabled in debug builds, otherwise they result in a syntax error. (I.e. they don't exist)
-
- 10 Nov, 2005 1 commit
-
-
unknown authored
checks on trigger activation) mysql-test/r/information_schema.result: Update result file: a new column DEFINER has been added to INFORMATION_SCHEMA.TRIGGERS. mysql-test/r/mysqldump.result: Update result file: a new column DEFINER has been added to INFORMATION_SCHEMA.TRIGGERS. mysql-test/r/rpl_ddl.result: Update result file: a new column DEFINER has been added to INFORMATION_SCHEMA.TRIGGERS. mysql-test/r/rpl_sp.result: Update result file: a new clause DEFINER has been added to CREATE TRIGGER statement. mysql-test/r/rpl_trigger.result: Results for new test cases were added. mysql-test/r/skip_grants.result: Error message has been changed. mysql-test/r/trigger.result: Added DEFINER column. mysql-test/r/view.result: Error messages have been changed. mysql-test/r/view_grant.result: Error messages have been changed. mysql-test/t/mysqldump.test: Drop created procedure to not affect further tests. mysql-test/t/rpl_trigger.test: Add tests for new column in information schema. mysql-test/t/skip_grants.test: Error tag has been renamed. mysql-test/t/view.test: Error tag has been renamed. mysql-test/t/view_grant.test: Error tag has been changed. sql/item_func.cc: Fix typo in comments. sql/mysql_priv.h: A try to minimize copy&paste: - introduce operations to be used from sql_yacc.yy; - introduce an operation to be used from trigger and view processing code. sql/share/errmsg.txt: - Rename ER_NO_VIEW_USER to ER_MALFORMED_DEFINER in order to be shared for view and trigger implementations; - Fix a typo; - Add a new error code for trigger warning. sql/sp.cc: set_info() was split into set_info() and set_definer(). sql/sp_head.cc: set_info() was split into set_info() and set_definer(). sql/sp_head.h: set_info() was split into set_info() and set_definer(). sql/sql_acl.cc: Add a new check: exit from the cycle if the table is NULL. sql/sql_lex.h: - Rename create_view_definer to definer, since it is used for views and triggers; - Change st_lex_user to LEX_USER, since st_lex_user is a structure. So, formally, it should be "struct st_lex_user", which is longer than just LEX_USER; - Add trigger_definition_begin. sql/sql_parse.cc: - Add a new check: exit from the cycle if the table is NULL; - Implement definer-related functions. sql/sql_show.cc: Add DEFINER column. sql/sql_trigger.cc: Add DEFINER support for triggers. sql/sql_trigger.h: Add DEFINER support for triggers. sql/sql_view.cc: Rename create_view_definer to definer. sql/sql_yacc.yy: Add support for DEFINER-clause in CREATE TRIGGER statement. Since CREATE TRIGGER and CREATE VIEW can be similar at the start, yacc is unable to distinguish between them. So, had to modify both statements in order to make it parsable by yacc. mysql-test/r/trigger-compat.result: Result file for triggers backward compatibility test. mysql-test/r/trigger-grant.result: Result file of the test for WL#2818. mysql-test/t/trigger-compat.test: Triggers backward compatibility test: check that the server still can load triggers w/o definer attribute and modify tables with such triggers (add a new trigger, etc). mysql-test/t/trigger-grant.test: Test for WL#2818 -- check that DEFINER support in triggers works properly
-
- 01 Nov, 2005 1 commit
-
-
unknown authored
Fix for bug #14536: SELECT @A,@A:=... fails with prepared statements mysql-test/r/func_sapdb.result: Correct tests after reverting patch for BUG #14009 (use of abs() on null value causes problems with filesort) mysql-test/r/type_newdecimal.result: Correct tests after reverting patch for BUG #14009 (use of abs() on null value causes problems with filesort) mysql-test/r/user_var.result: More test with SELECT @A:= mysql-test/t/disabled.def: Enable user_var.test for mysql-test/t/user_var.test: More test with SELECT @A:= sql/item.cc: Simple optimization during review of new code sql/item_func.cc: Reverting patch for BUG #14009 (use of abs() on null value causes problems with filesort) sql/item_timefunc.h: timediff() can return NULL for not NULL arguments sql/sql_base.cc: Remove usage of current_thd() in mysql_make_view() sql/sql_lex.h: Remove usage of current_thd() in mysql_make_view() sql/sql_select.cc: Fix for bug #14536: SELECT @A,@A:=... fails with prepared statements sql/sql_view.cc: Remove usage of current_thd() in mysql_make_view() Simple optimization of new code sql/sql_view.h: Remove usage of current_thd() in mysql_make_view() sql/table.cc: Simple optimization of new code
-
- 29 Oct, 2005 1 commit
-
-
unknown authored
sql/sql_lex.h: Minor fix of a comment. sql/table.h: Minor fix of a comment.
-
- 27 Oct, 2005 1 commit
-
-
unknown authored
mysql-test/r/information_schema.result: error message changed mysql-test/r/sp.result: error message changed mysql-test/r/sql_mode.result: fixed test suite mysql-test/r/view.result: error message changed mysql-test/r/view_grant.result: test of underlying view tables check mysql-test/t/sql_mode.test: fixed test suite mysql-test/t/view_grant.test: test of underlying view tables check sql/item.cc: check of underlying tables privilege added sql/item.h: Name the resolution context points to the security context of view (if item belong to the view) sql/item_func.cc: a view error hiding for execution of prepared function belonged to a view fixed checking privileges if stored functions belonds to some view sql/mysql_priv.h: refult of derived table processing functions changed to bool Security_context added as an argument to find_field_in_table() sql/share/errmsg.txt: error message fixed sql/sql_acl.cc: Storing requested privileges of tables added View underlying tables privilege check added sql/sql_base.cc: View underlying tables privilege check added sql/sql_cache.cc: Code cleunup: we should not register underlying tables of view second time sql/sql_delete.cc: ancestor -> merge_underlying_list renaming sql/sql_derived.cc: refult of derived table processing functions changed to bool do not give SELECT_ACL for TEMPTABLE views sql/sql_lex.h: The comment added sql/sql_parse.cc: registration of requested privileges added sql/sql_prepare.cc: registration of requested privileges added sql/sql_update.cc: manipulation of requested privileges for underlying tables made the same as for table which we are updating sql/sql_view.cc: underlying tables of view security check support added sql/table.cc: renaming and fixing view preparation methods, methods for checking underlyoing tables security context added sql/table.h: storege for reuested privileges added
-
- 24 Oct, 2005 1 commit
-
-
unknown authored
- allow CREATE VIEW as well as DROP VIEW to use in prepared statements; - fix CREATE VIEW implementation to make it work in prepared statements. mysql-test/r/sp.result: Results file for the test case for BUG#13095. mysql-test/t/sp.test: Test case for BUG#13095. sql/sql_lex.h: Added a variable to remember start of whole CREATE VIEW statement as well as start of its SELECT part. sql/sql_prepare.cc: Allow CREATE VIEW and DROP VIEW to use in prepared statements. sql/sql_view.cc: Use stored start of whole CREATE VIEW statement instead of thd->query, which differs from the original when prepared statement is executing. sql/sql_yacc.yy: Remember start of whole CREATE VIEW statement as well as start of its SELECT part.
-
- 21 Oct, 2005 1 commit
-
-
unknown authored
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.
-
- 15 Oct, 2005 1 commit
-
-
unknown authored
allowed set functions aggregated in outer subqueries, allowed nested set functions. mysql-test/r/func_gconcat.result: Changed a query when fixing bug #12762. mysql-test/r/subselect.result: Added test cases for bug #12762. Allowed set functions aggregated in outer subqueries. Allowed nested set functions. mysql-test/t/func_gconcat.test: Changed a query when fixing bug #12762. mysql-test/t/subselect.test: Added test cases for bug #12762. Allowed set functions aggregated in outer subqueries. Allowed nested set functions. sql/item.cc: Fixed bug #12762: allowed set functions aggregated in outer subqueries, allowed nested set functions. Added a parameter to Item::split_sum_func2 aliowing to defer splitting for set functions aggregated in outer subquries. Changed Item_field::fix_fields to calculate attributes used when checking context conditions for set functions. Allowed alliases for set functions defined in outer subqueries. sql/item.h: Fixed bug #12762: allowed set functions aggregated in outer subqueries, allowed nested set functions. Added a parameter to Item::split_sum_func2 aliowing to defer splitting for set functions aggregated in outer subquries. sql/item_cmpfunc.cc: Fixed bug #12762: allowed set functions aggregated in outer subqueries, allowed nested set functions. Added a parameter to Item::split_sum_func2 aliowing to defer splitting for set functions aggregated in outer subquries. sql/item_func.cc: Fixed bug #12762: allowed set functions aggregated in outer subqueries, allowed nested set functions. Added a parameter to Item::split_sum_func2 aliowing to defer splitting for set functions aggregated in outer subquries. sql/item_row.cc: Fixed bug #12762: allowed set functions aggregated in outer subqueries, allowed nested set functions. Added a parameter to Item::split_sum_func2 aliowing to defer splitting for set functions aggregated in outer subquries. sql/item_strfunc.cc: Fixed bug #12762: allowed set functions aggregated in outer subqueries, allowed nested set functions. Added a parameter to Item::split_sum_func2 aliowing to defer splitting for set functions aggregated in outer subquries. sql/item_subselect.cc: Fixed bug #12762: allowed set functions aggregated in outer subqueries, allowed nested set functions. Introduced next levels for subqueries and a bitmap of nesting levels showing in what subqueries a set function can be aggregated. sql/item_sum.cc: Fixed bug #12762: allowed set functions aggregated in outer subqueries, allowed nested set functions. Added Item_sum methods to check context conditions imposed on set functions. sql/item_sum.h: Fixed bug #12762: allowed set functions aggregated in outer subqueries, allowed nested set functions. Added Item_sum methods to check context conditions imposed on set functions. sql/mysql_priv.h: Fixed bug #12762: allowed set functions aggregated in outer subqueries, allowed nested set functions. Introduced a type of bitmaps to be used for nesting constructs. sql/sql_base.cc: Fixed bug #12762: allowed set functions aggregated in outer subqueries, allowed nested set functions. Introduced next levels for subqueries and a bitmap of nesting levels showing in what subqueries a set function can be aggregated. sql/sql_class.cc: Fixed bug #12762: allowed set functions aggregated in outer subqueries, allowed nested set functions. Introduced a bitmap of nesting levels showing in what subqueries a set function can be aggregated. sql/sql_class.h: Fixed bug #12762: allowed set functions aggregated in outer subqueries, allowed nested set functions. Introduced a bitmap of nesting levels showing in what subqueries a set function can be aggregated. sql/sql_delete.cc: Fixed bug #12762: allowed set functions aggregated in outer subqueries, allowed nested set functions. Introduced a bitmap of nesting levels showing in what subqueries a set function can be aggregated. sql/sql_lex.cc: Fixed bug #12762: allowed set functions aggregated in outer subqueries, allowed nested set functions. Introduced next levels for subqueries and a bitmap of nesting levels showing in what subqueries a set function can be aggregated. sql/sql_lex.h: Fixed bug #12762: allowed set functions aggregated in outer subqueries, allowed nested set functions. Introduced next levels for subqueries and a bitmap of nesting levels showing in what subqueries a set function can be aggregated. sql/sql_parse.cc: Fixed bug #12762: allowed set functions aggregated in outer subqueries, allowed nested set functions. Introduced next levels for subqueries. sql/sql_prepare.cc: Fixed bug #12762: allowed set functions aggregated in outer subqueries, allowed nested set functions. Introduced a bitmap of nesting levels showingin what subqueries a set function can be aggregated. sql/sql_select.cc: Fixed bug #12762: allowed set functions aggregated in outer subqueries, allowed nested set functions. Introduced next levels for subqueries and a bitmap of nesting levels showing in what subqueries a set function can be aggregated. sql/sql_update.cc: Fixed bug #12762: allowed set functions aggregated in outer subqueries, allowed nested set functions. Introduced a bitmap of nesting levels showing in what subqueries a set function can be aggregated. sql/sql_yacc.yy: Fixed bug #12762: allowed set functions aggregated in outer subqueries, allowed nested set functions. Introduced next levels for subqueries.
-
- 13 Oct, 2005 1 commit
-
-
unknown authored
The bug was in JOIN::join_free which was wrongly determining that all joins have been already executed and therefore all used tables can be closed. mysql-test/r/subselect_innodb.result: - test results fixed (Bug#12736 "Server crash during a select mysql-test/t/subselect_innodb.test: - a test case for Bug#12736 "Server crash during a select": test that ha_index_or_rnd_end and mysql_unlock_tables are called for all used tables in proper order. sql/item_subselect.cc: - implement subselect_union_engine::is_executed sql/item_subselect.h: - implement Item_subselect::is_evaluated. This function is used to check whether we can clean up a non-correlated join of a subquery when cleaning up the join of the outer query sql/sql_lex.h: - declare st_select_lex::cleanup_all_joins sql/sql_select.cc: - remove an argument from JOIN::join_free, it's now not used - reimplement JOIN::join_free to not unlock tables if there is a subquery that has not yet been evaluated. Make sure that the new implementation calls ha_index_or_rnd_end for every table in the join and inner joins, because all table cursors must be closed before mysql_unlock_tables. sql/sql_select.h: - JOIN::join_free signature changed sql/sql_union.cc: - implement a helper method st_select_lex::cleanup_all_joins, which recursively walks over a tree of joins and calls cleanup() for each join.
-
- 09 Oct, 2005 1 commit
-
-
unknown authored
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
-
- 21 Sep, 2005 1 commit
-
-
unknown authored
cursor is interpreted latin1 character and Bug#9819 "Cursors: Mysql Server Crash while fetching from table with 5 million records." A fix for a possible memory leak when fetching into an SP cursor in a long loop. The patch uses a common implementation of cursors in the binary protocol and in stored procedures and implements materialized cursors. For implementation details, see comments in sql_cursor.cc include/my_sys.h: - declaration for multi_alloc_root libmysqld/Makefile.am: - drop protocol_cursor.cc, add sql_cursor.cc (replaces the old implementation of cursors with a new one) mysql-test/r/ctype_ujis.result: - test results fixed (a test case for Bug#6513) mysql-test/r/sp-big.result: - test results fixed (a test case for Bug#9819) mysql-test/t/ctype_ujis.test: Add a test case for Bug#6513 "Test Suite: Values inserted by using cursor is interpreted latin1 character" mysql-test/t/sp-big.test: Add a restricted test case for Bug#9819 "Cursors: Mysql Server Crash while fetching from table with 5 million records." mysys/my_alloc.c: - an implementation of multi_alloc_root; this is largely a copy-paste from mulalloc.c, but the function is small and there is no easy way to reuse the existing C function. sql/Makefile.am: - add sql_cursor.h, sql_cursor.cc (a new implementation of stored procedure cursors) and drop protocol_cursor.cc (the old one) sql/handler.cc: - now TABLE object has its mem_root always initialized. Adjust the implementation handler::ha_open sql/item_subselect.cc: - adjust to the changed declaration of st_select_lex_unit::prepare sql/protocol.h: - drop Protocol_cursor sql/sp_head.cc: - move juggling with Query_arena::free_list and Item::next to sp_eval_func_item, as this is needed in 3 places already. sql/sp_head.h: - declare a no-op implementation for cleanup_stmt in sp_instr_cpush. This method is needed for non-materializing cursors, which are yet not used in stored procedures. - declaration for sp_eval_func_item sql/sp_rcontext.cc: - reimplement sp_cursor using the new implementation of server side cursors. - use sp_eval_func_item to assign values of SP variables from the row fetched from a cursor. This should fix a possible memory leak in the old implementation of sp_cursor::fetch sql/sp_rcontext.h: - reimplement sp_cursor using the new implementation of server side cursors. sql/sql_class.cc: - disable the functionality that closes transient cursors at commit/rollback; transient cursors are not used in 5.0, instead we use materialized ones. To be enabled in a later version. sql/sql_class.h: - adjust to the rename Cursor -> Server_side_cursor - additional declarations of select_union used in materialized cursors sql/sql_derived.cc: - reuse bits of tmp table code in UNION, derived tables, and materialized cursors - cleanup comments sql/sql_lex.h: - declarations of auxiliary methods used by materialized cursors - a cleanup in st_select_lex_unit interface sql/sql_list.h: - add an array operator new[] to class Sql_alloc sql/sql_prepare.cc: - split the tight coupling of cursors and prepared statements to reuse the same implementation in stored procedures - cleanups of error processing in Prepared_statement::{prepare,execute} sql/sql_select.cc: - move the implementation of sensitive (non-materializing) cursors to sql_cursor.cc - make temporary tables self-contained: the table, its record and fields are allocated in TABLE::mem_root. This implementation is not clean and resets thd->mem_root several times because of the way create_tmp_table works (many additional things are done inside it). - adjust to the changed declaration of st_select_lex_unit::prepare sql/sql_select.h: - move the declaration of sensitive (non-materializing) cursors to sql_cursor.cc sql/sql_union.cc: - move pieces of st_select_unit::prepare to select_union and st_table methods to be able to reuse code in the implementation of materialized cursors sql/sql_view.cc: - adjust to the changed signature of st_select_lex_unit::prepare sql/table.cc: - implement auxiliary st_table methods for use with temporary tables sql/table.h: - add declarations for auxiliary methods of st_table used to work with temporary tables tests/mysql_client_test.c: - if cursors are materialized, a parallel update of the table used in the cursor may go through: update the test. sql/sql_cursor.cc: New BitKeeper file ``sql/sql_cursor.cc'' -- implementation of server side cursors sql/sql_cursor.h: New BitKeeper file ``sql/sql_cursor.h'' - declarations for server side cursors.
-
- 19 Sep, 2005 1 commit
-
-
unknown authored
that dump free list allocation per connection sql/ha_ndbcluster.cc: imlp. show engine ndb status; that dump free list allocation per connection sql/ha_ndbcluster.h: imlp. show engine ndb status; that dump free list allocation per connection sql/mysqld.cc: imlp. show engine ndb status; that dump free list allocation per connection sql/sql_lex.h: imlp. show engine ndb status; that dump free list allocation per connection sql/sql_parse.cc: imlp. show engine ndb status; that dump free list allocation per connection sql/sql_yacc.yy: imlp. show engine ndb status; that dump free list allocation per connection
-
- 14 Sep, 2005 2 commits
-
-
unknown authored
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.
-
unknown authored
view definer information syntax/storage/replication fixed SOURCE field of .frm mysql-test/r/func_in.result: definer information added to CREATE VIEW mysql-test/r/lowercase_view.result: definer information added to CREATE VIEW mysql-test/r/mysqldump.result: definer information added to CREATE VIEW mysql-test/r/rpl_view.result: check log of queries mysql-test/r/skip_grants.result: --skip-grants do not allow use user information mysql-test/r/sql_mode.result: definer information added to CREATE VIEW mysql-test/r/temp_table.result: definer information added to CREATE VIEW mysql-test/r/view.result: definer information added to CREATE VIEW test of storing/restoring definer information mysql-test/r/view_grant.result: test of grant check of definer information definer information added to CREATE VIEW mysql-test/t/rpl_view.test: check log of queries mysql-test/t/skip_grants.test: --skip-grants do not allow use user information mysql-test/t/view.test: test of storing/restoring definer information mysql-test/t/view_grant.test: test of grant check of definer information sql/mysql_priv.h: CREATE/ALTER VIEW print support set current user as definer procedure sql/share/errmsg.txt: new errors/warnings sql/sql_acl.cc: make find_acl_user public to allow to check user sql/sql_acl.h: make find_acl_user public to allow to check user sql/sql_lex.h: storing definer information sql/sql_parse.cc: send CREATE/ALTER VIEW for replication with full list of options set current user as definer procedure sql/sql_show.cc: new CREATE VIEW options printed sql/sql_view.cc: check of definer clause changes in .frm file definer information storage support now we store only original SELECT in SOURCE field of .frm sql/sql_yacc.yy: definer information sintax support getting SOURCE field information for .frm sql/table.h: definer information storage
-
- 02 Sep, 2005 1 commit
-
-
unknown authored
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.
-
- 25 Aug, 2005 1 commit
-
-
unknown authored
"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.
-
- 12 Aug, 2005 2 commits
-
-
unknown authored
"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.
-
unknown authored
Removed duplicate usage of TMP_TABLE_FORCE_MYISAM by making 'options' longlong sql/ha_berkeley.cc: Removed not used variable (and options) sql/ha_berkeley.h: Removed not used argument sql/ha_ndbcluster.cc: Remove compiler warning sql/init.cc: Simplify code sql/item_sum.cc: Removed duplicate usage of TMP_TABLE_FORCE_MYISAM by making 'options' longlong sql/mysql_priv.h: Removed duplicate usage of TMP_TABLE_FORCE_MYISAM by making 'options' longlong sql/mysqld.cc: Removed duplicate usage of TMP_TABLE_FORCE_MYISAM by making 'options' longlong sql/sql_class.h: Removed duplicate usage of TMP_TABLE_FORCE_MYISAM by making 'options' longlong sql/sql_delete.cc: Removed duplicate usage of TMP_TABLE_FORCE_MYISAM by making 'options' longlong sql/sql_derived.cc: Removed duplicate usage of TMP_TABLE_FORCE_MYISAM by making 'options' longlong sql/sql_lex.h: Removed duplicate usage of TMP_TABLE_FORCE_MYISAM by making 'options' longlong sql/sql_parse.cc: Indentation fixes sql/sql_select.cc: Removed duplicate usage of TMP_TABLE_FORCE_MYISAM by making 'options' longlong sql/sql_select.h: Removed duplicate usage of TMP_TABLE_FORCE_MYISAM by making 'options' longlong sql/sql_show.cc: Removed duplicate usage of TMP_TABLE_FORCE_MYISAM by making 'options' longlong sql/sql_union.cc: Removed duplicate usage of TMP_TABLE_FORCE_MYISAM by making 'options' longlong sql/sql_update.cc: Removed duplicate usage of TMP_TABLE_FORCE_MYISAM by making 'options' longlong sql/sql_yacc.yy: Changed variable name i to more descriptive name Removed compiler warning
-
- 09 Aug, 2005 1 commit
-
-
unknown authored
cause crash on update". Let us update "thd" pointer in LEX, all its units and in LEX::result before executing statement in trigger body, since triggers are associated with TABLE object and because of this can be used in different threads. mysql-test/r/trigger.result: Added test case for bug #11973 "SELECT .. INTO var_name; in trigger cause crash on update". mysql-test/t/trigger.test: Added test case for bug #11973 "SELECT .. INTO var_name; in trigger cause crash on update". sql/item_subselect.cc: subselect_engine: Moved implementation of set_thd() method to item_subselect.cc, since now it also sets "thd" for subselect_engine::result. sql/item_subselect.h: subselect_engine: Moved implementation of set_thd() method to item_subselect.cc, since now it also sets "thd" for subselect_engine::result. sql/sql_class.h: select_result: Added set_thd() method for updating select_result::thd value (we need this in cases when statement to which this select_result belongs will be used in different threads, as it happens for statements in trigger body). multi_delete/multi_update: Got rid of redundant "thd" member (we already have it in select_result). sql/sql_delete.cc: multi_delete: Got rid of redundant "thd" member (we already have it in select_result). sql/sql_lex.h: st_select_lex_unit: Added set_thd() method for updating st_select_lex_unit::thd value (we need this in cases when statement to which this unit belongs will be used in different threads, as it happens for statements in trigger body). We don't update thd of select_result pointed by st_select_lex_unit::result in this method, since it is either have too short lifetime (i.e. created for each execution) or is accessible via Item_subquery or LEX::result and thus already taken care of. sql/sql_parse.cc: multi_delete: Got rid of redundant "thd" member (we already have it in select_result). sql/sql_prepare.cc: reinit_stmt_before_use(): We have to update "thd" pointer in LEX, all its units and in LEX::result, since statements which belong to trigger body are associated with TABLE object and because of this can be used in different threads. sql/sql_update.cc: multi_update: Got rid of redundant "thd" member (we already have it in select_result).
-
- 19 Jul, 2005 1 commit
-
-
unknown authored
"Triggers have the wrong namespace" "Triggers: duplicate names allowed" "Triggers: CREATE TRIGGER does not accept fully qualified names" "SHOW TRIGGERS" mysql-test/r/information_schema.result: Added tests for new INFORMATION_SCHEMA.TRIGGERS view and SHOW TRIGGERS command. mysql-test/r/information_schema_db.result: INFORMATION_SCHEMA.TRIGGERS view was added. mysql-test/r/rpl_sp.result: Now DROP TRIGGER interprets first part of trigger identifier as database name and not as table name. Adjusted tests properly. mysql-test/r/trigger.result: Now DROP TRIGGER interprets first part of trigger identifier as database name and not as table name. Adjusted tests properly. Added test checking that triggers have database wide namespace. Added test for bug #8791 "Triggers: Allowed to create triggers on a subject table in a different DB". mysql-test/r/view.result: Now DROP TRIGGER interprets first part of trigger identifier as database name and not as table name. Adjusted tests properly. mysql-test/t/information_schema.test: Added tests for new INFORMATION_SCHEMA.TRIGGERS view and SHOW TRIGGERS command. mysql-test/t/rpl_sp.test: Now DROP TRIGGER interprets first part of trigger identifier as database name and not as table name. Adjusted tests properly. mysql-test/t/trigger.test: Now DROP TRIGGER interprets first part of trigger identifier as database name and not as table name. Adjusted tests properly. Added test checking that triggers have database wide namespace. Added test for bug #8791 "Triggers: Allowed to create triggers on a subject table in a different DB". mysql-test/t/view.test: Now DROP TRIGGER interprets first part of trigger identifier as database name and not as table name. Adjusted tests properly. sql/handler.cc: Added .TRN tho the list of known file extensions assoicated with tables. sql/item.h: trg_action_time_type/trg_event_type enums: Added TRG_ACTION_MAX/TRG_EVENT_MAX elements which should be used instead of magical values in various loops where we iterate through all types of trigger action times or/and trigger event types. sql/lex.h: Added new symbol "TRIGGERS". sql/mysql_priv.h: Added declaration of constant holding extension for trigger name (.TRN) files. sql/mysqld.cc: Added statistical variable for SHOW TRIGGERS command. sql/share/errmsg.txt: Added error message saying that one attempts to create trigger in wrong schema. sql/sp.cc: Replaced magical values with TRG_EVENT_MAX/TRG_ACTION_MAX constants. sql/sql_base.cc: open_unireg_entry(): Now Table_triggers_list::check_n_load() has one more argument which controls whether we should prepare Table_triggers_list with fully functional triggers or load only their names. sql/sql_lex.h: Added element for new SHOW TRIGGERS command to enum_sql_command enum. sql/sql_parse.cc: prepare_schema_table(): Added support for SHOW TRIGGERS statement. sql/sql_show.cc: Added new INFORMATION_SCHEMA.TRIGGERS view and SHOW TRIGGERS command. sql/sql_table.cc: mysql_rm_table_part2(): Replaced simple deletion of .TRG file with call to Table_triggers_list::drop_all_triggers which will also delete .TRN files for all triggers associated with table. sql/sql_trigger.cc: Now triggers have database wide namespace. To support it we create special .TRN file with same name as trigger for each trigger. This file contains name of trigger's table so one does not need to specify it explicitly in DROP TRIGGER. Moreover DROP TRIGGER treats first part of trigger identifier as database name now. Updated mysql_create_or_drop_trigger() routine and Table_triggers_list::create_trigger()/drop_trigger()/check_n_load() methods accordingly. Added add_table_for_trigger() routine and Table_triggers_list::drop_all_triggers() method. Added Table_triggers_list::get_trigger_info() for obtaining trigger metadata. sql/sql_trigger.h: Table_triggers_list: Use TRG_EVENT_MAX, TRG_ACTION_MAX instead of magic values. Added get_trigger_info() method for obtaining trigger's meta-data. Added drop_all_triggers() method which drops all triggers for table. Added declarations of trg_action_time_type_names/trg_event_type_names arrays which hold names of triggers action time types and event types. sql/sql_yacc.yy: Changed grammar for CREATE/DROP TRIGGER to support database wide trigger namespace. Added new SHOW TRIGGERS statement. sql/table.h: enum enum_schema_tables: Added constant for new INFORMATION_SCHEMA.TRIGGERS view.
-
- 13 Jul, 2005 2 commits
-
-
unknown authored
data": remove the fix for another bug (8807) that added OUTER_REF_TABLE_BIT to all subqueries that used a placeholder to prevent their evaluation at prepare. As this bit hanged in Item_subselect::used_tables_cache for ever, a constant subquery with a placeholder was never evaluated as such, which caused wrong choice of the execution plan for the statement. - to fix Bug#8807 backport a better fix from 5.0 - post-review fixes. mysql-test/r/ps.result: Bug#11458: test results fixed mysql-test/t/ps.test: - add a test case for Bug#11458 "Prepared statement with subselects return random data" sql/item.cc: - remove unnecessary Item_param::fix_fields - fix Item_param::set_null to set item_type accordingly (safety: Item_param should behave like a basic constant). sql/item.h: Remove Item_param::fix_fields sql/item_subselect.h: Remove no more existing friend. sql/mysql_priv.h: Add UNCACHEABLE_PREPARE to mark all subqueries as uncacheable if in statement prepare (backport from 5.0). sql/sql_lex.h: Comment fixed. sql/sql_parse.cc: If in statement prepare, mark all subqueries as uncacheable (backport from 5.0) sql/sql_prepare.cc: Switch off the uncacheable flag from all subqueries after statement prepare is done (backport from 5.0)
-
unknown authored
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).
-
- 09 Jul, 2005 1 commit
-
-
unknown authored
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.
-