Commit graph

13171 commits

Author SHA1 Message Date
unknown
fce7280591 Fix spelling (recursivity -> recursion)
mysql-test/r/events.result:
  Fix spelling.
mysql-test/r/events_bugs.result:
  Fix spelling.
mysql-test/r/ps.result:
  Fix spelling.
mysql-test/t/events.test:
  Fix spelling.
mysql-test/t/events_bugs.test:
  Fix spelling.
mysql-test/t/ps.test:
  Fix spelling.
sql/sql_yacc.yy:
  Fix spelling.
sql/share/errmsg.txt:
  Fix spelling.
2007-03-27 22:15:51 +04:00
unknown
e557e0fdd0 Merge kpdesk.mysql.com:/home/thek/dev/mysql-5.0-runtime
into  kpdesk.mysql.com:/home/thek/dev/mysql-5.1-runtime


mysql-test/t/sp.test:
  Auto merged
sql/item_func.cc:
  Auto merged
mysql-test/r/sp.result:
  null merge
2007-03-27 18:14:53 +02:00
unknown
e4dcf4e39c Corrected error in test case:
- 1.84e+15 converted to unsigned bigint should be
  18400000000000000000 < 18446744073709551615.
- The test will still fail on windows, and is extracted
  into a new bug report.
2007-03-27 18:05:17 +02:00
unknown
d9b8e466bf Remove files that were checked in by mistake.
BitKeeper/deleted/.del-events_restart_phase0.log:
  Delete: mysql-test/t/events_restart_phase0.log
BitKeeper/deleted/.del-events_restart_phase0.result:
  Delete: mysql-test/t/events_restart_phase0.result
BitKeeper/deleted/.del-events_restart_phase0.result~7954c29cea87c6f7:
  Delete: mysql-test/r/events_restart_phase0.result
2007-03-24 13:13:54 +03:00
unknown
cec241f456 Merge naruto.:C:/cpp/bug20777/my50-bug20777
into  naruto.:C:/cpp/mysql-5.0-runtime


mysql-test/r/sp.result:
  manual merge
mysql-test/t/sp.test:
  manual merge
sql/item_func.cc:
  manual merge
2007-03-23 19:14:13 +01:00
unknown
40a197ee9f Merge kpettersson@bk-internal:/home/bk/mysql-5.1-runtime
into  naruto.:C:/cpp/mysql-5.1-runtime


sql/item_func.cc:
  Auto merged
mysql-test/r/sp.result:
  manual merge
mysql-test/t/sp.test:
  manual merge
2007-03-23 18:13:21 +01:00
unknown
20fd65ff83 Try to fix events_logs_tests race on Windows.
mysql-test/t/events_logs_tests.test:
  Try to fix a race condition that breaks this test on Windows.
2007-03-22 00:09:50 +03:00
unknown
817442e873 Merge bk-internal.mysql.com:/home/bk/mysql-5.1
into  bodhi.local:/opt/local/work/mysql-5.1-runtime
2007-03-21 23:59:37 +03:00
unknown
54a0f623c7 Merge bk-internal.mysql.com:/home/bk/mysql-5.0
into  bodhi.local:/opt/local/work/mysql-5.0-runtime
2007-03-21 23:57:12 +03:00
unknown
56fc016b81 Merge naruto.:C:/cpp/bug20777/my51-bug20777
into  naruto.:C:/cpp/mysql-5.1-runtime


sql/item_func.cc:
  Auto merged
mysql-test/r/sp.result:
  Manual merge
mysql-test/t/sp.test:
  Manuel merge
2007-03-20 17:23:28 +01:00
unknown
ca16e7038c Merge moonbone.local:/mnt/gentoo64/work/27006-bug-5.0-opt-mysql
into  moonbone.local:/mnt/gentoo64/work/test-5.1-opt-mysql


mysql-test/r/trigger.result:
  Auto merged
mysql-test/t/trigger.test:
  Auto merged
sql/sql_insert.cc:
  Manually merged.
2007-03-20 01:29:09 +03:00
unknown
3798a7d500 sql_insert.cc:
Removed wrong fix for the bug#27006.
  The bug was added by the fix for the bug#19978 and fixed by Monty on 2007/02/21.
trigger.test, trigger.result:
  Corrected test case for the bug#27006.


sql/sql_insert.cc:
  Removed wrong fix for the bug#27006.
  The bug was added by the fix for the bug#19978 and fixed by Monty on 2007/02/21.
mysql-test/t/trigger.test:
  Corrected test case for the bug#27006.
mysql-test/r/trigger.result:
  Corrected test case for the bug#27006.
