List:General Discussion« Previous MessageNext Message »
From:xian liu Date:February 8 2007 8:05am
Subject:回复: Re: about partition key type
View as plain text  
Thank you for your help.
   
  I find the following statement from "Partitioning---->Restrictions and Limitations on
Partitioning" section in the MySQL-5.1 reference manual:
   
  A partitioning key must be either an integer column or an expression that resolves to an
integer. The column or expression value may also be NULL. (See Section 17.2.6, “How
MySQL Partitioning Handles NULL Values”.) 
  The one exception to this restriction occurs when partitioning by [LINEAR] KEY ― where
it is possible to use columns of other types types as partitioning keys ― because
MySQL's internal key-hashing functions produce the correct datatype from these types. For
example, the following CREATE TABLE statement is valid: 

CREATE TABLE tkc (c1 CHAR)  PARTITION BY KEY(c1)  PARTITIONS 4;  
  This exception does not apply to BLOB or TEXT column types
   
   
  

Dan Nelson <dnelson@stripped> 写道:
  In the last episode (Feb 08), xian liu said:
> mysql> create table t1 (num int(10) not null, id char(18) not null) 
> partition by range(id) (
> partition id1 values less than('111111111111111112'), 
> partition id2 values less than('222222222222222223'), 
> partition id3 values less than('333333333333333334'), 
> partition id4 values less than('444444444444444445') 
> );
> ERROR 1064 (42000): VALUES value must be of same type as partition function near '),
> partition id2 values less than('222222222222222223'), partition id3 values ' at line 1
> 
> what's the meaning of this error?? does't it support partition key is
> column of char type in MySQL-5.1.14-beta version? Anyone advice ?
> thanks a lot!!

I can't see it docummentioned in the documentation, but the code looks
like it only accepts integer expressions for ranges.

sql_yacc.yy, line 3939:

else if (part_expr->result_type() != INT_RESULT &&
!part_expr->null_value)
{
yyerror(ER(ER_INCONSISTENT_TYPE_OF_FUNCTIONS_ERROR));
YYABORT;
}

In your case, changing your id column to a BIGINT type should work.

-- 
Dan Nelson
dnelson@stripped

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql?unsub=1




@@@^_^@@@
 		
---------------------------------
 Mp3疯狂搜-新歌热歌高速下   
Thread
about partition key typexian liu8 Feb
  • Re: about partition key typeDan Nelson8 Feb
    • 回复: Re: about partition key typexian liu8 Feb