Commit graph

1450 commits

Author SHA1 Message Date
unknown
3e3990433a Merge bodhi.local:/opt/local/work/mysql-4.1-4968
into  bodhi.local:/opt/local/work/mysql-5.0-4968-pull-from-4.1


sql/sql_insert.cc:
  Auto merged
mysql-test/r/ps.result:
  Manual merge.
mysql-test/t/ps.test:
  Manual merge.
sql/mysql_priv.h:
  Manual merge.
sql/sql_class.h:
  Manual merge.
sql/sql_lex.cc:
  Manual merge.
sql/sql_lex.h:
  Manual merge.
sql/sql_list.h:
  Manual merge.
sql/sql_parse.cc:
  Manual merge.
sql/sql_show.cc:
  Manual merge.
sql/sql_table.cc:
  Manual merge.
sql/sql_yacc.yy:
  Manual merge.
2006-12-12 01:23:30 +03:00
unknown
e47ded8114 A fix and test cases for
Bug#4968 "Stored procedure crash if cursor opened on altered table"
Bug#19733 "Repeated alter, or repeated create/drop, fails"
Bug#19182 "CREATE TABLE bar (m INT) SELECT n FROM foo; doesn't work from 
stored procedure."
Bug#6895 "Prepared Statements: ALTER TABLE DROP COLUMN does nothing"
Bug#22060 "ALTER TABLE x AUTO_INCREMENT=y in SP crashes server"

Test cases for bugs 4968, 19733, 6895 will be added in 5.0.

Re-execution of CREATE DATABASE, CREATE TABLE and ALTER TABLE 
statements in stored routines or as prepared statements caused
incorrect results (and crashes in versions prior to 5.0.25).
In 5.1 the problem occured only for CREATE DATABASE, CREATE TABLE
SELECT and CREATE TABLE with INDEX/DATA DIRECTOY options).

The problem of bugs 4968, 19733, 19282 and 6895 was that functions
mysql_prepare_table, mysql_create_table and mysql_alter_table were not
re-execution friendly: during their operation they used to modify contents
of LEX (members create_info, alter_info, key_list, create_list),
thus making the LEX unusable for the next execution.
In particular, these functions removed processed columns and keys from
create_list, key_list and drop_list. Search the code in sql_table.cc 
for drop_it.remove() and similar patterns to find evidence.

The fix is to supply to these functions a usable copy of each of the
above structures at every re-execution of an SQL statement. 

To simplify memory management, LEX::key_list and LEX::create_list
were added to LEX::alter_info, a fresh copy of which is created for
every execution.

The problem of crashing bug 22060 stemmed from the fact that the above 
metnioned functions were not only modifying HA_CREATE_INFO structure in 
LEX, but also were changing it to point to areas in volatile memory of 
the execution memory root.
 