2007-03-20 00:46:19 +03:00
unknown
e9bb08ac0c Merge bk-internal.mysql.com:/home/bk/mysql-5.1
into  bodhi.local:/opt/local/work/mysql-5.1-runtime


include/my_global.h:
  Auto merged
mysql-test/mysql-test-run.pl:
  Auto merged
mysql-test/r/events_scheduling.result:
  Auto merged
BitKeeper/deleted/.del-init_db.sql~a77d572c39d5a1f8:
  Auto merged
BitKeeper/deleted/.del-mysql_create_system_tables.sh:
  Auto merged
mysql-test/r/query_cache.result:
  Auto merged
mysql-test/r/view.result:
  Auto merged
mysql-test/t/events_scheduling.test:
  Auto merged
mysql-test/t/grant_cache.test:
  Auto merged
mysql-test/t/query_cache.test:
  Auto merged
mysql-test/t/view.test:
  Auto merged
scripts/mysql_system_tables_fix.sql:
  Auto merged
sql/event_db_repository.cc:
  Auto merged
sql/event_queue.cc:
  Auto merged
sql/field.cc:
  Auto merged
sql/handler.cc:
  Auto merged
sql/handler.h:
  Auto merged
sql/item.cc:
  Auto merged
sql/item.h:
  Auto merged
sql/item_func.cc:
  Auto merged
sql/item_subselect.cc:
  Auto merged
sql/log_event.cc:
  Auto merged
sql/mysql_priv.h:
  Auto merged
sql/mysqld.cc:
  Auto merged
sql/set_var.cc:
  Auto merged
sql/sp.cc:
  Auto merged
sql/sp_head.cc:
  Auto merged
sql/sp_head.h:
  Auto merged
sql/sql_base.cc:
  Auto merged
sql/sql_class.cc:
  Auto merged
sql/sql_class.h:
  Auto merged
sql/sql_help.cc:
  Auto merged
sql/sql_lex.cc:
  Auto merged
sql/sql_lex.h:
  Auto merged
sql/sql_parse.cc:
  Auto merged
sql/sql_prepare.cc:
  Auto merged
sql/sql_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/share/errmsg.txt:
  Auto merged
sql/tztime.cc:
  Auto merged
storage/innobase/handler/ha_innodb.cc:
  Auto merged
storage/myisam/ha_myisam.cc:
  Auto merged
storage/myisam/ha_myisam.h:
  Auto merged
mysql-test/r/skip_grants.result:
  Manualmerge.
mysql-test/r/sp.result:
  Manualmerge.
mysql-test/t/skip_grants.test:
  Manualmerge.
mysql-test/t/sp.test:
  Manualmerge.
sql/event_data_objects.cc:
  Manualmerge.
2007-03-20 00:42:11 +03:00
unknown
14ab9bef52 Merge bk-internal.mysql.com:/home/bk/mysql-5.0
into  bodhi.local:/opt/local/work/mysql-5.0-runtime


sql/field.cc:
  Auto merged
sql/item.cc:
  Auto merged
sql/item.h:
  Auto merged
sql/item_func.cc:
  Auto merged
sql/sp_head.cc:
  Auto merged
sql/sql_base.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
mysql-test/r/sp.result:
  SCCS merged
mysql-test/t/sp.test:
  SCCS merged
2007-03-19 23:59:53 +03:00
unknown
f5ca94684a Merge moonbone.local:/mnt/gentoo64/work/27006-bug-5.0-opt-mysql
into  moonbone.local:/mnt/gentoo64/work/test-5.1-opt-mysql


mysql-test/r/trigger.result:
  Auto merged
mysql-test/t/trigger.test:
  Auto merged
sql/sql_insert.cc:
  Manually merged
2007-03-16 22:20:24 +03:00
unknown
793c30612a Merge mysql.com:/home/hf/work/mrg/mysql-5.0-opt
into  mysql.com:/home/hf/work/mrg/mysql-5.1-opt


mysql-test/r/insert_update.result:
  Auto merged
mysql-test/t/insert_update.test:
  Auto merged
mysql-test/t/skip_grants.test:
  Auto merged
sql/mysql_priv.h:
  Auto merged
sql/sql_acl.cc:
  Auto merged
sql/sql_prepare.cc:
  Auto merged
sql/sql_insert.cc:
  merging
2007-03-16 22:09:10 +04:00
unknown
c01a4f9b1e Merge naruto.:C:/cpp/bug20777/my50-bug20777
into  naruto.:C:/cpp/bug20777/my51-bug20777


mysql-test/t/sp.test:
  Auto merged
sql/item_func.h:
  Auto merged
mysql-test/r/sp.result:
  Manual merge
sql/item_func.cc:
  Manual merge
2007-03-16 18:17:27 +01:00
unknown
354e15f068 Merge moonlight.home:/home/tomash/src/mysql_ab/mysql-5.1
into  moonlight.home:/home/tomash/src/mysql_ab/mysql-5.1-wl3698
2007-03-16 18:02:43 +03:00
unknown
086fba7627 BUG#16420: Events: timestamps become UTC
BUG#26429: SHOW CREATE EVENT is incorrect for an event that
           STARTS NOW()
BUG#26431: Impossible to re-create an event from backup if its
           STARTS clause is in the past
WL#3698: Events: execution in local time zone

The problem was that local times specified by the user in AT, STARTS
and ENDS of CREATE EVENT/ALTER EVENT statement were converted to UTC,
and the original time zone was forgotten.  This way, event scheduler
couldn't honor Daylight Saving Time shifts, and times shown to the
user were also in UTC.  Additionally, CREATE EVENT didn't allow times
in the past, thus preventing straightforward event restoration from
old backups.

This patch reworks event scheduler time computations, performing them
in the time zone associated with the event.  Also it allows times to
be in the past.

The patch adds time_zone column to mysql.event table.

NOTE: The patch is almost final, but the bug#9953 should be pushed
first.


client/mysqldump.c:
  Before every CREATE EVENT, output its time zone.
mysql-test/include/wait_condition.inc:
  Add optional $wait_timeout parameter.
mysql-test/lib/init_db.sql:
  Add time_zone column.
mysql-test/r/events.result:
  Update result.
mysql-test/r/events_bugs.result:
  Update result.
mysql-test/r/events_grant.result:
  Update result.
mysql-test/r/events_restart_phase1.result:
  Update result.
mysql-test/r/events_scheduling.result:
  Update result.
mysql-test/r/mysqldump.result:
  Update result.
mysql-test/r/ps.result:
  Update result.
mysql-test/r/system_mysql_db.result:
  Update result.
mysql-test/t/events.test:
  Remove STARTS from the result, as it depends on current time.
mysql-test/t/events_bugs.test:
  Time in the past is no longer an error.
mysql-test/t/events_restart_phase1.test:
  Fill new column 'time_zone' in mysql.event.
mysql-test/t/events_scheduling.test:
  Cleanup: disable event scheduler.
scripts/mysql_create_system_tables.sh:
  Add new column 'time_zone' to mysql.event.
scripts/mysql_fix_privilege_tables.sql:
  Add new column 'time_zone' to mysql.event.
sql/event_data_objects.cc:
  The essence of the change is the following:
   - for internal times use my_time_t instead of TIME.  Assignment and
     comparison is done now on plain numbers.
   - in init_execute_at(), init_starts(), init_ends() convert given time
     to number of seconds since Epoch (aka Unix time, in UTC).
   - handle time_zone field loading and storing.
   - in get_next_time(), Unix time is converted back to event time zone,
     interval is added, and the result is converted to UTC again.
   - fix Event_timed::get_create_event() to report STARTS and ENDS.
   - before executing the event body we set thread time zone to the
     event time zone.
sql/event_data_objects.h:
  Add time_zone member to Event_basic class.
  
  Store internal times in my_time_t (number of seconds since Epoch),
  rather than in broken down TIME structure.
sql/event_db_repository.cc:
  Add time_zone column handling.
  
  Give a warning and do not create an event if its execution time is in
  the past, and ON COMPLETION NOT PRESERVE is set, because such an event
  should be dropped by that time.  Also, do not allow ALTER EVENT to
  set execution time in the past when ON COMPLETION NOT PRESERVE is set.
sql/event_db_repository.h:
  Add enum member for new time zone column.
sql/event_queue.cc:
  Replace handling of broken down times with simple handling of
  my_time_t.
sql/event_queue.h:
  Store internal times in my_time_t (number of seconds since Epoch),
  rather than in broken down TIME structure.
sql/event_scheduler.cc:
  Add TODO comment.
sql/events.cc:
  Send time_zone column for SHOW CREATE EVENT.
sql/share/errmsg.txt:
  Update error message, and add two more errors.
sql/sql_show.cc:
  Add TIME_ZONE column to the output of SHOW EVENTS.
mysql-test/r/events_time_zone.result:
  BitKeeper file /home/tomash/src/mysql_ab/mysql-5.1-wl3698/mysql-test/r/events_time_zone.result
mysql-test/t/events_time_zone.test:
  BitKeeper file /home/tomash/src/mysql_ab/mysql-5.1-wl3698/mysql-test/t/events_time_zone.test
2007-03-16 17:31:07 +03:00
unknown
6d93f15039 Bug#27006: AFTER UPDATE triggers not fired with INSERT ... ON DUPLICATE KEY
UPDATE if the row wasn't actually changed.

This bug was caused by fix for bug#19978. It causes AFTER UPDATE triggers
not firing if a row wasn't actually changed by the update part of the
INSERT .. ON DUPLICATE KEY UPDATE.

Now triggers are always fired if a row is touched by the INSERT ... ON
DUPLICATE KEY UPDATE.


sql/sql_insert.cc:
  Bug#27006: AFTER UPDATE triggers not fired with INSERT ... ON DUPLICATE KEY
  UPDATE if the row wasn't actually changed.
  Now triggers are always fired if a row is touched by the INSERT ... ON
  DUPLICATE KEY UPDATE.
mysql-test/r/trigger.result:
  Added a test case for the bug#27006: AFTER UPDATE triggers not fired with INSERT ... ON DUPLICATE KEY
  UPDATE if the row wasn't actually changed.
mysql-test/t/trigger.test:
  Added a test case for the bug#27006: AFTER UPDATE triggers not fired with INSERT ... ON DUPLICATE KEY
  UPDATE if the row wasn't actually changed.
2007-03-16 17:23:26 +03:00
unknown
c259b5765c Merge kpdesk.mysql.com:/home/thek/dev/bug26807/my51-bug26807
into  kpdesk.mysql.com:/home/thek/dev/mysql-5.1-runtime


sql/mysqld.cc:
  Auto merged
sql/set_var.cc:
  Auto merged
2007-03-16 15:03:43 +01:00
unknown
2b2fb67460 Bug#26807 "set global event_scheduler=1" and --skip-grant-tables crashes server
- Crash occured because Event engine is only initialized if
  ACLs are used but not properly marked as disabled.
- The patch is to mark the Event engine as DISABLED if no ACLs
  are used to avoid access of uninitialized variables.


mysql-test/r/skip_grants.result:
  Added test case
mysql-test/t/skip_grants.test:
  Added test case
2007-03-16 14:57:02 +01:00
unknown
ffc605aad5 Bug#20777 Function w BIGINT UNSIGNED shows diff. behaviour with and without --ps-protocol
- Stored procedures returning unsinged values returns signed values if
  text protocol is used. The reason is that the stored proceedure item
  Item_func_sp wasn't initializing the member variables properly based
  on the information contained in the associated result field.
- The patch is to upon field-item association, ::fix_fields, initialize
  the member variables in appropriate order.
- Field type of an Item_func_sp was hard coded to MYSQL_TYPE_VARCHAR.
  This is changed to return the type of the actual result field.
- Member function name sp_result_field was refactored to the more 
  appropriate init_result_field.
- Member function name find_and_check_access was refactored to 
  sp_check_access.


mysql-test/r/sp.result:
  - Added test
mysql-test/t/sp.test:
  - Added test
sql/item_func.cc:
  Bug#20777 Function w BIGINT UNSIGNED shows diff. behaviour with and without --ps-protocol
  
  - Stored procedures returning unsinged values returns signed values if
    text protocol is used. The reason is that the stored proceedure item
    Item_func_sp wasn't initializing the member variables properly based
    on the information contained in the associated result field.
  - The patch is to upon field-item association, ::fix_fields, initialize
    the member variables in appropriate order.
  - Field type of an Item_func_sp was hard coded to MYSQL_TYPE_VARCHAR.
    This is changed to to return the type of the actual result field.
  - Member function name sp_result_field was refactored to the more 
    appropriate init_result_field.
  - Member function name find_and_check_access was refactored to 
    sp_check_access.
sql/item_func.h:
  Bug#20777 Function w BIGINT UNSIGNED shows diff. behaviour with and without --ps-protocol
  
  - Stored procedures returning unsinged values returns signed values if
    text protocol is used. The reason is that the stored proceedure item
    Item_func_sp wasn't initializing the member variables properly based
    on the information contained in the associated result field.
  - The patch is to upon field-item association, ::fix_fields, initialize
    the member variables in appropriate order.
  - Field type of an Item_func_sp was hard coded to MYSQL_TYPE_VARCHAR.
    This is changed to to return the type of the actual result field.
  - Member function name sp_result_field was refactored to the more 
    appropriate init_result_field.
  - Member function name find_and_check_access was refactored to 
    sp_check_access.
2007-03-16 14:25:11 +01:00
unknown
43b9ff1b21 Merge gkodinov@bk-internal.mysql.com:/home/bk/mysql-5.0-opt
into  magare.gmz:/home/kgeorge/mysql/autopush/B26261-5.0-opt


sql/mysql_priv.h:
  Auto merged
sql/sql_insert.cc:
  Auto merged
sql/sql_prepare.cc:
  Auto merged
mysql-test/r/insert_update.result:
  SCCS merged
mysql-test/t/insert_update.test:
  SCCS merged
2007-03-16 10:50:33 +02:00
unknown
2e8e78a42c Bug #26261:
INSERT uses query_id to verify what fields are
 mentioned in the fields list of the INSERT command.
 However the check for that is made after the 
 ON DUPLICATE KEY is processed. This causes all
 the fields mentioned in ON DUPLICATE KEY to be 
 considered as mentioned in the fields list of 
 INSERT.
 Moved the check up, right after processing the
 fields list.


mysql-test/r/insert_update.result:
  Bug #26261: test case
mysql-test/t/insert_update.test:
  Bug #26261: test case
sql/mysql_priv.h:
  Bug #26261: moved the check inside mysql_prepare_insert
sql/sql_insert.cc:
  Bug #26261: move the check inside mysql_prepare_insert
  before setting up the ON DUPLICATE KEY part
sql/sql_prepare.cc:
  Bug #26261: moved the check inside mysql_prepare_insert
2007-03-16 10:35:39 +02:00
unknown
a51b768600 Bug#26285 selecting information_schema crahes server
The crash happens when 'skip-grant-tables' is enabled.
We skip the filling of I_S privilege tables 
if acl_cache is not initialized.


mysql-test/r/skip_grants.result:
  test result
mysql-test/t/skip_grants.test:
  test case
sql/sql_acl.cc:
  skip filling of I_S privilege tables
  if acl_cache is not initialized
2007-03-16 12:15:51 +04:00
unknown
496f421a69 Merge moonbone.local:/mnt/gentoo64/work/27033-bug-5.0-opt-mysql
into  moonbone.local:/mnt/gentoo64/work/test-5.1-opt-mysql


mysql-test/r/insert_update.result:
  Auto merged
mysql-test/t/insert_update.test:
  Auto merged
sql/sql_class.h:
  Manual merge
sql/sql_insert.cc:
  Manual merge
2007-03-16 00:15:16 +03:00
unknown
c6ab94bdf1 Merge epotemkin@bk-internal.mysql.com:/home/bk/mysql-5.0-opt
into  moonbone.local:/mnt/gentoo64/work/27033-bug-5.0-opt-mysql
2007-03-15 23:56:21 +03:00
unknown
542f18a31a Bug#27033: 0 as LAST_INSERT_ID() after INSERT .. ON DUPLICATE if rows were
touched but not actually changed.

The LAST_INSERT_ID() is reset to 0 if no rows were inserted or changed.
This is the case when an INSERT ... ON DUPLICATE KEY UPDATE updates a row
with the same values as the row contains.

Now the LAST_INSERT_ID() values is reset to 0 only if there were no rows
successfully inserted or touched.
The new 'touched' field is added to the COPY_INFO structure. It holds the
number of rows that were touched no matter whether they were actually
changed or not.


sql/sql_class.h:
  Bug#27033: 0 as LAST_INSERT_ID() after INSERT .. ON DUPLICATE if rows were
  touched but not actually changed.
  
  The new 'touched' field is added to the COPY_INFO structure. It holds the
  number of rows that were touched no matter whether they were actually
  changed or not.
mysql-test/r/insert_update.result:
  Added a test case for the bug#27033: 0 as LAST_INSERT_ID() after INSERT .. ON DUPLICATE if rows were
  touched but not actually changed.
mysql-test/t/insert_update.test:
  Added a test case for the bug#27033: 0 as LAST_INSERT_ID() after INSERT .. ON DUPLICATE if rows were
  touched but not actually changed.
sql/sql_insert.cc:
  Bug#27033: 0 as LAST_INSERT_ID() after INSERT .. ON DUPLICATE if rows were
  touched but not actually changed.
  
  Now the LAST_INSERT_ID() values is reset to 0 only if there were no rows
  successfully inserted or touched.
2007-03-15 23:21:29 +03:00
unknown
b42da2dd01 merging 2007-03-15 17:35:31 +04:00
unknown
f9c2189f7f Merge mysql.com:/home/hf/work/26538/my51-26538
into  mysql.com:/home/hf/work/mrg/mysql-5.1-opt
2007-03-15 16:23:26 +04:00
unknown
b64f46af1f Merge bk@192.168.21.1:mysql-5.1
into  mysql.com:/home/hf/work/mrg/mysql-5.1-opt


mysql-test/r/gis-rtree.result:
  Auto merged
mysql-test/t/gis-rtree.test:
  Auto merged
sql/sql_parse.cc:
  Auto merged
storage/myisam/ha_myisam.cc:
  Auto merged
2007-03-15 16:22:32 +04:00
unknown
b6515184e0 Merge bk@192.168.21.1:mysql-5.0
into  mysql.com:/home/hf/work/mrg/mysql-5.0-opt


mysql-test/r/gis-rtree.result:
  Auto merged
2007-03-15 16:21:43 +04:00
unknown
783b774837 Merge gbichot@bk-internal.mysql.com:/home/bk/mysql-5.1-runtime
into  gbichot3.local:/home/mysql_src/mysql-5.1-runtime-735-realfix


sql/mysql_priv.h:
  Auto merged
sql/set_var.cc:
  Auto merged
sql/sql_prepare.cc:
  Auto merged
2007-03-15 12:11:03 +01:00
unknown
2fad8ac2fc Manual merge from 5.0-runtime to 5.1-runtime 2007-03-14 17:38:06 -06:00
unknown
34a0de585a Merge weblab.(none):/home/marcsql/TREE/mysql-5.0-runtime
into  weblab.(none):/home/marcsql/TREE/mysql-5.1-26503-merge


mysql-test/t/sp-error.test:
  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_subselect.cc:
  Auto merged
sql/log_event.cc:
  Auto merged
sql/sp_head.cc:
  Auto merged
sql/sp_head.h:
  Auto merged
sql/sql_base.cc:
  Auto merged
sql/sql_show.cc:
  Auto merged
sql/sql_table.cc:
  Auto merged
sql/sql_yacc.yy:
  Auto merged
2007-03-14 15:36:11 -06:00
unknown
79344c7b67 Bug#26503 (Illegal SQL exception handler code causes the server to crash)
Before this fix, the parser would accept illegal code in SQL exceptions
handlers, that later causes the runtime to crash when executing the code,
due to memory violations in the exception handler stack.

The root cause of the problem is instructions within an exception handler
that jumps to code located outside of the handler. This is illegal according
to the SQL 2003 standard, since labels located outside the handler are not
supposed to be visible (they are "out of scope"), so any instruction that
jumps to these labels, like ITERATE or LEAVE, should not parse.

The section of the standard that is relevant for this is :
  SQL:2003 SQL/PSM (ISO/IEC 9075-4:2003)
  section 13.1 <compound statement>,
  syntax rule 4
<quote>
  The scope of the <beginning label> is CS excluding every <SQL schema
  statement> contained in CS and excluding every
  <local handler declaration list> contained in CS. <beginning label> shall
  not be equivalent to any other <beginning label>s within that scope.
</quote>

With this fix, the C++ class sp_pcontext, which represent the "parsing
context" tree (a.k.a symbol table) of a stored procedure, has been changed
as follows:
- constructors have been cleaned up, so that only building a root node for
the tree is public; building nodes inside a tree is not public.
- a new member, m_label_scope, indicates if a given syntactic context
belongs to a DECLARE HANDLER block,
- label resolution, in the method find_label(), has been changed to
implement the restriction of scope regarding labels used in a compound
statement.

The actions in the parser, when parsing the body of a SQL exception handler,
have been changed as follows:
- the implementation of an exception handler (DECLARE HANDLER) now creates
explicitly a new sp_pcontext, to isolate the code inside the handler from
the containing compound statement context.
- registering exception handlers as a result occurs in the parent context,
see the rule sp_hcond_element
- the code in sp_hcond_list has been cleaned up, to avoid code duplication

