在
User-Defined Variables以下,MySQL手册文件:
User variables can be assigned a value from a limited set of data types: integer, decimal, floating-point, binary or nonbinary string, or NULL value. Assignment of decimal and real values does not preserve the precision or scale of the value. A value of a type other than one of the permissible types is converted to a permissible type. For example, a value having a temporal or spatial data type is converted to a binary string.
If a user variable is assigned a nonbinary (character) string value, it has the same character set and collation as the string. The coercibility of user variables is implicit. (This is the same coercibility as for table column values.)
但是手册没有说明:
>支持的整数(例如4字节INT或8字节BIGINT)的大小,无论它们是有符号还是无符号,以及是否应用ZEROFILL(如果是,使用什么显示宽度);
This sqlfiddle似乎建议MySQL 5.5.25将使用BIGINT,根据作业签名,不会应用任何ZEROFILL.
>在固定和浮点值中使用的精度和尺度,因为这不是从赋值中保留的;和
>字符串的最大长度(字符和/或字节).
sqlfiddle受限于220个字节的max_allowed_packet(我不能改变):我猜想支持232字节(4GiB)的LONGTEXT.
可以安全依赖什么限制,特别是在不同的服务器版本和配置上?