The patch solves this problem by creating and using an on-stack
copy of HA_CREATE_INFO (note that code in 5.1 already creates and
uses a copy of this structure in mysql_create_table()/alter_table(),
but this approach didn't work well for CREATE TABLE SELECT statement).


mysql-test/r/ps.result:
  Update test results (Bug#19182, Bug#22060)
mysql-test/t/ps.test:
  Add a test case for Bug#19182, Bug#22060 (4.1-only parts)
sql/mysql_priv.h:
  LEX::key_list and LEX::create_list were moved to LEX::alter_info.
  Update declarations to use LEX::alter_info instead of these two
  members.
sql/sql_class.h:
  Replace pair<columns, keys> with an instance of Alter_info in
  select_create constructor. We create a new copy of Alter_info
  each time we re-execute SELECT .. CREATE prepared statement.
sql/sql_insert.cc:
  Adjust to a new signature of create_table_from_items.
sql/sql_lex.cc:
  Implement Alter_info::Alter_info that would make a "deep" copy
  of all definition lists (keys, columns).
sql/sql_lex.h:
  Move key_list and create_list to class Alter_info. Implement
  Alter_info::Alter_info that can be used with PS and SP.
sql/sql_list.h:
  Implement a copy constructor of class List that makes a deep copy
  of all list nodes.
sql/sql_parse.cc:
  Adjust to new signatures of mysql_create_table, mysql_alter_table,
  select_create. Functions mysql_create_index and mysql_drop_index has
  become identical after initialization of alter_info was moved to the 
  parser, and were merged. Flag enable_slow_log was not updated for 
  SQLCOM_DROP_INDEX, which is a bug. Just like CREATE INDEX, DROP INDEX
  is currently done via complete table rebuild and is rightfully a slow
  administrative statement.
sql/sql_show.cc:
  Adjust mysqld_show_create_db to a new signature.
sql/sql_table.cc:
  Adjust mysql_alter_table, mysql_recreate_table, mysql_create_table,
  mysql_prepare_table to new signatures.
sql/sql_yacc.yy:
  LEX::key_list and LEX::create_list moved to class Alter_info
2006-12-08 02:20:09 +03:00
unknown
bc3fe09a77 Merge moonlight.intranet:/home/tomash/src/mysql_ab/mysql-5.0
into  moonlight.intranet:/home/tomash/src/mysql_ab/mysql-5.0-bug20637


sql/sql_yacc.yy:
  Auto merged
2006-11-29 18:54:01 +03:00
unknown
c707c7eae7 BUG#20637: "load data concurrent infile" locks the table
Note that we ignore CONCURRENT if LOAD DATA CONCURRENT is used from
inside a stored routine and MySQL is compiled with Query Cache support
(this is not in the manual).

The problem was that the condition test of "we are inside stored routine"
was reversed, thus CONCURRENT _worked only_ from stored routine.  The
solution is to use proper condition test.

No test case is provided because the test case would require a large
amount of input, and it's hard to tell is SELECT is really blocked or
just slow (subject to race).


sql/sql_yacc.yy:
  Fix the condition of TL_WRITE_CONCURRENT_INSERT on LOAD DATA CONCURRENT,
  which was reversed, and return valid value if we are in SP.
2006-11-29 15:51:53 +03:00
unknown
15584161e2 Merge bk-internal.mysql.com:/home/bk/mysql-5.0
into  bodhi.local:/opt/local/work/mysql-5.0-runtime


libmysql/libmysql.c:
  Auto merged
libmysqld/lib_sql.cc:
  Auto merged
mysql-test/t/func_str.test:
  Auto merged
sql/item_cmpfunc.cc:
  Auto merged
sql/item_func.cc:
  Auto merged
sql/item_sum.cc:
  Auto merged
sql/mysqld.cc:
  Auto merged
sql/sql_yacc.yy:
  Auto merged
tests/mysql_client_test.c:
  Auto merged
mysql-test/t/wait_for_socket.sh:
  Manual merge.
sql/sql_cache.cc:
  Manual merge.
2006-11-29 02:44:12 +03:00
unknown
96ad04dec0 Merge bk@192.168.21.1:mysql-5.0-opt
into  mysql.com:/home/hf/work/mysql-5.0-0mrg


BitKeeper/deleted/.del-mysql_client.test:
  Auto merged
include/mysql.h:
  Auto merged
libmysqld/lib_sql.cc:
  Auto merged
mysql-test/r/order_by.result:
  Auto merged
mysql-test/r/query_cache.result:
  Auto merged
mysql-test/r/subselect.result:
  Auto merged
mysql-test/r/type_newdecimal.result:
  Auto merged
mysql-test/t/flush.test:
  Auto merged
mysql-test/t/flush_block_commit.test:
  Auto merged
mysql-test/t/innodb-deadlock.test:
  Auto merged
mysql-test/t/innodb-lock.test:
  Auto merged
mysql-test/t/lock_multi.test:
  Auto merged
mysql-test/t/mysql.test:
  Auto merged
mysql-test/t/query_cache.test:
  Auto merged
mysql-test/t/rename.test:
  Auto merged
mysql-test/t/show_check.test:
  Auto merged
mysql-test/t/status.test:
  Auto merged
mysql-test/t/subselect.test:
  Auto merged
mysql-test/t/type_newdecimal.test:
  Auto merged
sql/field.cc:
  Auto merged
sql/field.h:
  Auto merged
sql/handler.cc:
  Auto merged
sql/item.cc:
  Auto merged
sql/item.h:
  Auto merged
sql/item_func.cc:
  Auto merged
sql/item_func.h:
  Auto merged
sql/item_subselect.cc:
  Auto merged
sql/item_subselect.h:
  Auto merged
sql/item_sum.cc:
  Auto merged
sql/item_sum.h:
  Auto merged
sql/item_timefunc.cc:
  Auto merged
sql/item_timefunc.h:
  Auto merged
sql/mysql_priv.h:
  Auto merged
sql/protocol.cc:
  Auto merged
sql/protocol.h:
  Auto merged
sql/sql_base.cc:
  Auto merged
sql/sql_class.h:
  Auto merged
sql/sql_lex.cc:
  Auto merged
sql/sql_lex.h:
  Auto merged
sql/sql_parse.cc:
  Auto merged
sql/sql_select.cc:
  Auto merged
sql/sql_show.cc:
  Auto merged
sql/sql_table.cc:
  Auto merged
sql/sql_yacc.yy:
  Auto merged
sql/table.cc:
  Auto merged
sql-common/client.c:
  Auto merged
sql-common/my_time.c:
  Auto merged
Makefile.am:
  merging
client/mysqltest.c:
  merging
include/my_time.h:
  merging
libmysql/libmysql.c:
  merging
mysql-test/t/order_by.test:
  merging
2006-11-17 10:30:16 +04:00
unknown
541e9c9ac5 Bug#23703 (DROP TRIGGER needs an IF EXISTS)
This change set implements the DROP TRIGGER IF EXISTS functionality.

This fix is considered a bug and not a feature, because without it,
there is no known method to write a database creation script that can create
a trigger without failing, when executed on a database that may or may not
contain already a trigger of the same name.

Implementing this functionality closes an orthogonality gap between triggers
and stored procedures / stored functions (which do support the DROP IF
EXISTS syntax).

In sql_trigger.cc, in mysql_create_or_drop_trigger,
the code has been reordered to:
- perform the tests that do not depend on the file system (access()),
- get the locks (wait_if_global_read_lock, LOCK_open)
- call access()
- perform the operation
- write to the binlog
- unlock (LOCK_open, start_waiting_global_read_lock)

This is to ensure that all the code that depends on the presence of the
trigger file is executed in the same critical section,
and prevents race conditions similar to the case fixed by Bug 14262 :

- thread 1 executes DROP TRIGGER IF EXISTS, access() returns a failure
- thread 2 executes CREATE TRIGGER
- thread 2 logs CREATE TRIGGER
- thread 1 logs DROP TRIGGER IF EXISTS

The patch itself is based on code contributed by the MySQL community,
under the terms of the Contributor License Agreement (See Bug 18161).


mysql-test/r/rpl_trigger.result:
  DROP TRIGGER IF EXISTS
mysql-test/r/trigger.result:
  DROP TRIGGER IF EXISTS
mysql-test/t/rpl_trigger.test:
  DROP TRIGGER IF EXISTS
mysql-test/t/trigger.test:
  DROP TRIGGER IF EXISTS
sql/sql_trigger.cc:
  DROP TRIGGER IF EXISTS
sql/sql_yacc.yy:
  DROP TRIGGER IF EXISTS
2006-11-13 15:40:22 -07:00
unknown
f51d0812a7 Bug #21809: Error 1356 while selecting from view with grouping though underlying
select OK.
The SQL parser was using Item::name to transfer user defined function attributes
to the user defined function (udf). It was not distinguishing between user defined 
function call arguments and stored procedure call arguments. Setting Item::name 
was causing Item_ref::print() method to print the argument as quoted identifiers 
and caused views that reference aggregate functions as udf call arguments (and 
rely on Item::print() for the text of the view to store) to throw an undefined 
identifier error.
Overloaded Item_ref::print to print aggregate functions as such when printing
the references to aggregate functions taken out of context by split_sum_func2()
Fixed the parser to properly detect using AS clause in stored procedure arguments
as an error.
Fixed printing the arguments of udf call to print properly the udf attribute.


mysql-test/r/udf.result:
  Bug #21809: Error 1356 while selecting from view with grouping though underlying
              select OK.
   - test cases
mysql-test/t/udf.test:
  Bug #21809: Error 1356 while selecting from view with grouping though underlying
              select OK.
   - test cases
sql/item.cc:
  Bug #21809: Error 1356 while selecting from view with grouping though underlying
              select OK.
   - Don't print the refs to SUM functions as refs.
sql/item_func.cc:
  Bug #21809: Error 1356 while selecting from view with grouping though underlying
              select OK.
   - print the aliases in the udf calls
sql/item_func.h:
  Bug #21809: Error 1356 while selecting from view with grouping though underlying
              select OK.
   - print the aliases in the udf calls
sql/sql_lex.cc:
  Bug #21809: Error 1356 while selecting from view with grouping though underlying
              select OK.
   - disable aliases for arguments in stored routine calls
sql/sql_lex.h:
  Bug #21809: Error 1356 while selecting from view with grouping though underlying
              select OK.
   - disable aliases for arguments in stored routine calls
sql/sql_yacc.yy:
  Bug #21809: Error 1356 while selecting from view with grouping though underlying
              select OK.
   - disable aliases for arguments in stored routine calls
   - fix bison duplicate symbol warnings
2006-10-24 15:26:41 +03:00
unknown
649f3d5479 Merge moonlight.intranet:/home/tomash/src/mysql_ab/mysql-5.0
into  moonlight.intranet:/home/tomash/src/mysql_ab/mysql-5.0-bug20953


mysql-test/r/view.result:
  Auto merged
mysql-test/t/sp-error.test:
  Auto merged
mysql-test/t/view.test:
  Auto merged
sql/sql_lex.cc:
  Auto merged
sql/sql_lex.h:
  Auto merged
sql/sql_view.cc:
  Auto merged
sql/sql_yacc.yy:
  Auto merged
mysql-test/r/sp-error.result:
  Manual merge.
2006-10-12 18:33:07 +04:00
unknown
6d1fdc7308 BUG#20953: create proc with a create view that uses local vars/params
should fail to create

The problem was that this type of errors was checked during view
creation, which doesn't happen when CREATE VIEW is a statement of
a created stored routine.

The solution is to perform the checks at parse time.  The idea of the
fix is that the parser checks if a construction just parsed is allowed
in current circumstances by testing certain flags, and this flags are
reset for VIEWs.

The side effect of this change is that if the user already have
such bogus routines, it will now get a error when trying to do

  SHOW CREATE PROCEDURE proc;

(and some other) and when trying to execute such routine he will get

  ERROR 1457 (HY000): Failed to load routine test.p5. The table mysql.proc is missing, corrupt, or contains bad data (internal code -6)

However there should be very few such users (if any), and they may
(and should) drop these bogus routines.


mysql-test/r/sp-error.result:
  Add result for bug#20953: create proc with a create view that uses
  local vars/params should fail to create.
mysql-test/r/view.result:
  Update results.
mysql-test/t/sp-error.test:
  Add test case for bug#20953: create proc with a create view that uses
  local vars/params should fail to create.
mysql-test/t/view.test:
  Add second test for variable in a view.
  Remove SP variable in a view test, as it tests wrong behaviour.
  Add test for derived table in a view.
sql/sql_lex.cc:
  Remove LEX::variables_used.
sql/sql_lex.h:
  Remove LEX::variables_used and add st_parsing_options structure and
  LEX::parsing_options member.
sql/sql_view.cc:
  Move some error checking to sql/sql_yacc.yy.
sql/sql_yacc.yy:
  Check for disallowed syntax in a CREATE VIEW at parse time to rise a
  error when it is used inside CREATE PROCEDURE and CREATE FUNCTION, as
  well as by itself.
2006-10-12 18:02:57 +04:00
unknown
e1e0f829e6 Bug#21462 (Stored procedures with no arguments require parenthesis)
The syntax of the CALL statement, to invoke a stored procedure, has been
changed to make the use of parenthesis optional in the argument list.
With this change, "CALL p;" is equivalent to "CALL p();".

While the SQL spec does not explicitely mandate this syntax, supporting it
is needed for practical reasons, for integration with JDBC / ODBC connectors.

Also, warnings in the sql/sql_yacc.yy file, which were not reported by Bison 2.1
but are now reported by Bison 2.2, have been fixed.

The warning found were:
bison -y -p MYSQL  -d --debug --verbose sql_yacc.yy
sql_yacc.yy:653.9-18: warning: symbol UNLOCK_SYM redeclared
sql_yacc.yy:656.9-17: warning: symbol UNTIL_SYM redeclared
sql_yacc.yy:658.9-18: warning: symbol UPDATE_SYM redeclared
sql_yacc.yy:5169.11-5174.11: warning: unused value: $2
sql_yacc.yy:5208.11-5220.11: warning: unused value: $5
sql_yacc.yy:5221.11-5234.11: warning: unused value: $5
conflicts: 249 shift/reduce

"unused value: $2" correspond to the $$=$1 assignment in the 1st {} block
in table_ref -> join_table {} {},
which does not procude a result ($$) for the rule but an intermediate $2
value for the action instead.
"unused value: $5" are similar, with $$ assignments in {} actions blocks
which are not for the final reduce.


mysql-test/r/sp.result:
  New test case for Bug#21462
mysql-test/t/sp.test:
  New test case for Bug#21462
sql/sql_yacc.yy:
  "CALL p;" syntax for calling a stored procedure
  Fixed bison 2.2 warnings.
2006-10-09 09:59:02 -07:00
unknown
70255e8509 Merge dl145s.mysql.com:/data/bk/team_tree_merge/mysql-5.0
into  dl145s.mysql.com:/data/bk/team_tree_merge/MERGE/mysql-5.0-opt


mysql-test/r/view.result:
  Auto merged
mysql-test/t/view.test:
  Auto merged
sql/mysql_priv.h:
  Auto merged
sql/sql_select.cc:
  Auto merged
sql/sql_yacc.yy:
  Auto merged
2006-09-28 10:36:04 +02:00
unknown
c316933e60 additional 'after merge' fix 2006-09-27 20:11:11 +05:00
unknown
f0bd502ac8 Fixed bug #21646.
Presence of a subquery in the ON expression of a join 
should not block merging the view that contains this join.
Before this patch the such views were converted into 
into temporary table views.


mysql-test/r/view.result:
  Added a test case for bug #21646.
mysql-test/t/view.test:
  Added a test case for bug #21646.
sql/mysql_priv.h:
  Fixed bug #21646.
  Added a new parsing state 'IN_ON', true when
  the parser is in an ON expression of a join.
sql/sql_lex.cc:
  Fixed bug #21646.
  Presence of a subquery in the ON expression of a join 
  should not block merging the view that contains this join.
sql/sql_yacc.yy:
  Fixed bug #21646.
  Added a new parsing state 'IN_ON', true when
  the parser is in an ON expression of a join.
2006-09-25 06:15:14 -07:00
unknown
edbab3578b Merge mysql.com:/users/lthalmann/bkroot/mysql-5.0-rpl
into  mysql.com:/users/lthalmann/bk/MERGE/mysql-5.0-merge


ndb/src/kernel/blocks/dbdih/DbdihMain.cpp:
  Auto merged
sql/ha_ndbcluster.cc:
  Auto merged
sql/sql_class.h:
  Auto merged
sql/sql_parse.cc:
  Auto merged
sql/sql_yacc.yy:
  Auto merged
client/mysqldump.c:
  Merge main->rpl
mysql-test/r/mysqldump.result:
  Restore of main mysqldump test files in rpl tree (only added echo and one test case for bug 13926)
  Printouts not yet added to result file
mysql-test/t/mysqldump.test:
  Restore of main mysqldump test files in rpl tree (only added echo and one test case for bug 13926)
2006-09-21 00:05:56 +02:00
unknown
941e502079 Merge mysql.com:/users/lthalmann/bkroot/mysql-4.1-rpl
into  mysql.com:/users/lthalmann/bk/MERGE/mysql-4.1-merge


sql/sql_yacc.yy:
  Auto merged
2006-09-20 16:17:30 +02:00
unknown
e4b044060c Merge dl145s.mysql.com:/data/bk/team_tree_merge/CLEAN/mysql-5.0
into  dl145s.mysql.com:/data/bk/team_tree_merge/MERGE/mysql-5.0-opt


sql/item.cc:
  Auto merged
sql/item_cmpfunc.cc:
  Auto merged
sql/item_func.cc:
  Auto merged
sql/item_func.h:
  Auto merged
sql/mysql_priv.h:
  Auto merged
sql/sql_parse.cc:
  Auto merged
sql/sql_select.cc:
  Auto merged
sql/sql_yacc.yy:
  Auto merged
sql/item.h:
  SCCS merged
2006-09-15 11:52:49 +02:00
unknown
2c168ec568 Merge mysql.com:/users/lthalmann/bkroot/mysql-5.0-rpl
into  mysql.com:/users/lthalmann/bk/MERGE/mysql-5.0-merge


ndb/src/kernel/blocks/dbdih/DbdihMain.cpp:
  Auto merged
sql/ha_ndbcluster.cc:
  Auto merged
sql/sql_class.h:
  Auto merged
sql/sql_yacc.yy:
  Auto merged
client/mysqldump.c:
  Merge main->rpl
mysql-test/r/mysqldump.result:
  Merge main->rpl
mysql-test/t/mysqldump.test:
  Merge main->rpl
2006-09-15 01:26:28 +02:00
unknown
70bb923a37 Fix WARN_DEPRECATED for 5.0 (it is in 5.1 we should have the extra arguments) 2006-09-11 14:45:40 +02:00
unknown
e573a77592 Merge mysql.com:/users/lthalmann/bk/MERGE/mysql-4.1-merge
into  mysql.com:/users/lthalmann/bk/MERGE/mysql-5.0-merge


sql/sql_yacc.yy:
  Manual merge (rpl 4.1 -> rpl 5.0)
2006-09-11 13:50:41 +02:00
unknown
4ef211eee0 after merge fix
sql/mysql_priv.h:
  after merge fix
  added charset parameter to check_string_length() function
sql/slave.h:
  after merge fix
  USERNAME_LENGTH const is changed to USERNAME_BYTE_LENGTH
sql/sql_parse.cc:
  after merge fix
  added charset parameter to check_string_length() function
sql/sql_yacc.yy:
  after merge fix
  added charset parameter to check_string_length() function
2006-09-08 16:16:39 +05:00
unknown
0eb5442fd9 Bug #21772: can not name a column 'upgrade' when create a table in version 5.0.24
Upgrade was a reserved word. Unreserve UPGRADE so it can be used in unquoted identifiers.


mysql-test/r/create.result:
  Bug #21772: can not name a column 'upgrade' when create a table in version 5.0.24
   - test case
mysql-test/t/create.test:
  Bug #21772: can not name a column 'upgrade' when create a table in version 5.0.24
   - test case
sql/sql_yacc.yy:
  Bug #21772: can not name a column 'upgrade' when create a table in version 5.0.24
   - unreserve UPGRADE.
2006-09-08 13:10:14 +03:00
unknown
ff1d115e3a Merge gkodinov@bk-internal.mysql.com:/home/bk/mysql-4.1-opt
into  rakia.(none):/home/kgeorge/mysql/autopush/B21392-4.1-opt


sql/sql_parse.cc:
  Auto merged
sql/sql_yacc.yy:
  Auto merged
2006-09-05 13:12:30 +03:00
unknown
09df2612b2 Merge gkodinov@bk-internal.mysql.com:/home/bk/mysql-5.0-opt
into  rakia.(none):/home/kgeorge/mysql/autopush/B21392-5.0-opt


sql/sql_yacc.yy:
  Auto merged
2006-09-04 19:21:25 +03:00
unknown
18ed9144bb Merge macbook.gmz:/Users/kgeorge/mysql/work/B21392-4.1-opt
into  macbook.gmz:/Users/kgeorge/mysql/work/B21392-5.0-opt


mysql-test/t/delete.test:
  Auto merged
sql/mysql_priv.h:
  Auto merged
sql/sql_yacc.yy:
  Auto merged
mysql-test/r/delete.result:
  merge 4.1->5.0
sql/sql_parse.cc:
  merge 4.1->5.0
2006-09-04 18:45:48 +03:00
unknown
1431966d02 Bug #21392: multi-table delete with alias table name fails with
1003: Incorrect table name
in multi-table DELETE the set of tables to delete from actually 
references then tables in the other list, e.g:
DELETE alias_of_t1 FROM t1 alias_of_t1 WHERE ....
is a valid statement.
So we must turn off table name syntactical validity check for alias_of_t1 
because it's not a table name (even if it looks like one).
In order to do that we add a special flag (TL_OPTION_ALIAS) to 
disable the name checking for the aliases in multi-table DELETE.


mysql-test/r/delete.result:
  Bug #21392: multi-table delete with alias table name fails with
              1003: Incorrect table name
   - test case
mysql-test/t/delete.test:
  Bug #21392: multi-table delete with alias table name fails with
              1003: Incorrect table name
   - test case
sql/mysql_priv.h:
  Bug #21392: multi-table delete with alias table name fails with
              1003: Incorrect table name
   - add a special flag to disable the name checking for the aliases
     in multi-table DELETE
sql/sql_parse.cc:
  Bug #21392: multi-table delete with alias table name fails with
              1003: Incorrect table name
   - add a special flag to disable the name checking for the aliases
     in multi-table DELETE
sql/sql_yacc.yy:
  Bug #21392: multi-table delete with alias table name fails with
              1003: Incorrect table name
   - add a special flag to disable the name checking for the aliases
     in multi-table DELETE
2006-09-04 18:40:30 +03:00
unknown
259689f87f Merge bk-internal:/home/bk/mysql-5.0-opt
into  neptunus.(none):/home/msvensson/mysql/mysql-5.0


sql/sql_lex.cc:
  Auto merged
sql/sql_lex.h:
  Auto merged
sql/sql_yacc.yy:
  Auto merged
2006-09-04 11:39:58 +02:00
unknown
a0e959271d Merge gkodinov@bk-internal.mysql.com:/home/bk/mysql-5.0-opt
into  rakia.(none):/home/kgeorge/mysql/autopush/B14654-5.0-opt


mysql-test/r/subselect.result:
  Auto merged
mysql-test/t/subselect.test:
  Auto merged
sql/sql_yacc.yy:
  Auto merged
2006-09-04 11:34:32 +03:00
unknown
dd6dc7adea BUG#21477 "memory overruns for certain kinds of subqueries":
make st_select_lex::setup_ref_array() take into account that 
Item_sum-descendant objects located within descendant SELECTs
may be added into ref_pointer_array.


sql/item_sum.cc:
  BUG#21477 "memory overruns for certain kinds of subqueries":
  Make SELECT_LEX::n_sum_items contain # of Item_sum-derived objects
  that exist within this SELECT.
sql/sql_lex.h:
  BUG#21477 "memory overruns for certain kinds of subqueries":
  Add SELECT_LEX::n_sum_items and SELECT_LEXT::n_child_sum_items.
sql/sql_yacc.yy:
  BUG#21477 "memory overruns for certain kinds of subqueries":
  Make SELECT_LEX::n_sum_items contain # of Item_sum-derived objects
  that exist within this SELECT.
2006-09-01 13:23:43 +04:00
unknown
5bd9bf5572 Merge maint2.mysql.com:/data/localhome/tsmith/bk/41
into  maint2.mysql.com:/data/localhome/tsmith/bk/50


mysql-test/r/ctype_utf8.result:
  Auto merged
mysql-test/t/ctype_utf8.test:
  Auto merged
sql/net_serv.cc:
  Auto merged
sql/sql_lex.cc:
  Auto merged
sql/sql_select.cc:
  Auto merged
sql/sql_yacc.yy:
  Auto merged
vio/viosocket.c:
  Auto merged
client/mysql.cc:
  Manual merge.
mysql-test/t/ctype_recoding.test:
  Manual merge.
sql/sql_lex.h:
  SCCS merged
sql/sql_table.cc:
  Manual merge.
mysql-test/r/ctype_recoding.result:
  Manual merge
2006-09-01 08:53:56 +02:00
unknown
c9bba13aee Bug#14654 : Cannot select from the same table twice within a UNION statement
Made the parser to support parenthesis around UNION branches.
 This is done by amending the rules of the parser so it generates the correct
 structure.
 Currently it supports arbitrary subquery/join/parenthesis operations in the 
 EXISTS clause. 
 In the IN/scalar subquery case it will allow adding nested parenthesis only 
 if there is an UNION clause after the parenthesis. Otherwise it will just  
 treat the multiple nested parenthesis as a scalar expression.
 It adds extra lex level for ((SELECT ...) UNION ...) to accommodate for the
 UNION clause.


mysql-test/r/subselect.result:
  Bug#14654 : Cannot select from the same table twice within a UNION statement
   - test cases
mysql-test/t/subselect.test:
  Bug#14654 : Cannot select from the same table twice within a UNION statement
   - test cases
sql/sql_yacc.yy:
  Bug#14654 : Cannot select from the same table twice within a UNION statement
   - shuffle around the rules for the parenthesis in subselect
2006-08-31 18:00:25 +03:00
unknown
9c09d53312 BUG#18822 LOAD DATA FROM MASTER corrupts data
there is a bunch of dups. It has been decided to declare this feature as
deprecated.
  


sql/sql_yacc.yy:
  deprecation macro
2006-08-31 02:00:40 +03:00
unknown
8ea5f31a46 Merge bk-internal.mysql.com:/home/bk/mysql-5.0
into  bodhi.local:/opt/local/work/mysql-5.0-14897


configure.in:
  Auto merged
mysql-test/mysql-test-run.pl:
  Auto merged
mysql-test/r/im_life_cycle.result:
  Auto merged
mysql-test/t/im_life_cycle.imtest:
  Auto merged
sql/field.cc:
  Auto merged
sql/item.cc:
  Auto merged
sql/item.h:
  Auto merged
sql/item_cmpfunc.cc:
  Auto merged
sql/item_func.cc:
  Auto merged
sql/item_strfunc.cc:
  Auto merged
sql/item_strfunc.h:
  Auto merged
sql/mysql_priv.h:
  Auto merged
sql/mysqld.cc:
  Auto merged
sql/sql_acl.cc:
  Auto merged
sql/sql_class.cc:
  Auto merged
sql/sql_parse.cc:
  Auto merged
sql/sql_view.cc:
  Auto merged
sql/sql_yacc.yy:
  Auto merged
sql/share/errmsg.txt:
  Auto merged
mysql-test/r/grant.result:
  Manual merge.
mysql-test/r/view.result:
  Manual merge.
mysql-test/t/grant.test:
  Manual merge.
mysql-test/t/view.test:
  Manual merge.
2006-08-30 00:45:33 +04:00
unknown
133d2aa599 Fix for bug#21795: SP: sp_head::is_not_allowed_in_function() contains
erroneous check

Problem: Actually there were two problems in the server code. The check
for SQLCOM_FLUSH in SF/Triggers were not according to the existing
architecture which uses sp_get_flags_for_command() from sp_head.cc .
This function was also missing a check for SQLCOM_FLUSH which has a
problem combined with prelocking. This changeset fixes both of these
deficiencies as well as the erroneous check in
sp_head::is_not_allowed_in_function() which was a copy&paste error.


mysql-test/r/sp-error.result:
  update result
mysql-test/r/trigger.result:
  update result
mysql-test/t/sp-error.test:
  FLUSH can create a problem with prelocking, hence it's disabled.
  There is a better way to check this than a check in the parser.
  Now we use sp_get_flags_for_command() and the error returned is
  different.
mysql-test/t/trigger.test:
  FLUSH can create a problem with prelocking, hence it's disabled.
  There is a better way to check this than a check in the parser.
  Now we use sp_get_flags_for_command() and the error returned is
  different.
sql/sp_head.cc:
  FLUSH and RESET are not allowed inside a SF/Trigger.
  Because they don't imply a COMMIT sp_head::HAS_COMMIT_OR_ROLLBACK
  cannot be used. Two new flags were introduced for that reason.
sql/sp_head.h:
  Don't check m_type as this check is erroneous. This is probably
  a copy and paste error when moving code from somewhere else. Another
  fact which supports this was prefixing the enum value with the name
  of class sp_head.
  
  Adding two new flags HAS_SQLCOM_RESET and HAS_SQLCOM_FLUSH. The values
  are 2048 and 4096 because in the 5.1 branch there are already new flags
  which are with values up-to 1024.
sql/sql_parse.cc:
  FLUSH can cause a problem with prelocking in SF/Trigger and
  therefore is already disabled. RESET is also disabled because
  is handled by the same code as FLUSH. We won't allow RESET inside
  SF/Trigger at that stage without thorough analysis. The check for
  them is already done in the parser by calling
  is_not_allowed_in_function()
sql/sql_yacc.yy:
  By listing SQLCOM_FLUSH as command which implies COMMIT
  in sp_get_flags_for_command() the check in sql_yacc.yy is
  obsolete.
2006-08-25 15:51:29 +02:00
unknown
f96ee72fb0 Fix for BUG#16899: Possible buffer overflow in handling of DEFINER-clause
User name (host name) has limit on length. The server code relies on these
limits when storing the names. The problem was that sometimes these limits
were not checked properly, so that could lead to buffer overflow.

The fix is to check length of user/host name in parser and if string is too
long, throw an error.


mysql-test/r/grant.result:
  Updated result file.
mysql-test/r/sp.result:
  Updated result file.
mysql-test/r/trigger.result:
  Updated result file.
mysql-test/r/view.result:
  Updated result file.
mysql-test/t/grant.test:
  Added test for BUG#16899.
mysql-test/t/sp.test:
  Added test for BUG#16899.
mysql-test/t/trigger.test:
  Added test for BUG#16899.
mysql-test/t/view.test:
  Added test for BUG#16899.
sql/mysql_priv.h:
  Added prototype for new function.
sql/share/errmsg.txt:
  Added new resources.
sql/sql_acl.cc:
  Remove outdated checks.
sql/sql_parse.cc:
  Add a new function for checking string length.
sql/sql_yacc.yy:
  Check length of user/host name.
2006-08-23 21:31:00 +04:00
unknown
cd2c9eeccb WL#3432 (Compile the Parser with a --debug --verbose option)
Corrected build issues : the build can not be conditional.
to keep a unique source .tar.gz distribution.


configure.in:
  Rolling back previous change
sql/Makefile.am:
  Partially rolling back previous change.
  The build has to be unconditional, for the source .tar.gz distribution
sql/mysql_priv.h:
  WL#3432 (Compile the Parser with a --debug --verbose option)
sql/sql_parse.cc:
  WL#3432 (Compile the Parser with a --debug --verbose option)
  
  Moved turn_parser_debug_on to sql_yacc.yy
sql/sql_yacc.yy:
  WL#3432 (Compile the Parser with a --debug --verbose option)
  
  Moved turn_parser_debug_on to sql_yacc.yy
2006-08-18 19:16:07 -07:00
unknown
fe3dee0621 Fix for bug #20695: Charset introducer overrides charset definition for column.
- if there are two character set definitions in the column declaration,
    we replace the first one with the second one as we store both in the LEX->charset
    slot. Add a separate slot to the LEX structure to store underscore charset.
  - convert default values to the column charset of STRING, VARSTRING fields 
    if necessary as well.


mysql-test/r/ctype_recoding.result:
  Fix for bug #20695: Charset introducer overrides charset definition for column.
    - test result.
mysql-test/t/ctype_recoding.test:
  Fix for bug #20695: Charset introducer overrides charset definition for column.
    - test case.
sql/sql_lex.cc:
  Fix for bug #20695: Charset introducer overrides charset definition for column.
    - LEX->underscore_charset introduced to store UNDERSCORE_CHARSET
sql/sql_lex.h:
  Fix for bug #20695: Charset introducer overrides charset definition for column.
    - LEX->underscore_charset introduced to store UNDERSCORE_CHARSET
sql/sql_table.cc:
  Fix for bug #20695: Charset introducer overrides charset definition for column.
    - convert default values to the column charset of VARSTRING, STRING, ENUM, 
      SET fields if necessary.
sql/sql_yacc.yy:
  Fix for bug #20695: Charset introducer overrides charset definition for column.
    - LEX->underscore_charset introduced to store UNDERSCORE_CHARSET
2006-08-15 15:24:07 +05:00
unknown
9672ef612e Bug#16172 DECIMAL data type processed incorrectly
issue an error in case of DECIMAL(M,N) if N > M


mysql-test/r/type_newdecimal.result:
  Bug#16172 DECIMAL data type processed incorrectly
  result fix & test case
mysql-test/t/type_newdecimal.test:
  Bug#16172 DECIMAL data type processed incorrectly
  test fix
2006-08-08 14:40:07 +05:00
unknown
ed44a2ee51 Merge neptunus.(none):/home/msvensson/mysql/mysql-5.0
into  neptunus.(none):/home/msvensson/mysql/mysql-5.0-maint


client/mysql.cc:
  Auto merged
client/mysqltest.c:
  Auto merged
mysql-test/mysql-test-run.pl:
  Auto merged
mysql-test/r/date_formats.result:
  Auto merged
mysql-test/r/union.result:
  Auto merged
mysql-test/t/union.test:
  Auto merged
sql/field.cc:
  Auto merged
sql/item.cc:
  Auto merged
sql/item_func.cc:
  Auto merged
sql/item_func.h:
  Auto merged
sql/item_strfunc.cc:
  Auto merged
sql/item_strfunc.h:
  Auto merged
sql/item_subselect.cc:
  Auto merged
sql/item_sum.cc:
  Auto merged
sql/sql_yacc.yy:
  Auto merged
mysql-test/r/func_group.result:
  Merge manually
mysql-test/t/func_group.test:
  Merge manually
2006-08-03 09:32:58 +02:00
unknown
e44e344cac Merge bk-internal.mysql.com:/home/bk/mysql-5.0
into  bodhi.local:/opt/local/work/mysql-5.0-runtime-merge


sql/item.cc:
  Auto merged
sql/item_func.cc:
  Auto merged
sql/item_func.h:
  Auto merged
sql/mysql_priv.h:
  Auto merged
sql/sql_lex.h:
  Auto merged
sql/sql_parse.cc:
  Auto merged
sql/sql_show.cc:
  Auto merged
sql/sql_view.cc:
  Auto merged
sql/sql_yacc.yy:
  Auto merged
sql/table.h:
  Auto merged
mysql-test/r/sp.result:
  Manual merge.
mysql-test/r/udf.result:
  Manual merge.
mysql-test/t/sp.test:
  Manual merge.
mysql-test/t/udf.test:
  Manual merge.
2006-08-02 21:54:10 +04:00
unknown
f3919e9284 Merge bk-internal.mysql.com:/home/bk/mysql-5.0
into  bodhi.local:/opt/local/work/mysql-5.0-runtime-merge


include/mysql.h:
  Auto merged
include/sql_common.h:
  Auto merged
libmysql/libmysql.c:
  Auto merged
mysql-test/mysql-test-run.pl:
  Auto merged
mysql-test/r/mysqldump.result:
  Auto merged
mysql-test/t/udf.test:
  Auto merged
ndb/src/mgmsrv/ConfigInfo.cpp:
  Auto merged
sql/item.cc:
  Auto merged
sql/item_func.h:
  Auto merged
sql/mysql_priv.h:
  Auto merged
sql/slave.cc:
  Auto merged
sql/sp.cc:
  Auto merged
sql/sql_lex.cc:
  Auto merged
sql/sql_parse.cc:
  Auto merged
sql-common/client.c:
  Auto merged
sql/sql_yacc.yy:
  Auto merged
sql/table.h:
  Auto merged
mysql-test/r/ps.result:
  Manual merge.
mysql-test/r/sp.result:
  Manual merge.
mysql-test/t/ps.test:
  Manual merge.
mysql-test/t/sp.test:
  Manual merge.
sql/sql_prepare.cc:
  Manual merge.
sql/table.cc:
  Manual merge.
tests/mysql_client_test.c:
  Manual merge.
2006-08-02 14:13:01 +04:00
unknown
1081dd6f0d Merge neptunus.(none):/home/msvensson/mysql/mysql-5.0
into  neptunus.(none):/home/msvensson/mysql/mysql-5.0-maint


configure.in:
  Auto merged
client/mysql.cc:
  Auto merged
client/mysqldump.c:
  Auto merged
mysql-test/mysql-test-run.pl:
  Auto merged
mysql-test/r/date_formats.result:
  Auto merged
mysql-test/r/federated.result:
  Auto merged
mysql-test/r/func_time.result:
  Auto merged
mysql-test/r/mysql.result:
  Auto merged
mysql-test/r/type_ranges.result:
  Auto merged
mysql-test/t/func_time.test:
  Auto merged
mysql-test/t/mysql.test:
  Auto merged
sql/field.cc:
  Auto merged
sql/item_strfunc.cc:
  Auto merged
sql/item_strfunc.h:
  Auto merged
sql/item_subselect.cc:
  Auto merged
sql/item_timefunc.cc:
  Auto merged
sql/mysqld.cc:
  Auto merged
sql/sql_class.h:
  Auto merged
sql/sql_yacc.yy:
  Auto merged
2006-08-01 20:24:30 +02:00
unknown
d251e9be43 Bug#21269 (DEFINER-clause is allowed for UDF-functions)
The problem was that the grammar allows to create a function with an optional
definer clause, and define it as a UDF with the SONAME keyword.
Such combination should be reported as an error.

The solution is to not change the grammar itself, and to introduce a
specific check in the yacc actions in 'create_function_tail' for UDF,
that now reports ER_WRONG_USAGE when using both DEFINER and SONAME.


mysql-test/r/udf.result:
  Added tests for Bug#21269 (DEFINER-clause is allowed for UDF-functions)
mysql-test/t/udf.test:
  Added tests for Bug#21269 (DEFINER-clause is allowed for UDF-functions)
sql/sql_yacc.yy:
  Creating a UDF function with a DEFINER clause is now a syntax error.
2006-07-31 12:01:43 -07:00
unknown
c8673b09b8 Bug #21080: ALTER VIEW makes user restate SQL SECURITY mode, and ALGORITHM
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
2006-07-31 17:33:37 +03:00
unknown
3c10858474 Fix for BUG#16211: Stored function return type for strings is ignored.
Fix for BUG#16676: Database CHARSET not used for stored procedures

The problem in BUG#16211 is that CHARSET-clause of the return type for
stored functions is just ignored.

The problem in BUG#16676 is that if character set is not explicitly
specified for sp-variable, the server character set is used instead
of the database one.

The fix has two parts:

  - always store CHARSET-clause of the return type along with the
    type definition in mysql.proc.returns column. "Always" means that
    CHARSET-clause is appended even if it has not been explicitly
    specified in CREATE FUNCTION statement (this affects BUG#16211 only).

    Storing CHARSET-clause if it is not specified is essential to avoid
    changing character set if the database character set is altered in
    the future.

    NOTE: this change is not backward compatible with the previous releases.

  - use database default character set if CHARSET-clause is not explicitly
    specified (this affects both BUG#16211 and BUG#16676).

    NOTE: this also breaks backward compatibility.


mysql-test/r/mysqldump.result:
  Updated result file.
mysql-test/r/sp.result:
  Updated result file.
mysql-test/t/sp.test:
  Provided test cases for BUG#16211, BUG#16676.
sql/mysql_priv.h:
  Added two convenient functions for work with databases.
sql/sp.cc:
  1. Add CHARSET-clause to CREATE-statement if it has been explicitly specified.
  2. Polishing -- provided some comments.
sql/sp_head.cc:
  Use database charset as default charset of sp-variable.
sql/sp_head.h:
  Move init_sp_name() out of init_strings().
sql/sql_db.cc:
  Two new functions created:
    - load_db_opt_by_name();
    - check_db_dir_existence();
sql/sql_show.cc:
  Eliminate duplicated code by using
  check_db_dir_existence() and load_db_opt_by_name()
sql/sql_table.cc:
  Eliminate duplicated code by using
  check_db_dir_existence() and load_db_opt_by_name()
sql/sql_yacc.yy:
  Call sp_head::init_sp_name() to initialize stored routine name.
2006-07-27 17:57:43 +04:00
unknown
12d6b9c7f1 Merge moonlight.intranet:/home/tomash/src/mysql_ab/mysql-5.0
into  moonlight.intranet:/home/tomash/src/mysql_ab/mysql-5.0-bug19207


sql/sql_yacc.yy:
  Auto merged
2006-07-22 00:08:45 +04:00
unknown
1c96f2d73e Fixed bug#10977: No warning issued if a column name is truncated
When an alias is set to a column leading spaces are removed from the alias.
But when this is done on aliases set by user this can lead to confusion.

Now Item::set_name() method issues the warning if leading spaces were removed
from an alias set by user.

New warning message is added.


mysql-test/t/select.test:
  Added test case for bug#10977:No warning issued if a column name is truncated.
mysql-test/r/select.result:
  Added test case for bug#10977:No warning issued if a column name is truncated.
sql/sql_yacc.yy:
  Fixed bug#10977: No warning issued if a column name is truncated
  The is_autogenerated_name flag is set before set_name() method call.
sql/item.cc:
  Fixed bug#10977: No warning issued if a column name is truncated
  Now Item::set_name() method issues the warning if leading spaces were removed
  from an alias set by user.
2006-07-16 00:45:38 +04:00
unknown
2fc276d54f Bug #17903: cast to char results in binary
The character set was not being properly initialized in CAST() with
  a type like "CHAR(2) BINARY", which resulted in incorrect results or
  even a crash.


mysql-test/r/cast.result:
  Add new results
mysql-test/t/cast.test:
  Add new regression test
sql/sql_yacc.yy:
  Make sure Lex->charset is set to NULL when nothing follows BINARY
  in type declaration.
2006-07-12 13:22:38 -07:00
unknown
f5340f8c7d Merge bodhi.local:/opt/local/work/mysql-5.0-root
into  bodhi.local:/opt/local/work/mysql-5.0-runtime


sql/ha_ndbcluster.cc:
  Auto merged
sql/item.cc:
  Auto merged
sql/mysql_priv.h:
  Auto merged
sql/sql_parse.cc:
  Auto merged
sql/sql_table.cc:
  Auto merged
sql/sql_yacc.yy:
  Auto merged
sql/sql_update.cc:
  Manual merge.
2006-07-07 22:09:43 +04:00
unknown
7733615d8d Bug#19207: Final parenthesis omitted for CREATE INDEX in Stored Procedure
Wrong criteria was used to distinguish the case when there was no
lookahead performed in the parser.  Bug affected only statements
ending in one-character token without any optional tail, like CREATE
INDEX and CALL.


mysql-test/r/sp-code.result:
  Add result for bug#19207: Final parenthesis omitted for CREATE INDEX
  in Stored Procedure
mysql-test/t/sp-code.test:
  Add test case for bug#19207: Final parenthesis omitted for CREATE INDEX
  in Stored Procedure
sql/sql_yacc.yy:
  Use (yychar == YYEMPTY) as the criteria of whether lookahead was not
  performed.
2006-07-07 21:24:54 +04:00