In addition, the flags IN_SIMPLE_CASE and IN_HANDLER, declared in sp_head.h
have been removed, since they are unused and broken by design (as seen with
Bug 19194 (Right recursion in parser for CASE causes excessive stack usage,
limitation), representing a stack in a single flag is not possible.

Tests in sp-error have been added to show that illegal constructs are now
rejected.

Tests in sp have been added for code coverage, to show that ITERATE or LEAVE
statements are legal when jumping to a label in scope, inside the body of
an exception handler.


mysql-test/r/sp-error.result:
  SQL Exception handlers define a parsing context for label resolution.
mysql-test/r/sp.result:
  SQL Exception handlers define a parsing context for label resolution.
mysql-test/t/sp-error.test:
  SQL Exception handlers define a parsing context for label resolution.
mysql-test/t/sp.test:
  SQL Exception handlers define a parsing context for label resolution.
sql/sp_head.cc:
  Minor cleanup
sql/sp_head.h:
  Minor cleanup
sql/sp_pcontext.cc:
  SQL Exception handlers define a parsing context for label resolution.
sql/sp_pcontext.h:
  SQL Exception handlers define a parsing context for label resolution.
sql/sql_yacc.yy:
  SQL Exception handlers define a parsing context for label resolution.
2007-03-14 12:02:32 -06:00
unknown
21e580a1fc Merge bk-internal:/home/bk/mysql-5.1-opt
into  magare.gmz:/home/kgeorge/mysql/autopush/B26794-merge-5.1-opt
2007-03-14 17:05:43 +02:00
unknown
f3a731cadd Merge magare.gmz:/home/kgeorge/mysql/autopush/B26794-5.0-opt
into  magare.gmz:/home/kgeorge/mysql/autopush/B26794-merge-5.1-opt


mysql-test/r/select.result:
  Auto merged
mysql-test/t/select.test:
  Auto merged
sql/field.cc:
  Auto merged
sql/filesort.cc:
  Auto merged
sql/item.cc:
  Auto merged
sql/item.h:
  Auto merged
sql/sql_show.cc:
  Auto merged
sql/sql_table.cc:
  Auto merged
mysql-test/r/alter_table.result:
  merged 5.0-opt -> 5.1-opt
mysql-test/r/gis-rtree.result:
  merged 5.0-opt -> 5.1-opt
mysql-test/r/order_by.result:
  merged 5.0-opt -> 5.1-opt
mysql-test/r/subselect.result:
  merged 5.0-opt -> 5.1-opt
mysql-test/t/alter_table.test:
  merged 5.0-opt -> 5.1-opt
mysql-test/t/order_by.test:
  merged 5.0-opt -> 5.1-opt
mysql-test/t/subselect.test:
  merged 5.0-opt -> 5.1-opt
2007-03-14 17:04:45 +02:00
unknown
2b183b5588 Merge kboortz@bk-internal.mysql.com:/home/bk/mysql-5.1
into  mysql.com:/home/kent/bk/tmp/mysql-5.1-build
2007-03-14 14:32:30 +01:00
unknown
1c02d8c0cd Merge kboortz@bk-internal.mysql.com:/home/bk/mysql-5.0
into  mysql.com:/home/kent/bk/tmp/mysql-5.0-build
2007-03-14 14:30:54 +01:00
unknown
8fa4417890 Merge mhansson@bk-internal.mysql.com:/home/bk/mysql-5.1-opt
into  dl145s.mysql.com:/users/mhansson/mysql/autopush/5.1o-bug24778
2007-03-14 12:44:58 +01:00
unknown
7a3148a7aa Bug #24778: Innodb: No result when using ORDER BY
This bug was intruduced by the fix for bug#17212 (in 4.1). It is not 
ok to call test_if_skip_sort_order since this function will 
alter the execution plan. By contract it is not ok to call 
test_if_skip_sort_order in this context.

This bug appears only in the case when the optimizer has chosen 
an index for accessing a particular table but finds a covering 
index that enables it to skip ORDER BY. This happens in 
test_if_skip_sort_order.


mysql-test/r/key.result:
  Bug#24778
  
  test case.
  
  The bug causes the result to be the empty set.
mysql-test/t/key.test:
  Bug#24778
  
  The minimal test case that reveals the bug. The reason for such a 
  complicated schema is that we have to convince the optimizer to 
  pick one index, then discard it in order to be able to skip 
  ORDER BY.
sql/sql_select.cc:
  bug#24778
  
  Removed the call to test_if_skip_sort_order that constituted the
  bug.
2007-03-14 12:15:14 +01:00
unknown
6e10a2048d Bug #26794: 5.1 part
It was syntactically correct to define 
 spatial keys over parts of columns (e.g.
 ALTER TABLE t1 ADD x GEOMETRY NOT NULL, 
   ADD SPATIAL KEY (x(32))).
 This may lead to undefined results and/or
 interpretation.
 Fixed by not allowing partial column 
 specification in a SPATIAL index definition.


mysql-test/r/alter_table.result:
  Bug #26794: 5.1 part
   test case
mysql-test/r/gis-rtree.result:
  Bug #26794: 5.1 part
   updated the tests to the new syntax
mysql-test/t/alter_table.test:
  Bug #26794: 5.1 part
   test case
mysql-test/t/gis-rtree.test:
  Bug #26794: 5.1 part
   updated the tests to the new syntax
sql/sql_table.cc:
  Bug #26794: 5.1 part
   Disable defining SPATIAL KEYS with sub-key parts
2007-03-14 12:20:34 +02:00
unknown
347e832abf Merge gkodinov@bk-internal.mysql.com:/home/bk/mysql-5.0-opt
into  magare.gmz:/home/kgeorge/mysql/autopush/B26794-5.0-opt


sql/field.cc:
  Auto merged
2007-03-14 11:55:40 +02:00
unknown
a22f257e04 Bug #26794:
Different set of conditions is used to verify
the validity of index definitions over a GEOMETRY
column in ALTER TABLE and CREATE TABLE. 
The difference was on how sub-keys notion validity
is checked.
Fixed by extending the CREATE TABLE condition to
support the cases allowed in ALTER TABLE.
Made the SHOW CREATE TABLE not to display spatial
indexes using the sub-key notion.


mysql-test/r/alter_table.result:
  Bug #26794: test case
mysql-test/r/gis-rtree.result:
  Bug #26794: fixed SHOW CREATE TABLE output.
mysql-test/t/alter_table.test:
  Bug #26794: test case
sql/field.cc:
  Bug #26794: Allow sub-keys for GEOMETRY
sql/sql_show.cc:
  Bug #26794: Don't show sub-key notion 
   in SHOW CREATE TABLE for SPATIAL indexes.
sql/sql_table.cc:
  Bug #26794: Allow sub-keys for GEOMETRY
2007-03-14 11:54:20 +02:00
unknown
4108ca9617 Merge gkodinov@bk-internal.mysql.com:/home/bk/mysql-5.0-opt
into  magare.gmz:/home/kgeorge/mysql/autopush/B26672-5.0-opt


mysql-test/r/order_by.result:
  Auto merged
mysql-test/t/order_by.test:
  Auto merged
2007-03-13 18:46:46 +02:00
unknown
6095508b71 Merge mysql.com:/home/svoj/devel/mysql/BUG26881/mysql-5.0-engines
into  mysql.com:/home/svoj/devel/mysql/BUG26881/mysql-5.1-engines


mysql-test/r/merge.result:
  Auto merged
mysql-test/t/merge.test:
  Auto merged
sql/sql_parse.cc:
  Auto merged
storage/myisam/ha_myisam.cc:
  Auto merged
storage/myisam/mi_create.c:
  Auto merged
2007-03-13 19:05:35 +04:00
unknown
968d1695a7 Merge mysql.com:/home/svoj/devel/mysql/BUG26881/mysql-4.1-engines
into  mysql.com:/home/svoj/devel/mysql/BUG26881/mysql-5.0-engines


myisam/mi_create.c:
  Auto merged
mysql-test/t/merge.test:
  Auto merged
sql/ha_myisam.cc:
  Auto merged
sql/sql_parse.cc:
  Use local.
mysql-test/r/merge.result:
  SCCS merged
2007-03-13 18:11:47 +04:00
unknown
969b71653d BUG#26881 - Large MERGE tables report incorrect specification when no
differences in tables
Certain merge tables were wrongly reported as having incorrect definition:
- Some fields that are 1 byte long (e.g. TINYINT, CHAR(1)), might
  be internally casted (in certain cases) to a different type on a
  storage engine layer. (affects 4.1 and up)
- If tables in a merge (and a MERGE table itself) had short VARCHAR column (less
  than 4 bytes) and at least one (but not all) tables were ALTER'ed (even to an
  identical table: ALTER TABLE xxx ENGINE=yyy), table definitions went ouf of
  sync. (affects 4.1 only)

