Commit 7f49d1e6 authored by unknown's avatar unknown

Merge mysql.com:/home/dlenev/src/mysql-4.1-merges

into mysql.com:/home/dlenev/src/mysql-5.0-merges


mysql-test/r/alter_table.result:
  Auto merged
mysql-test/t/alter_table.test:
  Auto merged
sql/field.h:
  Auto merged
parents b5064f14 e2c869f2
...@@ -493,3 +493,7 @@ select hex(a) from t1; ...@@ -493,3 +493,7 @@ select hex(a) from t1;
hex(a) hex(a)
F2E5F1F2 F2E5F1F2
drop table t1; drop table t1;
create table t1 ( a timestamp );
alter table t1 add unique ( a(1) );
ERROR HY000: Incorrect sub part key; the used key part isn't a string, the used length is longer than the key part, or the storage engine doesn't support unique sub keys
drop table t1;
...@@ -336,3 +336,14 @@ select hex(a) from t1; ...@@ -336,3 +336,14 @@ select hex(a) from t1;
alter table t1 convert to character set cp1251; alter table t1 convert to character set cp1251;
select hex(a) from t1; select hex(a) from t1;
drop table t1; drop table t1;
#
# Test for bug #7884 "Able to add invalid unique index on TIMESTAMP prefix"
# MySQL should not think that packed field with non-zero decimals is
# geometry field and allow to create prefix index which is
# shorter than packed field length.
#
create table t1 ( a timestamp );
--error 1089
alter table t1 add unique ( a(1) );
drop table t1;
...@@ -1341,10 +1341,10 @@ int set_field_to_null_with_conversions(Field *field, bool no_conversions); ...@@ -1341,10 +1341,10 @@ int set_field_to_null_with_conversions(Field *field, bool no_conversions);
#define FIELDFLAG_NUMBER 2 #define FIELDFLAG_NUMBER 2
#define FIELDFLAG_ZEROFILL 4 #define FIELDFLAG_ZEROFILL 4
#define FIELDFLAG_PACK 120 // Bits used for packing #define FIELDFLAG_PACK 120 // Bits used for packing
#define FIELDFLAG_INTERVAL 256 #define FIELDFLAG_INTERVAL 256 // mangled with decimals!
#define FIELDFLAG_BITFIELD 512 // mangled with dec! #define FIELDFLAG_BITFIELD 512 // mangled with decimals!
#define FIELDFLAG_BLOB 1024 // mangled with dec! #define FIELDFLAG_BLOB 1024 // mangled with decimals!
#define FIELDFLAG_GEOM 2048 #define FIELDFLAG_GEOM 2048 // mangled with decimals!
#define FIELDFLAG_LEFT_FULLSCREEN 8192 #define FIELDFLAG_LEFT_FULLSCREEN 8192
#define FIELDFLAG_RIGHT_FULLSCREEN 16384 #define FIELDFLAG_RIGHT_FULLSCREEN 16384
...@@ -1368,10 +1368,10 @@ int set_field_to_null_with_conversions(Field *field, bool no_conversions); ...@@ -1368,10 +1368,10 @@ int set_field_to_null_with_conversions(Field *field, bool no_conversions);
#define f_decimals(x) ((uint8) (((x) >> FIELDFLAG_DEC_SHIFT) & FIELDFLAG_MAX_DEC)) #define f_decimals(x) ((uint8) (((x) >> FIELDFLAG_DEC_SHIFT) & FIELDFLAG_MAX_DEC))
#define f_is_alpha(x) (!f_is_num(x)) #define f_is_alpha(x) (!f_is_num(x))
#define f_is_binary(x) ((x) & FIELDFLAG_BINARY) // 4.0- compatibility #define f_is_binary(x) ((x) & FIELDFLAG_BINARY) // 4.0- compatibility
#define f_is_enum(x) ((x) & FIELDFLAG_INTERVAL) #define f_is_enum(x) (((x) & (FIELDFLAG_INTERVAL | FIELDFLAG_NUMBER)) == FIELDFLAG_INTERVAL)
#define f_is_bitfield(x) ((x) & FIELDFLAG_BITFIELD) #define f_is_bitfield(x) (((x) & (FIELDFLAG_BITFIELD | FIELDFLAG_NUMBER)) == FIELDFLAG_BITFIELD)
#define f_is_blob(x) (((x) & (FIELDFLAG_BLOB | FIELDFLAG_NUMBER)) == FIELDFLAG_BLOB) #define f_is_blob(x) (((x) & (FIELDFLAG_BLOB | FIELDFLAG_NUMBER)) == FIELDFLAG_BLOB)
#define f_is_geom(x) ((x) & FIELDFLAG_GEOM) #define f_is_geom(x) (((x) & (FIELDFLAG_GEOM | FIELDFLAG_NUMBER)) == FIELDFLAG_GEOM)
#define f_is_equ(x) ((x) & (1+2+FIELDFLAG_PACK+31*256)) #define f_is_equ(x) ((x) & (1+2+FIELDFLAG_PACK+31*256))
#define f_settype(x) (((int) x) << FIELDFLAG_PACK_SHIFT) #define f_settype(x) (((int) x) << FIELDFLAG_PACK_SHIFT)
#define f_maybe_null(x) (x & FIELDFLAG_MAYBE_NULL) #define f_maybe_null(x) (x & FIELDFLAG_MAYBE_NULL)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment