Commit graph

131 commits

Author SHA1 Message Date
unknown
4bf849c23c Merge MySQL 5.1.44 into MariaDB. 2010-03-04 09:03:07 +01:00
Georgi Kodinov
a21a0b47ca Bug #31145: ALTER TABLE DROP COLUMN, ADD COLUMN crashes (linux) or
freezes (win) the server

The check for equality was assuming the field object is always 
created. If it's not it was de-referencing a NULL pointer.
Fixed to use the data in the create object instead.
2009-12-18 14:00:30 +02:00
unknown
a962160eec Merge with MySQL 5.1, with following additions:
- Moved some code from innodb_plugin to xtradb, to ensure that all tests runs
- Did changes in pbxt and maria storage engines becasue of changes in thd->query
- Reverted wrong code in sql_table.cc for how ROW_FORMAT is used.

This is a re-commit of Monty's merge to eliminate an extra commit from
MySQL-5.1.42 that was accidentally included in the merge.

This is a merge of the MySQL 5.1.41 clone-off (clone-5.1.41-build). In
case there are any extra changes done before final MySQL 5.1.41
release, these will need to be merged later before MariaDB 5.1.41
release.
2009-11-16 21:49:51 +01:00
Michael Widenius
358327618d Speed up of test suite:
- Added --disable_query_log ; begin ; .... commit; --enable_query_log around all while loops that does insert
2009-10-28 09:52:34 +02:00
Tatiana A. Nurnberg
2fc28dd688 manual merge of Bug#43508 2009-10-09 23:57:43 +02:00
Tatiana A. Nurnberg
798ce98340 Bug#43508: Renaming timestamp or date column triggers table copy
We set up DATE and TIMESTAMP differently in field-creation than we
did in field-MD creation (for CREATE). Admirably, ALTER TABLE
detected this and didn't damage any data, but it did initiate a
full copy/conversion, which we don't really need to do.