This is fixed by relaxing a check for underlying conformance and setting
field type to FIELD_TYPE_STRING in case varchar is shorter than 4
when a table is created.


myisam/mi_create.c:
  Added a comment.
mysql-test/r/merge.result:
  A test case for bug#26881.
mysql-test/t/merge.test:
  A test case for bug#26881.
sql/ha_myisam.cc:
  Relaxed some checks performed by check_definition():
  As comparing of fulltext keys (and key segments) is not yet implemented,
  only return an error in case one of keys is fulltext and other is not.
  Otherwise, if both keys are fulltext, accept them as is.
  
  As comparing of spatial keys (and key segments) is not yet implemented,
  only return an error in case one of keys is spatial and other is not.
  Otherwise, if both keys are spatial, accept them as is.
  
  A workaround to handle situation when field is casted from FIELD_SKIP_ZERO
  to FIELD_NORMAL. This could happen only in case field length is 1 and row
  format is fixed.
sql/sql_parse.cc:
  When a table that has varchar field shorter than 4 is created, field type is
  set to FIELD_TYPE_VAR_STRING. Later, when a table is modified using alter
  table, field type is changed to FIELD_TYPE_STRING (see Field_string::type).
  That means HA_OPTION_PACK_RECORD flag might be lost and thus null_bit might
  be shifted by alter table, in other words alter table doesn't create 100%
  equal table definition.
  
  This is usually not a problem, since when a table is created/altered,
  definition on a storage engine layer is based on one that is passed from
  sql layer. But it is a problem for merge engine - null_bit is shifted when
  a table (merge or underlying) is altered.
  
  Set field type to FIELD_TYPE_STRING in case FIELD_TYPE_VAR_STRING is shorter
  than 4 when a table is created as it is done in Field::type.
2007-03-13 18:02:06 +04:00