Commit 2f93aa9e authored by monty@hundin.mysql.fi's avatar monty@hundin.mysql.fi
Browse files

Test that all MERGE tables comes from the same database

parent 788bc3f4
Loading
Loading
Loading
Loading
+32 −8
Original line number Diff line number Diff line
@@ -4502,6 +4502,13 @@ Minimum respective maximum possible @code{double} value.
@item
@code{LIMIT} on negative numbers are treated as big positive numbers.
@item
If you use @code{ALTER TABLE} to first add an @code{UNIQUE} index to a
table used in a @code{MERGE} table and then use @code{ALTER TABLE} to
add a normal index on the @code{MERGE} table, the key order will be
different for the tables if there was an old not-unique key in the
table. This is because @code{ALTER TABLE} puts @code{UNIQUE} keys before
normal keys to be able to detect duplicate keys as early as possible.
@end itemize
The following are known bugs in earlier versions of MySQL:
@@ -11688,9 +11695,9 @@ work:
@example
CC="cc -pthread"
CFLAGS="-O4 -ansi_alias -ansi_args -fast -inline speed -speculate all -arch host"
CFLAGS="-O4 -ansi_alias -ansi_args -fast -inline speed all -arch host"
CXX="cxx -pthread"
CXXFLAGS="-O4 -ansi_alias -ansi_args -fast -inline speed -speculate all -arch host"
CXXFLAGS="-O4 -ansi_alias -ansi_args -fast -inline speed all -arch host"
export CC CFLAGS CXX CXXFLAGS
./configure \
--prefix=/usr/local/mysql \
@@ -34149,6 +34156,12 @@ index exists, it drops the first @code{UNIQUE} index in the table.
(MySQL marks the first @code{UNIQUE} key as the @code{PRIMARY KEY}
if no @code{PRIMARY KEY} was specified explicitly.)
@findex UNIQUE
@findex PRIMARY KEY
If you add a @code{UNIQUE INDEX} or @code{PRIMARY KEY} to a table, this
is stored before any not @code[UNIQUE} index so that MySQL can detect
duplicate keys as early as possible.
@findex ORDER BY
@item
@code{ORDER BY} allows you to create the new table with the rows in a
@@ -35558,14 +35571,15 @@ mapped tables. (We plan to fix this in 4.0).
With identical tables we mean that all tables are created with identical
column and key information.  You can't put a MERGE over tables where the
columns are packed differently or doesn't have exactly the same columns.
Some of the tables can however be compressed with @code{myisampack}.
@xref{myisampack}.
columns are packed differently, doesn't have exactly the same columns or
have the keys in different order.  Some of the tables can however be
compressed with @code{myisampack}.  @xref{myisampack}.
When you create a @code{MERGE} table, you will get a @code{.frm} table
definition file and a @code{.MRG} table list file.  The @code{.MRG} just
contains a list of the index files (@code{.MYI} files) that should
be used as one.
be used as one.  All used tables must be in the same database as the
@code{MERGE} table itself.
For the moment you need to have @code{SELECT}, @code{UPDATE}, and
@code{DELETE} privileges on the tables you map to a @code{MERGE} table.
@@ -35691,7 +35705,6 @@ Change the @code{.MRG} file and issue a @code{FLUSH TABLE} on the
read the new definition file.
@end itemize
@node ISAM, HEAP, MERGE, Table types
@section ISAM Tables
@@ -46683,15 +46696,26 @@ not yet 100% confident in this code.
@appendixsubsec Changes in release 3.23.42
@itemize @bullet
@item
Enforce that all tables in a @code{MERGE} table comes from the same
database.
@item
Fixed bug with @code{LOAD DATA INFILE} and transactional tables.
@item
Fix bug when using @code{INSERT DELAYED} with wrong column definition.
@item
Fixed bug in @code{InnoDB} and @code{AUTO_INCREMENT} columns.
@item
Fixed critical bug in @code{InnoDB} and @code{BLOB}'s.  If one has used
@code{BLOB}'s larger than 8K in an @code{InnoDB} table one must dump
the table with @code{mysqldump}, drop it and restore it from the dump.
@item
Applied large patch for OS/2 from Yuri Dario.
@item
Fixed problem with InnoDB when one could get the error @code{Can't
execute the given command...} even when one didn't have an active
transaction.
@item
Applied some fixes for Gemini.
Applied some minor fixes that concerns Gemini.
@item
Use real arithmetic operations even in integer context if not
all arguments are integers. (Fixes uncommon bug in some integer
+2 −1
Original line number Diff line number Diff line
@@ -212,4 +212,5 @@
#define ER_CREATE_DB_WITH_READ_LOCK 1209
#define ER_WRONG_ARGUMENTS 1210
#define ER_NO_PERMISSON_TO_CREATE_USER 1211
#define ER_ERROR_MESSAGES 212
#define ER_UNION_TABLES_IN_DIFFERENT_DIR 1212
#define ER_ERROR_MESSAGES 213
+5 −1
Original line number Diff line number Diff line
@@ -35,9 +35,13 @@ show create table t3;

# The following should give errors
create table t4 (a int not null, b char(10), key(a)) type=MERGE UNION=(t1,t2);
--error 1016
select * from t4;
--error 1212
create table t5 (a int not null, b char(10), key(a)) type=MERGE UNION=(test.t1,test_2.t2);

# Because of windows, it's important that we drop the merge tables first!
drop table if exists t4,t3,t1,t2;
drop table if exists t5,t4,t3,t1,t2;

create table t1 (c char(10)) type=myisam;
create table t2 (c char(10)) type=myisam;
+1 −1
Original line number Diff line number Diff line
@@ -472,7 +472,7 @@ int main(int argc,char **argv)
  int error;

  MY_INIT(argv[0]);
  start_value=4597269L;  best_t1=6001982L;  best_t2=5063828L;  best_type=4; /* mode=4513  add=8  type: 0 */
  start_value=6130115L; best_t1=3632784L;  best_t2=86437L;  best_type=3; /* mode=4229  add=2  type: 0 */
  if (get_options(argc,(char **) argv))
    exit(1);

+0 −6
Original line number Diff line number Diff line
@@ -86,7 +86,6 @@ int ha_myisammrg::delete_row(const byte * buf)
int ha_myisammrg::index_read(byte * buf, const byte * key,
			  uint key_len, enum ha_rkey_function find_flag)
{
//  return (my_errno=HA_ERR_WRONG_COMMAND);
  statistic_increment(ha_read_key_count,&LOCK_status);
  int error=myrg_rkey(file,buf,active_index, key, key_len, find_flag);
  table->status=error ? STATUS_NOT_FOUND: 0;
@@ -96,7 +95,6 @@ int ha_myisammrg::index_read(byte * buf, const byte * key,
int ha_myisammrg::index_read_idx(byte * buf, uint index, const byte * key,
				 uint key_len, enum ha_rkey_function find_flag)
{
//  return (my_errno=HA_ERR_WRONG_COMMAND);
  statistic_increment(ha_read_key_count,&LOCK_status);
  int error=myrg_rkey(file,buf,index, key, key_len, find_flag);
  table->status=error ? STATUS_NOT_FOUND: 0;
@@ -105,7 +103,6 @@ int ha_myisammrg::index_read_idx(byte * buf, uint index, const byte * key,

int ha_myisammrg::index_next(byte * buf)
{
//  return (my_errno=HA_ERR_WRONG_COMMAND);
  statistic_increment(ha_read_next_count,&LOCK_status);
  int error=myrg_rnext(file,buf,active_index);
  table->status=error ? STATUS_NOT_FOUND: 0;
@@ -114,7 +111,6 @@ int ha_myisammrg::index_next(byte * buf)

int ha_myisammrg::index_prev(byte * buf)
{
// return (my_errno=HA_ERR_WRONG_COMMAND);
  statistic_increment(ha_read_prev_count,&LOCK_status);
  int error=myrg_rprev(file,buf, active_index);
  table->status=error ? STATUS_NOT_FOUND: 0;
@@ -123,7 +119,6 @@ int ha_myisammrg::index_prev(byte * buf)

int ha_myisammrg::index_first(byte * buf)
{
//  return (my_errno=HA_ERR_WRONG_COMMAND);
  statistic_increment(ha_read_first_count,&LOCK_status);
  int error=myrg_rfirst(file, buf, active_index);
  table->status=error ? STATUS_NOT_FOUND: 0;
@@ -132,7 +127,6 @@ int ha_myisammrg::index_first(byte * buf)

int ha_myisammrg::index_last(byte * buf)
{
//  return (my_errno=HA_ERR_WRONG_COMMAND);
  statistic_increment(ha_read_last_count,&LOCK_status);
  int error=myrg_rlast(file, buf, active_index);
  table->status=error ? STATUS_NOT_FOUND: 0;
Loading