Now we describe Field and Create_field the same for those types.
As a result, ALTER TABLE that only changes meta-data (like a
field's name) no longer forces a data-copy when there needn't
be one.


mysql-test/r/alter_table.result:
  0 rows should be affected when a meta-data change is enough ALTER TABLE.
mysql-test/t/alter_table.test:
  add test-case: show that we don't do a full data-copy on ALTER TABLE
  when we don't need to.
sql/field.cc:
  Remove Field_str::compare_str_field_flags() (now in Field/Create_field as
  field_flags_are_binary().
  
  Correct some field-lengths!
sql/field.h:
  Clean-up: use defined constants rather than numeric literals for certain
  field-lengths.
  
  Add enquiry-functions binaryp() to classes Field and Create_field.
  This replaces field.cc's Field_str::compare_str_field_flags().
2009-10-09 14:41:04 +02:00
Davi Arnaut
8d3d35ea57 Bug#45567: Fast ALTER TABLE broken for enum and set
The problem was that appending values to the end of an existing
ENUM or SET column was being treated as table data modification,
preventing a immediately (fast) table alteration that occurs when
only table metadata is being modified.

The cause was twofold: adding a enumeration or set members to the 
end of the list of valid member values was not being considered
a "compatible" table alteration, and for SET columns, the check
was being done upon the max display length and not the underlying
(pack) length of the field.

The solution is to augment the function that checks wether two ENUM
or SET fields are compatible -- by comparing the pack lengths and
performing a limited comparison of the member values.

mysql-test/r/alter_table.result:
  Add test case result for Bug#45567
mysql-test/t/alter_table.test:
  Add test case for Bug#45567
sql/field.cc:
  Check whether two fields can be considered 'equal' for table
  alteration purposes. Fields are equal if they retain the same
  pack length and if new members are added to the end of the list.
sql/field.h:
  Add comment and remove method.
2009-09-29 07:58:42 -03:00
Michael Widenius
1f81aa5f5a Added tests to cover more server code
Author: Stewart Smith

mysql-test/r/alter_table.result:
  Testing of ALTER TABLE .. DROP DEFAULT
mysql-test/r/limit.result:
  Testing of LIMIT ... OFFSET
mysql-test/t/alter_table.test:
  Testing of ALTER TABLE .. DROP DEFAULT
mysql-test/t/limit.test:
  Testing of LIMIT ... OFFSET
2009-06-07 13:05:19 +03:00
Michael Widenius
a8fdaa6f2c Merge with base MySQL 5.1
Contains fixes for test cases
Changed release tag to beta

configure.in:
  change release tag to beta
2009-02-15 12:58:34 +02:00
Sergey Glukhov
87f395d1d9 5.0-bugteam->5.1-bugteam merge 2008-12-09 17:31:22 +04:00
Sergey Glukhov
419e053a41 Bug#31291 ALTER TABLE CONVERT TO CHARACTER SET does not change some data types
added ability for TINY[MEDIUM] text fields 
to be converted to greater subtype during
alter if necessary(altered charset)


mysql-test/r/alter_table.result:
  test result
mysql-test/t/alter_table.test:
  test case
sql/sql_table.cc:
  added ability for TINY[MEDIUM] text fields 
  to be converted to greater subtype during
  alter if necessary(altered charset)
2008-12-09 16:38:52 +04:00
Guilhem Bichot
33b194c36e Merge of 5.1-main into 5.1-maria. There were no changes to storage/myisam, or mysql-test/t/*myisam*.
However there were three new tests mysql-test/suite/parts/t/partition*myisam.test, of which I make here
copies for Maria.
2008-11-21 15:21:50 +01:00
Davi Arnaut
d4438c99ff Merge from mysql-5.1-5.1.29-rc into mysql-5.1-bugteam 2008-10-24 11:58:48 -02:00
Ramil Kalimullin
256f41edfe Fix for bug#23113: Different behavior on altering ENUM fields between 5.0 and 5.1
Problem: mysqld doesn't detect that enum data must be reinserted performing
'ALTER TABLE' in some cases.

Fix: reinsert data altering an enum field if enum values are changed.


mysql-test/r/alter_table.result:
  Fix for bug#23113: Different behavior on altering ENUM fields between 5.0 and 5.1
    - test result.
mysql-test/t/alter_table.test:
  Fix for bug#23113: Different behavior on altering ENUM fields between 5.0 and 5.1
    - test case.
sql/field.cc:
  Fix for bug#23113: Different behavior on altering ENUM fields between 5.0 and 5.1
    - Field_enum::is_equal() introduced, which is called to detect that a field
  is changing by 'ALTER TABLE'.
sql/field.h:
  Fix for bug#23113: Different behavior on altering ENUM fields between 5.0 and 5.1
    - Field_enum::is_equal() introduced, which is called to detect that a field
  is changing by 'ALTER TABLE'.
2008-10-24 13:00:03 +05:00
Michael Widenius
f47e003e1b Merged 5.1 with maria 5.1 2008-10-10 18:28:41 +03:00
Sergey Glukhov
1e4f12d65d Bug#39372 "Smart" ALTER TABLE not so smart after all.
The problem was that PACK_KEYS and MAX_ROWS clause in ALTER TABLE did not trigger
table reconstruction.
The fix is to rebuild a table if PACK_KEYS or MAX_ROWS are specified.


mysql-test/r/alter_table.result:
  test result
mysql-test/t/alter_table.test:
  test case
sql/sql_table.cc:
  The problem was that PACK_KEYS and MAX_ROWS clause in ALTER TABLE did not trigger
  table reconstruction.
  The fix is to rebuild a table if PACK_KEYS or MAX_ROWS are specified.
2008-10-09 15:49:13 +05:00
Davi Arnaut
5d237db6f6 Bug#33873: Fast ALTER TABLE doesn't work with multibyte character sets
The problem was that when comparing tables for a possible
fast alter table, the comparison was being performed using
the parsed information and not the final definition.
      
The solution is to use the possible final table layout to
compare if a fast alter is possible or not.

mysql-test/include/mix1.inc:
  Disable test case for Bug 21704 as it hasn't been fixed.
mysql-test/r/alter_table.result:
  Add test case result for Bug#33873
mysql-test/r/innodb_mysql.result:
  Update test case result
mysql-test/t/alter_table.test:
  Add test case for Bug#33873
sql/sql_table.cc:
  Use updated (final) information to compare fields.
2008-06-17 11:12:21 -03:00
unknown
f4afcec393 Merge hynda.mysql.fi:/home/my/mysql-5.1-main
into  hynda.mysql.fi:/home/my/mysql-maria


BitKeeper/etc/ignore:
  auto-union
BUILD/SETUP.sh:
  Auto merged
BitKeeper/deleted/.del-CMakeLists.txt~99a50df6:
  Auto merged
Makefile.am:
  Auto merged
client/mysqldump.c:
  Auto merged
configure.in:
  Auto merged
include/Makefile.am:
  Auto merged
include/keycache.h:
  Auto merged
include/m_string.h:
  Auto merged
include/my_sys.h:
  Auto merged
libmysqld/Makefile.am:
  Auto merged
mysql-test/extra/rpl_tests/rpl_insert_delayed.test:
  Auto merged
mysql-test/lib/mtr_cases.pl:
  Auto merged
mysql-test/lib/mtr_misc.pl:
  Auto merged
mysql-test/lib/mtr_process.pl:
  Auto merged
mysql-test/lib/mtr_report.pl:
  Auto merged
mysql-test/lib/mtr_timer.pl:
  Auto merged
mysql-test/mysql-test-run.pl:
  Auto merged
mysql-test/r/alter_table.result:
  Auto merged
mysql-test/r/merge.result:
  Auto merged
mysql-test/r/mysqldump.result:
  Auto merged
mysql-test/r/query_cache.result:
  Auto merged
mysql-test/r/subselect.result:
  Auto merged
mysql-test/r/view.result:
  Auto merged
mysql-test/suite/ndb/r/ps_7ndb.result:
  Auto merged
mysql-test/suite/rpl/r/rpl_events.result:
  Auto merged
mysql-test/suite/rpl/r/rpl_insert.result:
  Auto merged
mysql-test/suite/rpl/r/rpl_row_insert_delayed.result:
  Auto merged
mysql-test/suite/rpl/r/rpl_stm_flsh_tbls.result:
  Auto merged
mysql-test/suite/rpl/r/rpl_stm_insert_delayed.result:
  Auto merged
mysql-test/suite/rpl/r/rpl_switch_stm_row_mixed.result:
  Auto merged
mysql-test/suite/rpl/t/rpl_insert.test:
  Auto merged
mysql-test/suite/rpl/t/rpl_stm_flsh_tbls.test:
  Auto merged
mysql-test/suite/rpl/t/rpl_switch_stm_row_mixed.test:
  Auto merged
mysql-test/t/alter_table.test:
  Auto merged
mysql-test/t/myisam.test:
  Auto merged
mysql-test/t/mysqldump.test:
  Auto merged
mysql-test/t/query_cache.test:
  Auto merged
mysql-test/t/subselect.test:
  Auto merged
mysql-test/t/view.test:
  Auto merged
mysys/array.c:
  Auto merged
mysys/mf_keycache.c:
  Auto merged
mysys/my_init.c:
  Auto merged
mysys/my_symlink2.c:
  Auto merged
mysys/safemalloc.c:
  Auto merged
mysys/thr_lock.c:
  Auto merged
sql/Makefile.am:
  Auto merged
sql/filesort.cc:
  Auto merged
sql/ha_ndbcluster.cc:
  Auto merged
sql/ha_partition.cc:
  Auto merged
sql/ha_partition.h:
  Auto merged
sql/handler.h:
  Auto merged
sql/item_func.cc:
  Auto merged
sql/item_func.h:
  Auto merged
sql/item_xmlfunc.cc:
  Auto merged
sql/lock.cc:
  Auto merged
sql/log.cc:
  Auto merged
sql/mysql_priv.h:
  Auto merged
sql/mysqld.cc:
  Auto merged
sql/net_serv.cc:
  Auto merged
sql/opt_range.cc:
  Auto merged
sql/set_var.cc:
  Auto merged
sql/slave.cc:
  Auto merged
sql/slave.h:
  Auto merged
sql/sql_class.cc:
  Auto merged
sql/sql_delete.cc:
  Auto merged
sql/sql_insert.cc:
  Auto merged
sql/sql_parse.cc:
  Auto merged
sql/sql_select.cc:
  Auto merged
sql/sql_table.cc:
  Auto merged
sql/share/errmsg.txt:
  Auto merged
sql/sql_test.cc:
  Auto merged
sql/table.h:
  Auto merged
sql/udf_example.c:
  Auto merged
sql/uniques.cc:
  Auto merged
sql/unireg.cc:
  Auto merged
storage/csv/ha_tina.h:
  Auto merged
storage/myisam/ft_boolean_search.c:
  Auto merged
storage/myisam/ft_nlq_search.c:
  Auto merged
storage/myisam/ft_parser.c:
  Auto merged
storage/myisam/ft_stopwords.c:
  Auto merged
storage/myisam/ha_myisam.cc:
  Auto merged
storage/myisam/ha_myisam.h:
  Auto merged
storage/myisam/mi_check.c:
  Auto merged
storage/myisam/mi_create.c:
  Auto merged
storage/myisam/mi_delete.c:
  Auto merged
storage/myisam/mi_dynrec.c:
  Auto merged
storage/myisam/mi_extra.c:
  Auto merged
storage/myisam/mi_key.c:
  Auto merged
storage/myisam/mi_locking.c:
  Auto merged
storage/myisam/mi_log.c:
  Auto merged
storage/myisam/mi_packrec.c:
  Auto merged
storage/myisam/mi_rkey.c:
  Auto merged
storage/myisam/mi_search.c:
  Auto merged
storage/myisam/mi_test1.c:
  Auto merged
storage/myisam/mi_test2.c:
  Auto merged
storage/myisam/mi_update.c:
  Auto merged
storage/myisam/mi_write.c:
  Auto merged
storage/myisam/myisamchk.c:
  Auto merged
storage/myisam/myisamlog.c:
  Auto merged
storage/myisam/myisampack.c:
  Auto merged
storage/myisam/sort.c:
  Auto merged
storage/myisam/sp_test.c:
  Auto merged
storage/myisammrg/ha_myisammrg.cc:
  Auto merged
storage/myisammrg/ha_myisammrg.h:
  Auto merged
storage/ndb/src/mgmapi/mgmapi.cpp:
  Auto merged
support-files/compiler_warnings.supp:
  Auto merged
client/mysqltest.c:
  Manual merge between mysql-5.1 and mysql-maria
include/my_base.h:
  Manual merge between mysql-5.1 and mysql-maria
include/my_global.h:
  Manual merge between mysql-5.1 and mysql-maria
include/myisam.h:
  Manual merge between mysql-5.1 and mysql-maria
libmysql/Makefile.shared:
  Manual merge between mysql-5.1 and mysql-maria
mysql-test/r/events_logs_tests.result:
  Manual merge between mysql-5.1 and mysql-maria
mysql-test/suite/rpl/r/rpl_row_flsh_tbls.result:
  Manual merge between mysql-5.1 and mysql-maria
mysql-test/suite/rpl/t/rpl_row_flsh_tbls.test:
  Manual merge between mysql-5.1 and mysql-maria
mysql-test/t/disabled.def:
  Manual merge between mysql-5.1 and mysql-maria
mysql-test/t/events_logs_tests.test:
  Manual merge between mysql-5.1 and mysql-maria
mysys/my_compress.c:
  Manual merge between mysql-5.1 and mysql-maria
mysys/my_getsystime.c:
  Manual merge between mysql-5.1 and mysql-maria
mysys/my_open.c:
  Manual merge between mysql-5.1 and mysql-maria
sql/handler.cc:
  Manual merge between mysql-5.1 and mysql-maria
sql/set_var.h:
  Manual merge between mysql-5.1 and mysql-maria
sql/sql_class.h:
  Manual merge between mysql-5.1 and mysql-maria
sql/sql_show.cc:
  Manual merge between mysql-5.1 and mysql-maria
sql/sql_sort.h:
  Manual merge between mysql-5.1 and mysql-maria
sql/sql_yacc.yy:
  Manual merge between mysql-5.1 and mysql-maria
sql/table.cc:
  Manual merge between mysql-5.1 and mysql-maria
storage/csv/ha_tina.cc:
  Manual merge between mysql-5.1 and mysql-maria
storage/myisam/mi_open.c:
  Manual merge between mysql-5.1 and mysql-maria
storage/myisam/myisamdef.h:
  Manual merge between mysql-5.1 and mysql-maria
unittest/mysys/my_atomic-t.c:
  Manual merge between mysql-5.1 and mysql-maria
2007-09-27 17:05:07 +03:00
unknown
1b47e3dabd Make test does not fail if run with
--mysqld=--default-storage-engine=X where X does not support
INSERT DELAYED (like Maria)


mysql-test/r/alter_table.result:
  result update
mysql-test/t/alter_table.test:
  so that test does not fail if run with
  --mysqld=--default-storage-engine=X where X does not support
  INSERT DELAYED (like Maria)
2007-08-06 20:17:38 +02:00
unknown
f97155c9f6 Merge mysql.com:/home/svoj/devel/mysql/BUG29957/mysql-5.0-engines
into  mysql.com:/home/svoj/devel/mysql/BUG29957/mysql-5.1-engines


storage/myisam/mi_extra.c:
  Auto merged
mysql-test/r/alter_table.result:
  Manual merge
mysql-test/t/alter_table.test:
  Manual merge
2007-07-27 14:44:31 +05:00
unknown
e92ce5d56c BUG#29957 - alter_table.test fails
INSERT/DELETE/UPDATE followed by ALTER TABLE within LOCK TABLES
may cause table corruption on Windows.

That happens because ALTER TABLE writes outdated shared state
info into index file.

Fixed by removing obsolete workaround.

Affects MyISAM tables on Windows only.


myisam/mi_extra.c:
  On windows when mi_extra(HA_EXTRA_PREPARE_FOR_DELETE) is called,
  we release external lock and close index file. If we're in LOCK
  TABLES, MyISAM state info doesn't get updated until UNLOCK TABLES.
  
  That means when we release external lock and we're in LOCK TABLES,
  we may write outdated state info.
  
  As SQL layer closes all table instances, we do not need this
  workaround anymore.
mysql-test/r/alter_table.result:
  A test case for BUG#29957.
mysql-test/t/alter_table.test:
  A test case for BUG#29957.
2007-07-27 14:30:25 +05:00
unknown
f4caa3025a Merge olga.mysql.com:/home/igor/mysql-5.1
into  olga.mysql.com:/home/igor/mysql-5.1-opt-merge


mysql-test/r/alter_table.result:
  Auto merged
mysql-test/r/create.result:
  Auto merged
mysql-test/r/innodb_mysql.result:
  Auto merged
mysql-test/r/sp.result:
  Auto merged
mysql-test/r/user_var.result:
  Auto merged
mysql-test/t/alter_table.test:
  Auto merged
mysql-test/t/sp.test:
  Auto merged
mysql-test/t/strict.test:
  Auto merged
mysql-test/t/subselect3.test:
  Auto merged
sql/field.h:
  Auto merged
sql/handler.h:
  Auto merged
sql/item_func.cc:
  Auto merged
sql/item_func.h:
  Auto merged
sql/mysqld.cc:
  Auto merged
sql/sp_head.cc:
  Auto merged
sql/sql_base.cc:
  Auto merged
sql/sql_class.h:
  Auto merged
sql/sql_select.cc:
  Auto merged
sql/sql_update.cc:
  Auto merged
mysql-test/r/ps_2myisam.result:
  Manual merge.
mysql-test/r/ps_3innodb.result:
  Manual merge.
mysql-test/r/ps_4heap.result:
  Manual merge.
mysql-test/r/ps_5merge.result:
  Manual merge.
mysql-test/r/ps_7ndb.result:
  Manual merge.
sql/sql_table.cc:
  Manual merge.
sql/sql_view.cc:
  Manual merge.
2007-06-03 22:52:02 -07:00
unknown
cfd1e67ae4 Bug#28427: Columns were renamed instead of moving by ALTER TABLE.
To avoid unnecessary work the mysql_alter_table function takes the
list of table fields and applies all changes to it (drops/moves/renames/etc).
Then this function compares the new list and the old one. If the changes
require only .frm to be modified then the actual data isn't copied. To detect
changes all columns attributes but names are compared. When a column has been
moved and has replaced another column with the same attributes except name
the mysql_alter_table function wrongly decides that two fields has been just
renamed. As a result the data from the moved column and from all columns
after it is not copied.

Now the mysql_alter_table function forces table data copying by setting
the need_copy_table flag when it finds a moved column. The flag is set at
the stage when the modified fields are created.



sql/sql_table.cc:
  Bug#28427: Columns were renamed instead of moving by ALTER TABLE.
  Now the mysql_alter_table function forces table data copying by setting
  the need_copy_table flag when it finds a moved column. The flag is set at
  the stage when the modified fields are created.
mysql-test/r/alter_table.result:
  Added a test case for the bug#28427: Columns were renamed instead of moving by ALTER TABLE.
mysql-test/t/alter_table.test:
  Added a test case for the bug#28427: Columns were renamed instead of moving by ALTER TABLE.
2007-06-02 01:21:18 +04:00
unknown
18580a3200 Merge moonbone.local:/mnt/gentoo64/work/bk-trees/mysql-5.0-opt
into  moonbone.local:/mnt/gentoo64/work/test-5.1-opt-mysql


mysql-test/r/func_gconcat.result:
  Auto merged
mysql-test/t/func_gconcat.test:
  Auto merged
sql/item_sum.cc:
  Auto merged
sql/sql_base.cc:
  Auto merged
sql/sql_select.cc:
  Auto merged
sql/table.h:
  Auto merged
mysql-test/r/alter_table.result:
  Manual merge
mysql-test/t/alter_table.test:
  Manual merge
sql/sql_table.cc:
  Manual merge
2007-05-23 13:46:10 +04:00
unknown
f3b78f34e5 Bug#27507: Wrong DATETIME value was allowed by ALTER TABLE in the NO_ZERO_DATE
mode.

When a new DATE/DATETIME field without default value is being added by the
ALTER TABLE the '0000-00-00' value is used as the default one. But it wasn't
checked whether such value was allowed by the set sql mode. Due to this
'0000-00-00' values was allowed for DATE/DATETIME fields even in the
NO_ZERO_DATE mode.

Now the mysql_alter_table() function checks whether the '0000-00-00' value
is allowed for DATE/DATETIME fields by the set sql mode.
The new error_if_not_empty flag is used in the mysql_alter_table() function
to indicate that it should abort if the table being altered isn't empty.
The new new_datetime_field field is used in the mysql_alter_table() function
for error throwing purposes. 
The new error_if_not_empty parameter is added to the copy_data_between_tables()
function to indicate the it should return error if the source table isn't empty.


mysql-test/t/alter_table.test:
  Added a test case for the bug#27507: Wrong DATETIME value was allowed by
  ALTER TABLE in the NO_ZERO_DATE mode.
mysql-test/r/alter_table.result:
  Added a test case for the bug#27507: Wrong DATETIME value was allowed by
  ALTER TABLE in the NO_ZERO_DATE mode.
sql/sql_table.cc:
  Bug#27507: Wrong DATETIME value was allowed by ALTER TABLE in the NO_ZERO_DATE
  mode.
  Now the mysql_alter_table() function checks whether the '0000-00-00' value
  is allowed for DATE/DATETIME fields by the set sql mode.
  The new error_if_not_empty flag is used in the mysql_alter_table() function
  to indicate that it should abort if the table being altered isn't empty.
  The new new_datetime_field field is used in the mysql_alter_table() function
  for error throwing purposes. 
  The new error_if_not_empty parameter is added to the copy_data_between_tables()
  function to indicate the it should return error if the source table isn't empty.
2007-05-22 00:22:53 +04:00
unknown
1a60685cba Patch changing how ALTER TABLE implementation handles table locking
and invalidation in the most general case (non-temporary table and
not simple RENAME or ENABLE/DISABLE KEYS or partitioning command).

See comment for sql/sql_table.cc for more information.

These changes are prerequisite for 5.1 version of fix for bug #23667
"CREATE TABLE LIKE is not isolated from alteration by other connections"


mysql-test/include/mix1.inc:
  Extended coverage for behavior of ALTER TABLE statement under LOCK TABLES,
  which should be consistent across all platforms and for all engines.
mysql-test/r/alter_table-big.result:
  Changed test for bug #25044 to use @@debug and injected sleeps
  infrastructure. Extended test coverage for ALTER TABLE's behavior
  under concurrency.
mysql-test/r/alter_table.result:
  Extended coverage for behavior of ALTER TABLE statement under LOCK TABLES,
  which should be consistent across all platforms and for all engines.
mysql-test/r/innodb_mysql.result:
  Extended coverage for behavior of ALTER TABLE statement under LOCK TABLES,
  which should be consistent across all platforms and for all engines.
mysql-test/t/alter_table-big.test:
  Changed test for bug #25044 to use @@debug and injected sleeps
  infrastructure. Extended test coverage for ALTER TABLE's behavior
  under concurrency.
mysql-test/t/alter_table.test:
  Extended coverage for behavior of ALTER TABLE statement under LOCK TABLES,
  which should be consistent across all platforms and for all engines.
sql/mysql_priv.h:
  Made functions reopen_table() and close_handle_and_leave_table_as_lock()
  available outside of sql_base.cc file.
  Changed close_data_tables() in such way that after closing handler
  for the table it leaves TABLE object for it in table cache not as
  placeholder for ordinary name-lock but as placeholder for an exclusive
  name-lock. Renamed this routine to close_data_files_and_morph_locks().
sql/sql_base.cc:
  Made functions reopen_table() and close_handle_and_leave_table_as_lock()
  available outside of sql_base.cc file.
  Changed close_data_tables() in such way that after closing handler
  for the table it leaves TABLE object for it in table cache not as
  placeholder for ordinary name-lock but as placeholder for an exclusive
  name-lock. Renamed this routine to close_data_files_and_morph_locks().
  Also adjusted it so it can work properly not only in LOCK TABLES mode.
sql/sql_table.cc:
  Changed the way in which ALTER TABLE implementation handles table
  locking and invalidation in the most general case (non-temporary table
  and not simple RENAME or ENABLE/DISABLE KEYS or partitioning command)
  
  Now after preparing new version of the table we:
  1) Wait until all other threads close old version of table.
  2) Close instances of table open by this thread and replace them
     with exclusive name-locks.
  3) Rename the old table to a temp name, rename the new one to the
     old name.
  4) If we are under LOCK TABLES and don't do ALTER TABLE ... RENAME
     we reopen new version of table.
  5) Write statement to the binary log.
  6) If we are under LOCK TABLES and do ALTER TABLE ... RENAME we
     remove name-locks from list of open tables and table cache.
  7) If we are not not under LOCK TABLES we rely on close_thread_tables()
     call to remove name-locks from table cache and list of open table. 
  
  Such approach:
  a) Eliminates possibility for concurrent statement to sneak in and get
     access to the new version of the table before ALTER TABLE gets logged
     into binary log.
  b) Ensures that ALTER TABLE behaves under LOCK TABLES in the same way
     on all platforms and for all engines (in 5.0 this was not true) 
  c) Preserves nice invariant that if table is open in some connection
     there is a guarantee that .FRM file for this table exists and is
     properly named.
2007-05-19 10:49:56 +04:00
unknown
e65d214d33 Merge pilot.blaudden:/home/msvensson/mysql/mysql-5.0-maint
into  pilot.blaudden:/home/msvensson/mysql/mysql-5.1-maint


mysql-test/r/alter_table.result:
  Auto merged
mysql-test/t/alter_table.test:
  Auto merged
sql/sql_table.cc:
  Auto merged
2007-04-25 13:09:26 +02:00
unknown
5bb54e514f Merge pilot.blaudden:/home/msvensson/mysql/bug25262/my50-bug25262
into  pilot.blaudden:/home/msvensson/mysql/mysql-5.0-maint


sql/sql_table.cc:
  Auto merged
mysql-test/r/alter_table.result:
  Merge tests
mysql-test/t/alter_table.test:
  Merge tests
2007-04-25 12:08:39 +02:00
unknown
329514bb02 Merge pilot.blaudden:/home/msvensson/mysql/bug25262/my51-bug25262
into  pilot.blaudden:/home/msvensson/mysql/mysql-5.1-maint


mysql-test/r/alter_table.result:
  Auto merged
mysql-test/t/alter_table.test:
  Auto merged
sql/sql_table.cc:
  Auto merged
2007-04-25 11:13:41 +02:00
unknown
c0016e92d7 Merge pilot.blaudden:/home/msvensson/mysql/bug25262/my50-bug25262
into  pilot.blaudden:/home/msvensson/mysql/bug25262/my51-bug25262


mysql-test/r/alter_table.result:
  Manual merge
mysql-test/t/alter_table.test:
  Manual merge
sql/sql_table.cc:
  Manual merge, auto_increment_value variable has moved into "stats"
2007-03-21 18:38:08 +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
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
d92106135d Merge magare.gmz:/home/kgeorge/mysql/work/B26794-5.0-opt
into  magare.gmz:/home/kgeorge/mysql/work/B26794-5.1-opt


mysql-test/r/gis-rtree.result:
  Auto merged
sql/field.cc:
  Auto merged
sql/sql_show.cc:
  Auto merged
sql/sql_table.cc:
  Auto merged
mysql-test/r/alter_table.result:
  tests merge
mysql-test/t/alter_table.test:
  tests merge
2007-03-12 17:08:42 +02:00
unknown
bd6aecf3f3 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-12 16:57:00 +02:00
unknown
9248b580b9 Bug#25262 Auto Increment lost when changing Engine type
- Try to copy the autoincrement value when altering the table


mysql-test/r/alter_table.result:
  Update test result
mysql-test/t/alter_table.test:
  Add test case as described in bug report
sql/sql_table.cc:
  Try to copy the autoincrement value when altering the table
2007-03-01 13:43:04 +01:00
unknown
f99f791790 Merge weblab.(none):/home/marcsql/TREE/mysql-5.0-24562-merge
into  weblab.(none):/home/marcsql/TREE/mysql-5.1-24562-merge


mysql-test/r/alter_table.result:
  Auto merged
mysql-test/t/alter_table.test:
  Auto merged
sql/sql_yacc.yy:
  Auto merged
2007-01-18 18:43:11 -07:00
unknown
6c6a2785e9 Manual merge 2007-01-18 18:37:52 -07:00
unknown
65d0e46d71 Merge weblab.(none):/home/marcsql/TREE/mysql-4.1-24562
into  weblab.(none):/home/marcsql/TREE/mysql-5.0-24562-merge


mysql-test/t/alter_table.test:
  Auto merged
2007-01-18 17:02:02 -07:00
unknown
d4ee8cebf3 Bug#24562 (ALTER TABLE ... ORDER BY ... with complex expression asserts)
WL#3681 (ALTER TABLE ORDER BY)

Before this fix, the ALTER TABLE statement implemented an ORDER BY option
with the following characteristics :

1) The order by clause accepts a list of criteria, with optional ASC or
DESC keywords

2) Each criteria can be a general expression, involving operators,
native functions, stored functions, user defined functions, subselects ...

With this fix :

1) has been left unchanged, since it's a de-facto existing feature,
that was already present in the code base and partially covered in the test
suite. Code coverage for ASC and DESC was missing and has been improved.

2) has been changed to limit the kind of criteria that are permissible:
now only a column name is valid.


mysql-test/r/alter_table.result:
  Prevent ALTER TABLE ORDER BY clauses to use general expressions.
mysql-test/t/alter_table.test:
  Prevent ALTER TABLE ORDER BY clauses to use general expressions.
sql/sql_yacc.yy:
  Prevent ALTER TABLE ORDER BY clauses to use general expressions.
2007-01-18 16:53:49 -07:00
unknown
9e46434910 Merge mysql.com:/home/svoj/devel/mysql/BUG23404/mysql-5.0-engines
into  mysql.com:/home/svoj/devel/mysql/BUG23404/mysql-5.1-engines


mysql-test/r/alter_table.result:
  Auto merged
mysql-test/t/alter_table.test:
  Auto merged
sql/sql_parse.cc:
  Auto merged
2006-12-13 17:32:40 +04:00
unknown
b9d2627ca1 Merge mysql.com:/home/svoj/devel/mysql/BUG23404/mysql-4.1-engines
into  mysql.com:/home/svoj/devel/mysql/BUG23404/mysql-5.0-engines


mysql-test/r/alter_table.result:
  Auto merged
mysql-test/t/alter_table.test:
  Auto merged
sql/sql_parse.cc:
  SCCS merged
2006-12-13 16:29:33 +04:00
unknown
a4ad07b7ea Merge svojtovich@bk-internal.mysql.com:/home/bk/mysql-4.1-engines
into  mysql.com:/home/svoj/devel/mysql/BUG23404/mysql-4.1-engines


mysql-test/r/alter_table.result:
  SCCS merged
mysql-test/t/alter_table.test:
  SCCS merged
2006-12-13 15:53:37 +04:00
unknown
1cb8e4e9c9 BUG#23404 - ROW_FORMAT=FIXED option is lost is an index is added to the
table

ROW_FORMAT option is lost during CREATE/DROP INDEX.

This fix forces CREATE/DROP INDEX to retain ROW_FORMAT by instructing
mysql_alter_table() that ROW_FORMAT is not used during creating/dropping
indexes.


mysql-test/r/alter_table.result:
  A test case for bug#23404.
mysql-test/t/alter_table.test:
  A test case for bug#23404.
sql/sql_parse.cc:
  CREATE/DROP INDEX must not change ROW_FORMAT. Setting create_info.row_type
  to ROW_TYPE_NOT_USED informs mysql_alter_table that ROW_FORMAT was not
  used during alteration, and thus must be retained.
2006-12-07 18:32:40 +04:00
unknown
c275fce7b4 Merge ahristov@bk-internal.mysql.com:/home/bk/mysql-5.1-maint
into  example.com:/work/bug22369-v2/my51


mysql-test/r/alter_table.result:
  Auto merged
mysql-test/r/grant.result:
  Auto merged
mysql-test/t/grant.test:
  Auto merged
sql/mysql_priv.h:
  Auto merged
sql/sql_parse.cc:
  Auto merged
sql/sql_table.cc:
  Auto merged
mysql-test/t/alter_table.test:
  manual merge
2006-12-04 18:31:24 +01:00
unknown
ab31e4278d Fix for bug#22369: Alter table rename combined
with other alterations causes lost tables

Using RENAME clause combined with other clauses of ALTER TABLE led to
data loss (the data was there but not accessible). This could happen if the
changes do not change the table much. Adding and droppping of fields and
indices was safe. Renaming a column with MODIFY or CHANGE was unsafe operation,
if the actual column didn't change (changing from int to int, which is a noop)
  
Depending on the storage engine (SE) the behavior is different:
1)MyISAM/MEMORY - the ALTER TABLE statement completes
  without any error but next SELECT against the new table fails.
2)InnoDB (and every other transactional table) - The ALTER TABLE statement
  fails. There are the the following files in the db dir -
  `new_table_name.frm` and a temporary table's frm. If the SE is file
  based, then the data and index files will be present but with the old
  names. What happens is that for InnoDB the table is not renamed in the
  internal DDIC.

Fixed by adding additional call to mysql_rename_table() method, which should
not include FRM file rename, because it has been already done during file
names juggling.


mysql-test/r/alter_table.result:
  update result
mysql-test/r/grant.result:
  update result
mysql-test/t/alter_table.test:
  2006/11/29 11:46:23+01:00 andrey@example.com +44 -9
  Error to bug number
      
  Added test case for #22369: Alter table rename combined
  with other alterations causes lost tables
mysql-test/t/grant.test:
  add test for bug#22369 - alter table was missing check
  for DROP_ACL when ALTER_RENAME clause is specified. Synchronise
  with RENAME TABLE DDL.
sql/mysql_priv.h:
  Add a new flag for mysql_rename_table()
sql/sql_parse.cc:
  To be consistent with SQLCOM_RENAME_TABLE, SQLCOM_ALTER_TABLE has
  to check for DROP_ACL if there is ALTER_RENAME flag set.
sql/sql_table.cc:
  ALTER_RENAME, the data and index files weren't renamed in the engine
  but only the FRM was new, when the tables old and new tables are compatible.
  In the chain of FRM renames we add a call to mysql_rename_table() which should
  instruct the engine to rename the table but not rename the FRM.
  This bug was there only in 5.1 branch. 4.1 and 5.0 always do copy data on RENAME
  if there are more clauses than just rename.
2006-12-04 18:22:38 +01:00
unknown
934aa981ad Merge ahristov@bk-internal.mysql.com:/home/bk/mysql-5.1-maint
into  example.com:/work/bug24395-v2/my51


mysql-test/t/alter_table.test:
  Auto merged
sql/sql_table.cc:
  Auto merged
2006-12-01 16:27:48 +01:00
unknown
36a983b89a Merge example.com:/work/bug24395-v2/my50
into  example.com:/work/bug24395-v2/my51


mysql-test/r/alter_table.result:
  Auto merged
mysql-test/t/alter_table.test:
  Auto merged
storage/myisam/mi_open.c:
  Auto merged
sql/sql_table.cc:
  manual merge
2006-12-01 11:37:33 +01:00
unknown
c429ca8498 Merge example.com:/work/bug24395-v2/my41
into  example.com:/work/bug24395-v2/my50

fix for bug#24395 merged into 5.0


mysql-test/t/alter_table.test:
  Auto merged
myisam/mi_open.c:
  merge into 5.0 by using macroses available in 5.0
mysql-test/r/alter_table.result:
  manual merge
sql/sql_table.cc:
  manual merge
  Added else clause of 
  if (new_table && !new_table->file->is_view)
  This else clauses does keys management on the live table, thus we have
  to force other threads to reopen the table.
2006-11-30 18:36:15 +01:00
unknown
d988576610 Merge shellback.(none):/home/msvensson/mysql/mysql-5.1
into  shellback.(none):/home/msvensson/mysql/mysql-5.1-maint


BitKeeper/etc/ignore:
  auto-union
Makefile.am:
  Auto merged
client/mysql.cc:
  Auto merged
client/mysql_upgrade.c:
  Auto merged
client/mysqltest.c:
  Auto merged
extra/yassl/src/ssl.cpp:
  Auto merged
mysql-test/lib/mtr_report.pl:
  Auto merged
mysql-test/mysql-test-run-shell.sh:
  Auto merged
mysql-test/mysql-test-run.pl:
  Auto merged
mysql-test/r/query_cache.result:
  Auto merged
mysql-test/r/udf.result:
  Auto merged
mysql-test/t/alter_table.test:
  Auto merged
mysql-test/t/disabled.def:
  Auto merged
mysql-test/t/limit.test:
  Auto merged
mysql-test/t/mysql.test:
  Auto merged
mysql-test/t/mysqldump.test:
  Auto merged
mysql-test/t/query_cache.test:
  Auto merged
mysql-test/t/system_mysql_db_fix30020.test:
  Auto merged
mysql-test/t/udf.test:
  Auto merged
mysql-test/t/view_grant.test:
  Auto merged
mysys/Makefile.am:
  Auto merged
scripts/mysql_fix_privilege_tables.sql:
  Auto merged
sql/item.cc:
  Auto merged
sql/item_func.cc:
  Auto merged
sql/item_func.h:
  Auto merged
sql/item_timefunc.cc:
  Auto merged
sql/mysql_priv.h:
  Auto merged
sql/mysqld.cc:
  Auto merged
sql/sql_handler.cc:
  Auto merged
sql/sql_parse.cc:
  Auto merged
sql-common/my_time.c:
  Auto merged
sql/sql_table.cc:
  Auto merged
extra/yassl/taocrypt/include/algebra.hpp:
  Remove fix as it conflicts with "import from yassl" and it's been
  fixed there
sql/ha_ndbcluster.cc:
  Merge fix of warnings
sql/sql_base.cc:
  Merge
2006-11-29 15:44:09 +01:00
unknown
a9173ec999 Fix for bug#24395:
ALTER TABLE DISABLE KEYS doesn't work when modifying the table
  
ENABLE|DISABLE KEYS combined with another ALTER TABLE option, different
than RENAME TO did nothing. Also, if the table had disabled keys
and was ALTER-ed then the end table was with enabled keys.
  
Fixed by checking whether the table had disabled keys and enabling them
in the copied table.


myisam/mi_open.c:
  Extend mi_indexes_are_disabled to implement return value
  2 - Non-unique indexes are disabled
mysql-test/r/alter_table.result:
  update result
mysql-test/t/alter_table.test:
  update test
sql/sql_table.cc:
  When ENABLE|DISABLE index is combined with another option
  different than RENAME TO, we should ENABLE|DISABLE the keys of
  the modified table. Also when modifying we should preserve the
  previous state of the indices.
  (This problem exists in 5.0 and 5.1 but since the codebase has
  diverged, this fix won't automerge, but the fix will be quite
  similar).
2006-11-28 18:27:32 +01:00