mirror of
https://github.com/MariaDB/server.git
synced 2025-11-25 17:25:02 +03:00
MDEV-27712 Reduce the size of Lex_length_and_dec_st from 16 to 8
User visible change: Removing the length specified by user from error messages: ER_TOO_BIG_SCALE and ER_TOO_BIG_PRECISION as discussed with Sergei.
This commit is contained in:
@@ -390,13 +390,13 @@ ERROR 42000: For float(M,D), double(M,D) or decimal(M,D), M must be >= D (column
|
|||||||
select cast(1 as decimal(5,6));
|
select cast(1 as decimal(5,6));
|
||||||
ERROR 42000: For float(M,D), double(M,D) or decimal(M,D), M must be >= D (column '')
|
ERROR 42000: For float(M,D), double(M,D) or decimal(M,D), M must be >= D (column '')
|
||||||
select cast(1 as double(66,6));
|
select cast(1 as double(66,6));
|
||||||
ERROR 42000: Too big precision 66 specified for '1'. Maximum is 65
|
ERROR 42000: Too big precision specified for '1'. Maximum is 65
|
||||||
select cast(1 as decimal(66,6));
|
select cast(1 as decimal(66,6));
|
||||||
ERROR 42000: Too big precision 66 specified for '1'. Maximum is 65
|
ERROR 42000: Too big precision specified for '1'. Maximum is 65
|
||||||
select cast(1 as decimal(64,63));
|
select cast(1 as decimal(64,63));
|
||||||
ERROR 42000: Too big scale 63 specified for '1'. Maximum is 38
|
ERROR 42000: Too big scale specified for '1'. Maximum is 38
|
||||||
select cast(1 as double(64,63));
|
select cast(1 as double(64,63));
|
||||||
ERROR 42000: Too big scale 63 specified for '1'. Maximum is 38
|
ERROR 42000: Too big scale specified for '1'. Maximum is 38
|
||||||
set names binary;
|
set names binary;
|
||||||
select cast(_latin1'test' as char character set latin2);
|
select cast(_latin1'test' as char character set latin2);
|
||||||
cast(_latin1'test' as char character set latin2)
|
cast(_latin1'test' as char character set latin2)
|
||||||
|
|||||||
@@ -1459,7 +1459,7 @@ Note 1105 Cast to signed converted positive out-of-range integer to it's negativ
|
|||||||
# mysqld
|
# mysqld
|
||||||
#
|
#
|
||||||
SELECT COLUMN_GET(`x`, 'y' AS DECIMAL(5,50));
|
SELECT COLUMN_GET(`x`, 'y' AS DECIMAL(5,50));
|
||||||
ERROR 42000: Too big scale 50 specified for ''y''. Maximum is 38
|
ERROR 42000: Too big scale specified for ''y''. Maximum is 38
|
||||||
#
|
#
|
||||||
# test of symbolic names
|
# test of symbolic names
|
||||||
#
|
#
|
||||||
|
|||||||
@@ -1983,7 +1983,7 @@ select microsecond('12:00:00.123456'), microsecond('2009-12-31 23:59:59.000010')
|
|||||||
microsecond('12:00:00.123456') microsecond('2009-12-31 23:59:59.000010')
|
microsecond('12:00:00.123456') microsecond('2009-12-31 23:59:59.000010')
|
||||||
123456 10
|
123456 10
|
||||||
select now(258);
|
select now(258);
|
||||||
ERROR 42000: Too big precision 258 specified for 'current_timestamp'. Maximum is 6
|
ERROR 42000: Too big precision specified for 'current_timestamp'. Maximum is 6
|
||||||
SELECT 1 FROM DUAL WHERE YEAR(TIMEDIFF(NULL, '12:12:12'));
|
SELECT 1 FROM DUAL WHERE YEAR(TIMEDIFF(NULL, '12:12:12'));
|
||||||
1
|
1
|
||||||
SELECT 1 FROM DUAL WHERE MONTH(TIMEDIFF(NULL, '12:12:12'));
|
SELECT 1 FROM DUAL WHERE MONTH(TIMEDIFF(NULL, '12:12:12'));
|
||||||
|
|||||||
@@ -24,9 +24,9 @@ select time_to_sec(sec_to_time(11111)), time_to_sec(sec_to_time(11111.22222));
|
|||||||
time_to_sec(sec_to_time(11111)) 11111
|
time_to_sec(sec_to_time(11111)) 11111
|
||||||
time_to_sec(sec_to_time(11111.22222)) 11111.22222
|
time_to_sec(sec_to_time(11111.22222)) 11111.22222
|
||||||
select current_timestamp(7);
|
select current_timestamp(7);
|
||||||
ERROR 42000: Too big precision 7 specified for 'current_timestamp'. Maximum is 6
|
ERROR 42000: Too big precision specified for 'current_timestamp'. Maximum is 6
|
||||||
select curtime(7);
|
select curtime(7);
|
||||||
ERROR 42000: Too big precision 7 specified for 'curtime'. Maximum is 6
|
ERROR 42000: Too big precision specified for 'curtime'. Maximum is 6
|
||||||
drop table if exists t1;
|
drop table if exists t1;
|
||||||
create table t1 select sec_to_time(12345), sec_to_time(12345.6789),
|
create table t1 select sec_to_time(12345), sec_to_time(12345.6789),
|
||||||
sec_to_time(1234567e-2), now(), curtime(0),
|
sec_to_time(1234567e-2), now(), curtime(0),
|
||||||
@@ -161,7 +161,7 @@ select cast(cast(@a as time(2)) as time(6));
|
|||||||
cast(cast(@a as time(2)) as time(6))
|
cast(cast(@a as time(2)) as time(6))
|
||||||
12:13:14.120000
|
12:13:14.120000
|
||||||
select CAST(@a AS DATETIME(7));
|
select CAST(@a AS DATETIME(7));
|
||||||
ERROR 42000: Too big precision 7 specified for '@`a`'. Maximum is 6
|
ERROR 42000: Too big precision specified for '@`a`'. Maximum is 6
|
||||||
SELECT CONVERT_TZ('2011-01-02 12:00:00', '+00:00', '+03:00');
|
SELECT CONVERT_TZ('2011-01-02 12:00:00', '+00:00', '+03:00');
|
||||||
CONVERT_TZ('2011-01-02 12:00:00', '+00:00', '+03:00')
|
CONVERT_TZ('2011-01-02 12:00:00', '+00:00', '+03:00')
|
||||||
2011-01-02 15:00:00
|
2011-01-02 15:00:00
|
||||||
|
|||||||
@@ -908,6 +908,8 @@ a
|
|||||||
2042
|
2042
|
||||||
DROP TABLE b15776;
|
DROP TABLE b15776;
|
||||||
CREATE TABLE b15776 (a year(4294967296));
|
CREATE TABLE b15776 (a year(4294967296));
|
||||||
|
Warnings:
|
||||||
|
Note 1287 'YEAR(4294967295)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
|
||||||
SHOW CREATE TABLE b15776;
|
SHOW CREATE TABLE b15776;
|
||||||
Table Create Table
|
Table Create Table
|
||||||
b15776 CREATE TABLE `b15776` (
|
b15776 CREATE TABLE `b15776` (
|
||||||
@@ -921,11 +923,11 @@ DROP TABLE b15776;
|
|||||||
CREATE TABLE b15776 (a year(-2));
|
CREATE TABLE b15776 (a year(-2));
|
||||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '-2))' at line 1
|
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '-2))' at line 1
|
||||||
CREATE TABLE b15776 (a timestamp(4294967294));
|
CREATE TABLE b15776 (a timestamp(4294967294));
|
||||||
ERROR 42000: Too big precision 4294967294 specified for 'a'. Maximum is 6
|
ERROR 42000: Too big precision specified for 'a'. Maximum is 6
|
||||||
CREATE TABLE b15776 (a timestamp(4294967295));
|
CREATE TABLE b15776 (a timestamp(4294967295));
|
||||||
ERROR 42000: Too big precision 4294967295 specified for 'a'. Maximum is 6
|
ERROR 42000: Too big precision specified for 'a'. Maximum is 6
|
||||||
CREATE TABLE b15776 (a timestamp(4294967296));
|
CREATE TABLE b15776 (a timestamp(4294967296));
|
||||||
ERROR 42000: Too big precision 4294967296 specified for 'a'. Maximum is 6
|
ERROR 42000: Too big precision specified for 'a'. Maximum is 6
|
||||||
CREATE TABLE b15776 (a timestamp(-1));
|
CREATE TABLE b15776 (a timestamp(-1));
|
||||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '-1))' at line 1
|
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '-1))' at line 1
|
||||||
CREATE TABLE b15776 (a timestamp(-2));
|
CREATE TABLE b15776 (a timestamp(-2));
|
||||||
@@ -935,6 +937,8 @@ ERROR 42000: Display width out of range for 'a' (max = 255)
|
|||||||
CREATE TABLE b15776 (a char(999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999));
|
CREATE TABLE b15776 (a char(999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999));
|
||||||
ERROR 42000: Column length too big for column 'a' (max = 255); use BLOB or TEXT instead
|
ERROR 42000: Column length too big for column 'a' (max = 255); use BLOB or TEXT instead
|
||||||
CREATE TABLE b15776 (a year(999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999));
|
CREATE TABLE b15776 (a year(999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999));
|
||||||
|
Warnings:
|
||||||
|
Note 1287 'YEAR(4294967295)' is deprecated and will be removed in a future release. Please use YEAR(4) instead
|
||||||
SHOW CREATE TABLE b15776;
|
SHOW CREATE TABLE b15776;
|
||||||
Table Create Table
|
Table Create Table
|
||||||
b15776 CREATE TABLE `b15776` (
|
b15776 CREATE TABLE `b15776` (
|
||||||
|
|||||||
@@ -532,7 +532,9 @@ CREATE TABLE b15776 (a year(4294967295));
|
|||||||
INSERT INTO b15776 VALUES (42);
|
INSERT INTO b15776 VALUES (42);
|
||||||
SELECT * FROM b15776;
|
SELECT * FROM b15776;
|
||||||
DROP TABLE b15776;
|
DROP TABLE b15776;
|
||||||
|
--enable_prepare_warnings
|
||||||
CREATE TABLE b15776 (a year(4294967296));
|
CREATE TABLE b15776 (a year(4294967296));
|
||||||
|
--disable_prepare_warnings
|
||||||
SHOW CREATE TABLE b15776;
|
SHOW CREATE TABLE b15776;
|
||||||
DROP TABLE b15776;
|
DROP TABLE b15776;
|
||||||
--enable_prepare_warnings
|
--enable_prepare_warnings
|
||||||
@@ -560,7 +562,9 @@ CREATE TABLE b15776 (a timestamp(-2));
|
|||||||
CREATE TABLE b15776 (a int(999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999));
|
CREATE TABLE b15776 (a int(999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999));
|
||||||
--error ER_TOO_BIG_FIELDLENGTH
|
--error ER_TOO_BIG_FIELDLENGTH
|
||||||
CREATE TABLE b15776 (a char(999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999));
|
CREATE TABLE b15776 (a char(999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999));
|
||||||
|
--enable_prepare_warnings
|
||||||
CREATE TABLE b15776 (a year(999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999));
|
CREATE TABLE b15776 (a year(999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999));
|
||||||
|
--disable_prepare_warnings
|
||||||
SHOW CREATE TABLE b15776;
|
SHOW CREATE TABLE b15776;
|
||||||
DROP TABLE b15776;
|
DROP TABLE b15776;
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
SET timestamp=UNIX_TIMESTAMP('2001-02-03 10:20:30');
|
SET timestamp=UNIX_TIMESTAMP('2001-02-03 10:20:30');
|
||||||
drop table if exists t1, t2, t3;
|
drop table if exists t1, t2, t3;
|
||||||
create table t1 (a datetime(7));
|
create table t1 (a datetime(7));
|
||||||
ERROR 42000: Too big precision 7 specified for 'a'. Maximum is 6
|
ERROR 42000: Too big precision specified for 'a'. Maximum is 6
|
||||||
create table t1 (a datetime(3), key(a));
|
create table t1 (a datetime(3), key(a));
|
||||||
insert t1 values ('2010-12-11 00:20:03.1234');
|
insert t1 values ('2010-12-11 00:20:03.1234');
|
||||||
insert t1 values ('2010-12-11 15:47:11.1234');
|
insert t1 values ('2010-12-11 15:47:11.1234');
|
||||||
|
|||||||
@@ -721,7 +721,7 @@ t1 CREATE TABLE `t1` (
|
|||||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||||
drop table t1;
|
drop table t1;
|
||||||
create table t1 (d decimal(66,0));
|
create table t1 (d decimal(66,0));
|
||||||
ERROR 42000: Too big precision 66 specified for 'd'. Maximum is 65
|
ERROR 42000: Too big precision specified for 'd'. Maximum is 65
|
||||||
CREATE TABLE t1 (i INT, d1 DECIMAL(9,2), d2 DECIMAL(9,2));
|
CREATE TABLE t1 (i INT, d1 DECIMAL(9,2), d2 DECIMAL(9,2));
|
||||||
INSERT INTO t1 VALUES (1, 101.40, 21.40), (1, -80.00, 0.00),
|
INSERT INTO t1 VALUES (1, 101.40, 21.40), (1, -80.00, 0.00),
|
||||||
(2, 0.00, 0.00), (2, -13.20, 0.00), (2, 59.60, 46.40),
|
(2, 0.00, 0.00), (2, -13.20, 0.00), (2, 59.60, 46.40),
|
||||||
|
|||||||
@@ -133,7 +133,7 @@ min(a)
|
|||||||
-0.010
|
-0.010
|
||||||
drop table t1;
|
drop table t1;
|
||||||
create table t1 (a float(200,100), b double(200,100));
|
create table t1 (a float(200,100), b double(200,100));
|
||||||
ERROR 42000: Too big scale 100 specified for 'a'. Maximum is 30
|
ERROR 42000: Too big scale specified for 'a'. Maximum is 30
|
||||||
create table t1 (c20 char);
|
create table t1 (c20 char);
|
||||||
insert ignore into t1 values (5000.0);
|
insert ignore into t1 values (5000.0);
|
||||||
Warnings:
|
Warnings:
|
||||||
@@ -788,7 +788,7 @@ DROP TABLE t1,t2;
|
|||||||
#
|
#
|
||||||
create or replace table t1 (a double(40,30));
|
create or replace table t1 (a double(40,30));
|
||||||
create or replace table t1 (a double(40,31));
|
create or replace table t1 (a double(40,31));
|
||||||
ERROR 42000: Too big scale 31 specified for 'a'. Maximum is 30
|
ERROR 42000: Too big scale specified for 'a'. Maximum is 30
|
||||||
create or replace table t1 as select 1.01e1;
|
create or replace table t1 as select 1.01e1;
|
||||||
show create table t1;
|
show create table t1;
|
||||||
Table Create Table
|
Table Create Table
|
||||||
@@ -1162,3 +1162,36 @@ fdec 123.456.789,12345678900000000000000000000000000000
|
|||||||
#
|
#
|
||||||
# End of 10.4 tests
|
# End of 10.4 tests
|
||||||
#
|
#
|
||||||
|
#
|
||||||
|
# Start of 10.9 tests
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# MDEV-27712 Reduce the size of Lex_length_and_dec_st from 16 to 8
|
||||||
|
#
|
||||||
|
CREATE TABLE t1 (a DOUBLE(1000,1000));
|
||||||
|
ERROR 42000: Too big scale specified for 'a'. Maximum is 30
|
||||||
|
CREATE TABLE t1 (a DOUBLE(1000,0));
|
||||||
|
ERROR 42000: Display width out of range for 'a' (max = 255)
|
||||||
|
CREATE TABLE t1 (a DOUBLE(0,1000));
|
||||||
|
ERROR 42000: For float(M,D), double(M,D) or decimal(M,D), M must be >= D (column 'a')
|
||||||
|
CREATE TABLE t1 (a DOUBLE(2147483647,2147483647));
|
||||||
|
ERROR 42000: Too big scale specified for 'a'. Maximum is 30
|
||||||
|
CREATE TABLE t1 (a DOUBLE(2147483647,0));
|
||||||
|
ERROR 42000: Display width out of range for 'a' (max = 255)
|
||||||
|
CREATE TABLE t1 (a DOUBLE(0,2147483647));
|
||||||
|
ERROR 42000: For float(M,D), double(M,D) or decimal(M,D), M must be >= D (column 'a')
|
||||||
|
CREATE TABLE t1 (a DOUBLE(2147483648,2147483648));
|
||||||
|
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '2147483648,2147483648))' at line 1
|
||||||
|
CREATE TABLE t1 (a DOUBLE(2147483648,0));
|
||||||
|
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '2147483648,0))' at line 1
|
||||||
|
CREATE TABLE t1 (a DOUBLE(0,2147483648));
|
||||||
|
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '2147483648))' at line 1
|
||||||
|
CREATE TABLE t1 (a DOUBLE(999999999999999999999999999999,999999999999999999999999999999));
|
||||||
|
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '999999999999999999999999999999,999999999999999999999999999999))' at line 1
|
||||||
|
CREATE TABLE t1 (a DOUBLE(999999999999999999999999999999,0));
|
||||||
|
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '999999999999999999999999999999,0))' at line 1
|
||||||
|
CREATE TABLE t1 (a DOUBLE(0,999999999999999999999999999999));
|
||||||
|
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '999999999999999999999999999999))' at line 1
|
||||||
|
#
|
||||||
|
# End of 10.9 tests
|
||||||
|
#
|
||||||
|
|||||||
@@ -703,3 +703,44 @@ DELIMITER ;$$
|
|||||||
--echo #
|
--echo #
|
||||||
--echo # End of 10.4 tests
|
--echo # End of 10.4 tests
|
||||||
--echo #
|
--echo #
|
||||||
|
|
||||||
|
|
||||||
|
--echo #
|
||||||
|
--echo # Start of 10.9 tests
|
||||||
|
--echo #
|
||||||
|
|
||||||
|
--echo #
|
||||||
|
--echo # MDEV-27712 Reduce the size of Lex_length_and_dec_st from 16 to 8
|
||||||
|
--echo #
|
||||||
|
|
||||||
|
--error ER_TOO_BIG_SCALE
|
||||||
|
CREATE TABLE t1 (a DOUBLE(1000,1000));
|
||||||
|
--error ER_TOO_BIG_DISPLAYWIDTH
|
||||||
|
CREATE TABLE t1 (a DOUBLE(1000,0));
|
||||||
|
--error ER_M_BIGGER_THAN_D
|
||||||
|
CREATE TABLE t1 (a DOUBLE(0,1000));
|
||||||
|
|
||||||
|
--error ER_TOO_BIG_SCALE
|
||||||
|
CREATE TABLE t1 (a DOUBLE(2147483647,2147483647));
|
||||||
|
--error ER_TOO_BIG_DISPLAYWIDTH
|
||||||
|
CREATE TABLE t1 (a DOUBLE(2147483647,0));
|
||||||
|
--error ER_M_BIGGER_THAN_D
|
||||||
|
CREATE TABLE t1 (a DOUBLE(0,2147483647));
|
||||||
|
|
||||||
|
--error ER_PARSE_ERROR
|
||||||
|
CREATE TABLE t1 (a DOUBLE(2147483648,2147483648));
|
||||||
|
--error ER_PARSE_ERROR
|
||||||
|
CREATE TABLE t1 (a DOUBLE(2147483648,0));
|
||||||
|
--error ER_PARSE_ERROR
|
||||||
|
CREATE TABLE t1 (a DOUBLE(0,2147483648));
|
||||||
|
|
||||||
|
--error ER_PARSE_ERROR
|
||||||
|
CREATE TABLE t1 (a DOUBLE(999999999999999999999999999999,999999999999999999999999999999));
|
||||||
|
--error ER_PARSE_ERROR
|
||||||
|
CREATE TABLE t1 (a DOUBLE(999999999999999999999999999999,0));
|
||||||
|
--error ER_PARSE_ERROR
|
||||||
|
CREATE TABLE t1 (a DOUBLE(0,999999999999999999999999999999));
|
||||||
|
|
||||||
|
--echo #
|
||||||
|
--echo # End of 10.9 tests
|
||||||
|
--echo #
|
||||||
|
|||||||
@@ -923,13 +923,13 @@ ERROR 42000: For float(M,D), double(M,D) or decimal(M,D), M must be >= D (column
|
|||||||
select cast(ln(14000) as decimal(2,3)) c1;
|
select cast(ln(14000) as decimal(2,3)) c1;
|
||||||
ERROR 42000: For float(M,D), double(M,D) or decimal(M,D), M must be >= D (column '')
|
ERROR 42000: For float(M,D), double(M,D) or decimal(M,D), M must be >= D (column '')
|
||||||
create table t1 (sl decimal(70,30));
|
create table t1 (sl decimal(70,30));
|
||||||
ERROR 42000: Too big precision 70 specified for 'sl'. Maximum is 65
|
ERROR 42000: Too big precision specified for 'sl'. Maximum is 65
|
||||||
create table t1 (sl decimal(32,39));
|
create table t1 (sl decimal(32,39));
|
||||||
ERROR 42000: Too big scale 39 specified for 'sl'. Maximum is 38
|
ERROR 42000: Too big scale specified for 'sl'. Maximum is 38
|
||||||
create table t1 (sl decimal(67,38));
|
create table t1 (sl decimal(67,38));
|
||||||
ERROR 42000: Too big precision 67 specified for 'sl'. Maximum is 65
|
ERROR 42000: Too big precision specified for 'sl'. Maximum is 65
|
||||||
create table t1 (sl decimal(0,50));
|
create table t1 (sl decimal(0,50));
|
||||||
ERROR 42000: Too big scale 50 specified for 'sl'. Maximum is 38
|
ERROR 42000: Too big scale specified for 'sl'. Maximum is 38
|
||||||
create table t1 (sl decimal(0,30));
|
create table t1 (sl decimal(0,30));
|
||||||
ERROR 42000: For float(M,D), double(M,D) or decimal(M,D), M must be >= D (column 'sl')
|
ERROR 42000: For float(M,D), double(M,D) or decimal(M,D), M must be >= D (column 'sl')
|
||||||
create table t1 (sl decimal(5, 5));
|
create table t1 (sl decimal(5, 5));
|
||||||
@@ -1482,12 +1482,12 @@ SELECT CAST(1 AS decimal(65,10));
|
|||||||
CAST(1 AS decimal(65,10))
|
CAST(1 AS decimal(65,10))
|
||||||
1.0000000000
|
1.0000000000
|
||||||
SELECT CAST(1 AS decimal(66,10));
|
SELECT CAST(1 AS decimal(66,10));
|
||||||
ERROR 42000: Too big precision 66 specified for '1'. Maximum is 65
|
ERROR 42000: Too big precision specified for '1'. Maximum is 65
|
||||||
SELECT CAST(1 AS decimal(65,38));
|
SELECT CAST(1 AS decimal(65,38));
|
||||||
CAST(1 AS decimal(65,38))
|
CAST(1 AS decimal(65,38))
|
||||||
1.00000000000000000000000000000000000000
|
1.00000000000000000000000000000000000000
|
||||||
SELECT CAST(1 AS decimal(65,39));
|
SELECT CAST(1 AS decimal(65,39));
|
||||||
ERROR 42000: Too big scale 39 specified for '1'. Maximum is 38
|
ERROR 42000: Too big scale specified for '1'. Maximum is 38
|
||||||
CREATE TABLE t1 (a int DEFAULT NULL, b int DEFAULT NULL);
|
CREATE TABLE t1 (a int DEFAULT NULL, b int DEFAULT NULL);
|
||||||
INSERT INTO t1 VALUES (3,30), (1,10), (2,10);
|
INSERT INTO t1 VALUES (3,30), (1,10), (2,10);
|
||||||
SELECT a+CAST(1 AS decimal(65,30)) AS aa, SUM(b) FROM t1 GROUP BY aa;
|
SELECT a+CAST(1 AS decimal(65,30)) AS aa, SUM(b) FROM t1 GROUP BY aa;
|
||||||
@@ -1496,7 +1496,7 @@ aa SUM(b)
|
|||||||
3.000000000000000000000000000000 10
|
3.000000000000000000000000000000 10
|
||||||
4.000000000000000000000000000000 30
|
4.000000000000000000000000000000 30
|
||||||
SELECT a+CAST(1 AS decimal(65,49)) AS aa, SUM(b) FROM t1 GROUP BY aa;
|
SELECT a+CAST(1 AS decimal(65,49)) AS aa, SUM(b) FROM t1 GROUP BY aa;
|
||||||
ERROR 42000: Too big scale 49 specified for '1'. Maximum is 38
|
ERROR 42000: Too big scale specified for '1'. Maximum is 38
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
CREATE TABLE t1 (a int DEFAULT NULL, b int DEFAULT NULL);
|
CREATE TABLE t1 (a int DEFAULT NULL, b int DEFAULT NULL);
|
||||||
INSERT INTO t1 VALUES (3,30), (1,10), (2,10);
|
INSERT INTO t1 VALUES (3,30), (1,10), (2,10);
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
SET timestamp=UNIX_TIMESTAMP('2001-02-03 10:20:30');
|
SET timestamp=UNIX_TIMESTAMP('2001-02-03 10:20:30');
|
||||||
drop table if exists t1, t2, t3;
|
drop table if exists t1, t2, t3;
|
||||||
create table t1 (a time(7));
|
create table t1 (a time(7));
|
||||||
ERROR 42000: Too big precision 7 specified for 'a'. Maximum is 6
|
ERROR 42000: Too big precision specified for 'a'. Maximum is 6
|
||||||
create table t1 (a time(3), key(a));
|
create table t1 (a time(3), key(a));
|
||||||
insert t1 values ('2010-12-11 00:20:03.1234');
|
insert t1 values ('2010-12-11 00:20:03.1234');
|
||||||
Warnings:
|
Warnings:
|
||||||
@@ -907,3 +907,24 @@ a CEILING(a) CEILING_SP(a) CEILING(a)=CEILING_SP(a)
|
|||||||
DROP FUNCTION FLOOR_SP;
|
DROP FUNCTION FLOOR_SP;
|
||||||
DROP FUNCTION CEILING_SP;
|
DROP FUNCTION CEILING_SP;
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
|
#
|
||||||
|
# Start of 10.9 tests
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# MDEV-27712 Reduce the size of Lex_length_and_dec_st from 16 to 8
|
||||||
|
#
|
||||||
|
CREATE TABLE t1 (a TIME(4294967295));
|
||||||
|
ERROR 42000: Too big precision specified for 'a'. Maximum is 6
|
||||||
|
CREATE TABLE t1 (a TIME(4294967296));
|
||||||
|
ERROR 42000: Too big precision specified for 'a'. Maximum is 6
|
||||||
|
CREATE TABLE t1 (a TIME(999999999999999999999999999999));
|
||||||
|
ERROR 42000: Too big precision specified for 'a'. Maximum is 6
|
||||||
|
SELECT CAST(1 AS TIME(4294967295));
|
||||||
|
ERROR 42000: Too big precision specified for '1'. Maximum is 6
|
||||||
|
SELECT CAST(1 AS TIME(4294967296));
|
||||||
|
ERROR 42000: Too big precision specified for '1'. Maximum is 6
|
||||||
|
SELECT CAST(1 AS TIME(999999999999999999999999999999));
|
||||||
|
ERROR 42000: Too big precision specified for '1'. Maximum is 6
|
||||||
|
#
|
||||||
|
# Start of 10.9 tests
|
||||||
|
#
|
||||||
|
|||||||
@@ -196,3 +196,30 @@ DROP FUNCTION FLOOR_SP;
|
|||||||
DROP FUNCTION CEILING_SP;
|
DROP FUNCTION CEILING_SP;
|
||||||
|
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
|
|
||||||
|
|
||||||
|
--echo #
|
||||||
|
--echo # Start of 10.9 tests
|
||||||
|
--echo #
|
||||||
|
|
||||||
|
--echo #
|
||||||
|
--echo # MDEV-27712 Reduce the size of Lex_length_and_dec_st from 16 to 8
|
||||||
|
--echo #
|
||||||
|
|
||||||
|
--error ER_TOO_BIG_PRECISION
|
||||||
|
CREATE TABLE t1 (a TIME(4294967295));
|
||||||
|
--error ER_TOO_BIG_PRECISION
|
||||||
|
CREATE TABLE t1 (a TIME(4294967296));
|
||||||
|
--error ER_TOO_BIG_PRECISION
|
||||||
|
CREATE TABLE t1 (a TIME(999999999999999999999999999999));
|
||||||
|
|
||||||
|
--error ER_TOO_BIG_PRECISION
|
||||||
|
SELECT CAST(1 AS TIME(4294967295));
|
||||||
|
--error ER_TOO_BIG_PRECISION
|
||||||
|
SELECT CAST(1 AS TIME(4294967296));
|
||||||
|
--error ER_TOO_BIG_PRECISION
|
||||||
|
SELECT CAST(1 AS TIME(999999999999999999999999999999));
|
||||||
|
|
||||||
|
--echo #
|
||||||
|
--echo # Start of 10.9 tests
|
||||||
|
--echo #
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
SET timestamp=UNIX_TIMESTAMP('2001-02-03 10:20:30');
|
SET timestamp=UNIX_TIMESTAMP('2001-02-03 10:20:30');
|
||||||
drop table if exists t1, t2, t3;
|
drop table if exists t1, t2, t3;
|
||||||
create table t1 (a timestamp(7));
|
create table t1 (a timestamp(7));
|
||||||
ERROR 42000: Too big precision 7 specified for 'a'. Maximum is 6
|
ERROR 42000: Too big precision specified for 'a'. Maximum is 6
|
||||||
create table t1 (a timestamp(3), key(a));
|
create table t1 (a timestamp(3), key(a));
|
||||||
insert t1 values ('2010-12-11 00:20:03.1234');
|
insert t1 values ('2010-12-11 00:20:03.1234');
|
||||||
insert t1 values ('2010-12-11 15:47:11.1234');
|
insert t1 values ('2010-12-11 15:47:11.1234');
|
||||||
|
|||||||
@@ -3925,7 +3925,7 @@ DROP TABLE t1;
|
|||||||
# MDEV-18916: crash in Window_spec::print_partition() with decimals
|
# MDEV-18916: crash in Window_spec::print_partition() with decimals
|
||||||
#
|
#
|
||||||
SELECT cast((rank() over w1) as decimal (53,56));
|
SELECT cast((rank() over w1) as decimal (53,56));
|
||||||
ERROR 42000: Too big scale 56 specified for 'rank() over w1'. Maximum is 38
|
ERROR 42000: Too big scale specified for 'rank() over w1'. Maximum is 38
|
||||||
SELECT cast((rank() over w1) as decimal (53,30));
|
SELECT cast((rank() over w1) as decimal (53,30));
|
||||||
ERROR HY000: Window specification with name 'w1' is not defined
|
ERROR HY000: Window specification with name 'w1' is not defined
|
||||||
#
|
#
|
||||||
|
|||||||
@@ -3931,7 +3931,7 @@ DROP TABLE t1;
|
|||||||
# MDEV-18916: crash in Window_spec::print_partition() with decimals
|
# MDEV-18916: crash in Window_spec::print_partition() with decimals
|
||||||
#
|
#
|
||||||
SELECT cast((rank() over w1) as decimal (53,56));
|
SELECT cast((rank() over w1) as decimal (53,56));
|
||||||
ERROR 42000: Too big scale 56 specified for 'rank() over w1'. Maximum is 38
|
ERROR 42000: Too big scale specified for 'rank() over w1'. Maximum is 38
|
||||||
SELECT cast((rank() over w1) as decimal (53,30));
|
SELECT cast((rank() over w1) as decimal (53,30));
|
||||||
ERROR HY000: Window specification with name 'w1' is not defined
|
ERROR HY000: Window specification with name 'w1' is not defined
|
||||||
#
|
#
|
||||||
|
|||||||
@@ -1010,7 +1010,7 @@ ROUND(c1,c2) TRUNCATE(c1,c2)
|
|||||||
1.133000 1.132000
|
1.133000 1.132000
|
||||||
DROP TABLE t5;
|
DROP TABLE t5;
|
||||||
CREATE TABLE t7(c1 DECIMAL(66,0));
|
CREATE TABLE t7(c1 DECIMAL(66,0));
|
||||||
ERROR 42000: Too big precision 66 specified for 'c1'. Maximum is 65
|
ERROR 42000: Too big precision specified for 'c1'. Maximum is 65
|
||||||
CREATE TABLE t7(c1 DECIMAL(5,10));
|
CREATE TABLE t7(c1 DECIMAL(5,10));
|
||||||
ERROR 42000: For float(M,D), double(M,D) or decimal(M,D), M must be >= D (column 'c1')
|
ERROR 42000: For float(M,D), double(M,D) or decimal(M,D), M must be >= D (column 'c1')
|
||||||
DROP TABLE t1,t2;
|
DROP TABLE t1,t2;
|
||||||
|
|||||||
@@ -143,7 +143,7 @@ BEGIN
|
|||||||
SET @v1 = f1;
|
SET @v1 = f1;
|
||||||
SELECT @v1;
|
SELECT @v1;
|
||||||
END//
|
END//
|
||||||
ERROR 42000: Too big precision 256 specified for 'f1'. Maximum is 65
|
ERROR 42000: Too big precision specified for 'f1'. Maximum is 65
|
||||||
DROP PROCEDURE IF EXISTS sp1//
|
DROP PROCEDURE IF EXISTS sp1//
|
||||||
Warnings:
|
Warnings:
|
||||||
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
|
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
|
||||||
@@ -153,7 +153,7 @@ BEGIN
|
|||||||
SET @v1 = f1;
|
SET @v1 = f1;
|
||||||
SELECT @v1;
|
SELECT @v1;
|
||||||
END//
|
END//
|
||||||
ERROR 42000: Too big precision 66 specified for 'f1'. Maximum is 65
|
ERROR 42000: Too big precision specified for 'f1'. Maximum is 65
|
||||||
DROP PROCEDURE IF EXISTS sp1//
|
DROP PROCEDURE IF EXISTS sp1//
|
||||||
Warnings:
|
Warnings:
|
||||||
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
|
Note 1305 PROCEDURE db_storedproc.sp1 does not exist
|
||||||
@@ -1549,7 +1549,7 @@ BEGIN
|
|||||||
SET f1 = 1000000 + f1;
|
SET f1 = 1000000 + f1;
|
||||||
RETURN f1;
|
RETURN f1;
|
||||||
END//
|
END//
|
||||||
ERROR 42000: Too big scale 61 specified for 'f1'. Maximum is 38
|
ERROR 42000: Too big scale specified for 'f1'. Maximum is 38
|
||||||
SELECT fn1( 1.3326e+8 );
|
SELECT fn1( 1.3326e+8 );
|
||||||
ERROR 42000: FUNCTION db_storedproc.fn1 does not exist
|
ERROR 42000: FUNCTION db_storedproc.fn1 does not exist
|
||||||
CREATE FUNCTION fn1( f1 DECIMAL(63, 30) ) RETURNS DECIMAL(63, 30)
|
CREATE FUNCTION fn1( f1 DECIMAL(63, 30) ) RETURNS DECIMAL(63, 30)
|
||||||
@@ -5837,7 +5837,7 @@ fetch cur1 into e;
|
|||||||
SELECT x, y, z, a, b, c, d, e;
|
SELECT x, y, z, a, b, c, d, e;
|
||||||
close cur1;
|
close cur1;
|
||||||
END//
|
END//
|
||||||
ERROR 42000: Too big scale 255 specified for 'b'. Maximum is 38
|
ERROR 42000: Too big scale specified for 'b'. Maximum is 38
|
||||||
CALL sp6();
|
CALL sp6();
|
||||||
ERROR 42000: PROCEDURE db_storedproc.sp6 does not exist
|
ERROR 42000: PROCEDURE db_storedproc.sp6 does not exist
|
||||||
DROP PROCEDURE IF EXISTS sp6;
|
DROP PROCEDURE IF EXISTS sp6;
|
||||||
|
|||||||
22
sql/field.cc
22
sql/field.cc
@@ -10428,16 +10428,12 @@ void
|
|||||||
Column_definition_attributes::set_length_and_dec(const Lex_length_and_dec_st
|
Column_definition_attributes::set_length_and_dec(const Lex_length_and_dec_st
|
||||||
&type)
|
&type)
|
||||||
{
|
{
|
||||||
if (type.length())
|
if (type.has_explicit_length())
|
||||||
{
|
length= type.length_overflowed() ? (ulonglong) UINT_MAX32 + 1 :
|
||||||
int err;
|
(ulonglong) type.length();
|
||||||
length= my_strtoll10(type.length(), NULL, &err);
|
|
||||||
if (err)
|
|
||||||
length= ~0ULL; // safety
|
|
||||||
}
|
|
||||||
|
|
||||||
if (type.dec())
|
if (type.has_explicit_dec())
|
||||||
decimals= (uint) atoi(type.dec());
|
decimals= type.dec();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -10536,7 +10532,7 @@ bool Column_definition::fix_attributes_real(uint default_length)
|
|||||||
}
|
}
|
||||||
if (decimals != NOT_FIXED_DEC && decimals >= FLOATING_POINT_DECIMALS)
|
if (decimals != NOT_FIXED_DEC && decimals >= FLOATING_POINT_DECIMALS)
|
||||||
{
|
{
|
||||||
my_error(ER_TOO_BIG_SCALE, MYF(0), static_cast<ulonglong>(decimals),
|
my_error(ER_TOO_BIG_SCALE, MYF(0),
|
||||||
field_name.str, static_cast<uint>(FLOATING_POINT_DECIMALS-1));
|
field_name.str, static_cast<uint>(FLOATING_POINT_DECIMALS-1));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -10548,14 +10544,14 @@ bool Column_definition::fix_attributes_decimal()
|
|||||||
{
|
{
|
||||||
if (decimals >= NOT_FIXED_DEC)
|
if (decimals >= NOT_FIXED_DEC)
|
||||||
{
|
{
|
||||||
my_error(ER_TOO_BIG_SCALE, MYF(0), static_cast<ulonglong>(decimals),
|
my_error(ER_TOO_BIG_SCALE, MYF(0),
|
||||||
field_name.str, static_cast<uint>(NOT_FIXED_DEC - 1));
|
field_name.str, static_cast<uint>(NOT_FIXED_DEC - 1));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
my_decimal_trim(&length, &decimals);
|
my_decimal_trim(&length, &decimals);
|
||||||
if (length > DECIMAL_MAX_PRECISION)
|
if (length > DECIMAL_MAX_PRECISION)
|
||||||
{
|
{
|
||||||
my_error(ER_TOO_BIG_PRECISION, MYF(0), length, field_name.str,
|
my_error(ER_TOO_BIG_PRECISION, MYF(0), field_name.str,
|
||||||
DECIMAL_MAX_PRECISION);
|
DECIMAL_MAX_PRECISION);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -10584,7 +10580,7 @@ bool Column_definition::fix_attributes_temporal_with_time(uint int_part_length)
|
|||||||
{
|
{
|
||||||
if (length > MAX_DATETIME_PRECISION)
|
if (length > MAX_DATETIME_PRECISION)
|
||||||
{
|
{
|
||||||
my_error(ER_TOO_BIG_PRECISION, MYF(0), length, field_name.str,
|
my_error(ER_TOO_BIG_PRECISION, MYF(0), field_name.str,
|
||||||
MAX_DATETIME_PRECISION);
|
MAX_DATETIME_PRECISION);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5995,7 +5995,7 @@ Item *create_func_dyncol_delete(THD *thd, Item *str, List<Item> &nums)
|
|||||||
|
|
||||||
Item *create_func_dyncol_get(THD *thd, Item *str, Item *num,
|
Item *create_func_dyncol_get(THD *thd, Item *str, Item *num,
|
||||||
const Type_handler *handler,
|
const Type_handler *handler,
|
||||||
const char *c_len, const char *c_dec,
|
const Lex_length_and_dec_st &length_dec,
|
||||||
CHARSET_INFO *cs)
|
CHARSET_INFO *cs)
|
||||||
{
|
{
|
||||||
Item *res;
|
Item *res;
|
||||||
@@ -6003,5 +6003,5 @@ Item *create_func_dyncol_get(THD *thd, Item *str, Item *num,
|
|||||||
if (likely(!(res= new (thd->mem_root) Item_dyncol_get(thd, str, num))))
|
if (likely(!(res= new (thd->mem_root) Item_dyncol_get(thd, str, num))))
|
||||||
return res; // Return NULL
|
return res; // Return NULL
|
||||||
return handler->create_typecast_item(thd, res,
|
return handler->create_typecast_item(thd, res,
|
||||||
Type_cast_attributes(c_len, c_dec, cs));
|
Type_cast_attributes(length_dec, cs));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -313,7 +313,7 @@ Item *create_func_dyncol_add(THD *thd, Item *str,
|
|||||||
Item *create_func_dyncol_delete(THD *thd, Item *str, List<Item> &nums);
|
Item *create_func_dyncol_delete(THD *thd, Item *str, List<Item> &nums);
|
||||||
Item *create_func_dyncol_get(THD *thd, Item *num, Item *str,
|
Item *create_func_dyncol_get(THD *thd, Item *num, Item *str,
|
||||||
const Type_handler *handler,
|
const Type_handler *handler,
|
||||||
const char *c_len, const char *c_dec,
|
const Lex_length_and_dec_st &length_and_dec,
|
||||||
CHARSET_INFO *cs);
|
CHARSET_INFO *cs);
|
||||||
Item *create_func_dyncol_json(THD *thd, Item *str);
|
Item *create_func_dyncol_json(THD *thd, Item *str);
|
||||||
|
|
||||||
|
|||||||
@@ -3762,31 +3762,22 @@ struct Lex_cast_type_st: public Lex_length_and_dec_st
|
|||||||
private:
|
private:
|
||||||
const Type_handler *m_type_handler;
|
const Type_handler *m_type_handler;
|
||||||
public:
|
public:
|
||||||
void set(const Type_handler *handler, const char *length, const char *dec)
|
|
||||||
{
|
|
||||||
m_type_handler= handler;
|
|
||||||
Lex_length_and_dec_st::set(length, dec);
|
|
||||||
}
|
|
||||||
void set(const Type_handler *handler, Lex_length_and_dec_st length_and_dec)
|
void set(const Type_handler *handler, Lex_length_and_dec_st length_and_dec)
|
||||||
{
|
{
|
||||||
m_type_handler= handler;
|
m_type_handler= handler;
|
||||||
Lex_length_and_dec_st::operator=(length_and_dec);
|
Lex_length_and_dec_st::operator=(length_and_dec);
|
||||||
}
|
}
|
||||||
void set(const Type_handler *handler, const char *length)
|
|
||||||
{
|
|
||||||
set(handler, length, 0);
|
|
||||||
}
|
|
||||||
void set(const Type_handler *handler)
|
void set(const Type_handler *handler)
|
||||||
{
|
{
|
||||||
set(handler, 0, 0);
|
m_type_handler= handler;
|
||||||
|
Lex_length_and_dec_st::reset();
|
||||||
}
|
}
|
||||||
const Type_handler *type_handler() const { return m_type_handler; }
|
const Type_handler *type_handler() const { return m_type_handler; }
|
||||||
Item *create_typecast_item(THD *thd, Item *item,
|
Item *create_typecast_item(THD *thd, Item *item,
|
||||||
CHARSET_INFO *cs= NULL) const
|
CHARSET_INFO *cs= NULL) const
|
||||||
{
|
{
|
||||||
return m_type_handler->
|
return m_type_handler->
|
||||||
create_typecast_item(thd, item,
|
create_typecast_item(thd, item, Type_cast_attributes(*this, cs));
|
||||||
Type_cast_attributes(length(), dec(), cs));
|
|
||||||
}
|
}
|
||||||
Item *create_typecast_item_or_error(THD *thd, Item *item,
|
Item *create_typecast_item_or_error(THD *thd, Item *item,
|
||||||
CHARSET_INFO *cs= NULL) const;
|
CHARSET_INFO *cs= NULL) const;
|
||||||
|
|||||||
@@ -1551,7 +1551,7 @@ bool Item_func_curtime::fix_fields(THD *thd, Item **items)
|
|||||||
{
|
{
|
||||||
if (decimals > TIME_SECOND_PART_DIGITS)
|
if (decimals > TIME_SECOND_PART_DIGITS)
|
||||||
{
|
{
|
||||||
my_error(ER_TOO_BIG_PRECISION, MYF(0), static_cast<ulonglong>(decimals),
|
my_error(ER_TOO_BIG_PRECISION, MYF(0),
|
||||||
func_name(), TIME_SECOND_PART_DIGITS);
|
func_name(), TIME_SECOND_PART_DIGITS);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@@ -1627,7 +1627,7 @@ bool Item_func_now::fix_fields(THD *thd, Item **items)
|
|||||||
{
|
{
|
||||||
if (decimals > TIME_SECOND_PART_DIGITS)
|
if (decimals > TIME_SECOND_PART_DIGITS)
|
||||||
{
|
{
|
||||||
my_error(ER_TOO_BIG_PRECISION, MYF(0), static_cast<ulonglong>(decimals),
|
my_error(ER_TOO_BIG_PRECISION, MYF(0),
|
||||||
func_name(), TIME_SECOND_PART_DIGITS);
|
func_name(), TIME_SECOND_PART_DIGITS);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5771,13 +5771,13 @@ ER_SP_NO_RECURSION
|
|||||||
ger "Rekursive gespeicherte Routinen und Triggers sind nicht erlaubt"
|
ger "Rekursive gespeicherte Routinen und Triggers sind nicht erlaubt"
|
||||||
spa "No autorizadas funciones almacenadas recursivas ni disparadores"
|
spa "No autorizadas funciones almacenadas recursivas ni disparadores"
|
||||||
ER_TOO_BIG_SCALE 42000 S1009
|
ER_TOO_BIG_SCALE 42000 S1009
|
||||||
eng "Too big scale %llu specified for '%-.192s'. Maximum is %u"
|
eng "Too big scale specified for '%-.192s'. Maximum is %u"
|
||||||
ger "Zu großer Skalierungsfaktor %llu für '%-.192s' angegeben. Maximum ist %u"
|
ger "Zu großer Skalierungsfaktor für '%-.192s' angegeben. Maximum ist %u"
|
||||||
spa "Escala %llu demasiado grande especificada para '%-.192s'. El máximo es de %u"
|
spa "Escala demasiado grande especificada para '%-.192s'. El máximo es de %u"
|
||||||
ER_TOO_BIG_PRECISION 42000 S1009
|
ER_TOO_BIG_PRECISION 42000 S1009
|
||||||
eng "Too big precision %llu specified for '%-.192s'. Maximum is %u"
|
eng "Too big precision specified for '%-.192s'. Maximum is %u"
|
||||||
ger "Zu große Genauigkeit %llu für '%-.192s' angegeben. Maximum ist %u"
|
ger "Zu große Genauigkeit für '%-.192s' angegeben. Maximum ist %u"
|
||||||
spa "Precisión %llu demasiado grande especificada para '%-.192s'. El máximo es de %u"
|
spa "Precisión demasiado grande especificada para '%-.192s'. El máximo es de %u"
|
||||||
ER_M_BIGGER_THAN_D 42000 S1009
|
ER_M_BIGGER_THAN_D 42000 S1009
|
||||||
eng "For float(M,D), double(M,D) or decimal(M,D), M must be >= D (column '%-.192s')"
|
eng "For float(M,D), double(M,D) or decimal(M,D), M must be >= D (column '%-.192s')"
|
||||||
ger "Für FLOAT(M,D), DOUBLE(M,D) oder DECIMAL(M,D) muss M >= D sein (Feld '%-.192s')"
|
ger "Für FLOAT(M,D), DOUBLE(M,D) oder DECIMAL(M,D) muss M >= D sein (Feld '%-.192s')"
|
||||||
|
|||||||
@@ -11488,14 +11488,42 @@ Lex_cast_type_st::create_typecast_item_or_error(THD *thd, Item *item,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Lex_field_type_st::set_handler_length_flags(const Type_handler *handler,
|
void
|
||||||
const char *length,
|
Lex_length_and_dec_st::set(const char *plength, const char *pdec)
|
||||||
|
{
|
||||||
|
reset();
|
||||||
|
|
||||||
|
if ((m_has_explicit_length= (plength != nullptr)))
|
||||||
|
{
|
||||||
|
int err;
|
||||||
|
ulonglong tmp= my_strtoll10(plength, NULL, &err);
|
||||||
|
if ((m_length_overflowed= (tmp > UINT_MAX32 || err)))
|
||||||
|
m_length= UINT_MAX32;
|
||||||
|
else
|
||||||
|
m_length= (uint32) tmp;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((m_has_explicit_dec= (pdec != nullptr)))
|
||||||
|
{
|
||||||
|
int err;
|
||||||
|
ulonglong tmp= my_strtoll10(pdec, NULL, &err);
|
||||||
|
if ((m_dec_overflowed= (tmp > 255 || err)))
|
||||||
|
m_dec= 255;
|
||||||
|
else
|
||||||
|
m_dec= (uint8) tmp;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
Lex_field_type_st::set_handler_length_flags(const Type_handler *handler,
|
||||||
|
const Lex_length_and_dec_st &attr,
|
||||||
uint32 flags)
|
uint32 flags)
|
||||||
{
|
{
|
||||||
DBUG_ASSERT(!handler->is_unsigned());
|
DBUG_ASSERT(!handler->is_unsigned());
|
||||||
|
set(handler, attr);
|
||||||
if (flags & UNSIGNED_FLAG)
|
if (flags & UNSIGNED_FLAG)
|
||||||
handler= handler->type_handler_unsigned();
|
m_handler= m_handler->type_handler_unsigned();
|
||||||
set(handler, length, NULL);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -2751,7 +2751,7 @@ Type_handler_string::Column_definition_set_attributes(
|
|||||||
const
|
const
|
||||||
{
|
{
|
||||||
Type_handler::Column_definition_set_attributes(thd, def, attr, cs, type);
|
Type_handler::Column_definition_set_attributes(thd, def, attr, cs, type);
|
||||||
if (attr.length())
|
if (attr.has_explicit_length())
|
||||||
return false;
|
return false;
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case COLUMN_DEFINITION_ROUTINE_PARAM:
|
case COLUMN_DEFINITION_ROUTINE_PARAM:
|
||||||
@@ -2783,7 +2783,7 @@ Type_handler_varchar::Column_definition_set_attributes(
|
|||||||
const
|
const
|
||||||
{
|
{
|
||||||
Type_handler::Column_definition_set_attributes(thd, def, attr, cs, type);
|
Type_handler::Column_definition_set_attributes(thd, def, attr, cs, type);
|
||||||
if (attr.length())
|
if (attr.has_explicit_length())
|
||||||
return false;
|
return false;
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case COLUMN_DEFINITION_ROUTINE_PARAM:
|
case COLUMN_DEFINITION_ROUTINE_PARAM:
|
||||||
@@ -7698,11 +7698,10 @@ static const char* item_name(Item *a, String *str)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void wrong_precision_error(uint errcode, Item *a,
|
static void wrong_precision_error(uint errcode, Item *a, uint maximum)
|
||||||
ulonglong number, uint maximum)
|
|
||||||
{
|
{
|
||||||
StringBuffer<1024> buf(system_charset_info);
|
StringBuffer<1024> buf(system_charset_info);
|
||||||
my_error(errcode, MYF(0), number, item_name(a, &buf), maximum);
|
my_error(errcode, MYF(0), item_name(a, &buf), maximum);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -7721,12 +7720,12 @@ bool get_length_and_scale(ulonglong length, ulonglong decimals,
|
|||||||
{
|
{
|
||||||
if (length > (ulonglong) max_precision)
|
if (length > (ulonglong) max_precision)
|
||||||
{
|
{
|
||||||
wrong_precision_error(ER_TOO_BIG_PRECISION, a, length, max_precision);
|
wrong_precision_error(ER_TOO_BIG_PRECISION, a, max_precision);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
if (decimals > (ulonglong) max_scale)
|
if (decimals > (ulonglong) max_scale)
|
||||||
{
|
{
|
||||||
wrong_precision_error(ER_TOO_BIG_SCALE, a, decimals, max_scale);
|
wrong_precision_error(ER_TOO_BIG_SCALE, a, max_scale);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -7769,8 +7768,7 @@ Item *Type_handler_time_common::
|
|||||||
{
|
{
|
||||||
if (attr.decimals() > MAX_DATETIME_PRECISION)
|
if (attr.decimals() > MAX_DATETIME_PRECISION)
|
||||||
{
|
{
|
||||||
wrong_precision_error(ER_TOO_BIG_PRECISION, item, attr.decimals(),
|
wrong_precision_error(ER_TOO_BIG_PRECISION, item, MAX_DATETIME_PRECISION);
|
||||||
MAX_DATETIME_PRECISION);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return new (thd->mem_root)
|
return new (thd->mem_root)
|
||||||
@@ -7784,8 +7782,7 @@ Item *Type_handler_datetime_common::
|
|||||||
{
|
{
|
||||||
if (attr.decimals() > MAX_DATETIME_PRECISION)
|
if (attr.decimals() > MAX_DATETIME_PRECISION)
|
||||||
{
|
{
|
||||||
wrong_precision_error(ER_TOO_BIG_PRECISION, item, attr.decimals(),
|
wrong_precision_error(ER_TOO_BIG_PRECISION, item, MAX_DATETIME_PRECISION);
|
||||||
MAX_DATETIME_PRECISION);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return new (thd->mem_root)
|
return new (thd->mem_root)
|
||||||
@@ -7863,8 +7860,7 @@ Item *Type_handler_interval_DDhhmmssff::
|
|||||||
{
|
{
|
||||||
if (attr.decimals() > MAX_DATETIME_PRECISION)
|
if (attr.decimals() > MAX_DATETIME_PRECISION)
|
||||||
{
|
{
|
||||||
wrong_precision_error(ER_TOO_BIG_PRECISION, item, attr.decimals(),
|
wrong_precision_error(ER_TOO_BIG_PRECISION, item, MAX_DATETIME_PRECISION);
|
||||||
MAX_DATETIME_PRECISION);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return new (thd->mem_root) Item_interval_DDhhmmssff_typecast(thd, item,
|
return new (thd->mem_root) Item_interval_DDhhmmssff_typecast(thd, item,
|
||||||
|
|||||||
@@ -3336,28 +3336,21 @@ class Type_cast_attributes
|
|||||||
bool m_length_specified;
|
bool m_length_specified;
|
||||||
bool m_decimals_specified;
|
bool m_decimals_specified;
|
||||||
public:
|
public:
|
||||||
Type_cast_attributes(const char *c_len, const char *c_dec, CHARSET_INFO *cs)
|
Type_cast_attributes(const Lex_length_and_dec_st &length_and_dec,
|
||||||
|
CHARSET_INFO *cs)
|
||||||
:m_charset(cs), m_length(0), m_decimals(0),
|
:m_charset(cs), m_length(0), m_decimals(0),
|
||||||
m_length_specified(false), m_decimals_specified(false)
|
m_length_specified(false), m_decimals_specified(false)
|
||||||
{
|
{
|
||||||
set_length_and_dec(c_len, c_dec);
|
m_length= length_and_dec.length_overflowed() ? (ulonglong) UINT_MAX32 + 1 :
|
||||||
|
length_and_dec.length();
|
||||||
|
m_decimals= length_and_dec.dec();
|
||||||
|
m_length_specified= length_and_dec.has_explicit_length();
|
||||||
|
m_decimals_specified= length_and_dec.has_explicit_dec();
|
||||||
}
|
}
|
||||||
Type_cast_attributes(CHARSET_INFO *cs)
|
Type_cast_attributes(CHARSET_INFO *cs)
|
||||||
:m_charset(cs), m_length(0), m_decimals(0),
|
:m_charset(cs), m_length(0), m_decimals(0),
|
||||||
m_length_specified(false), m_decimals_specified(false)
|
m_length_specified(false), m_decimals_specified(false)
|
||||||
{ }
|
{ }
|
||||||
void set_length_and_dec(const char *c_len, const char *c_dec)
|
|
||||||
{
|
|
||||||
int error;
|
|
||||||
/*
|
|
||||||
We don't have to check for error here as sql_yacc.yy has guaranteed
|
|
||||||
that the values are in range of ulonglong
|
|
||||||
*/
|
|
||||||
if ((m_length_specified= (c_len != NULL)))
|
|
||||||
m_length= (ulonglong) my_strtoll10(c_len, NULL, &error);
|
|
||||||
if ((m_decimals_specified= (c_dec != NULL)))
|
|
||||||
m_decimals= (ulonglong) my_strtoll10(c_dec, NULL, &error);
|
|
||||||
}
|
|
||||||
CHARSET_INFO *charset() const { return m_charset; }
|
CHARSET_INFO *charset() const { return m_charset; }
|
||||||
bool length_specified() const { return m_length_specified; }
|
bool length_specified() const { return m_length_specified; }
|
||||||
bool decimals_specified() const { return m_decimals_specified; }
|
bool decimals_specified() const { return m_decimals_specified; }
|
||||||
|
|||||||
@@ -1365,7 +1365,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
|
|||||||
wild_and_where
|
wild_and_where
|
||||||
|
|
||||||
%type <const_simple_string>
|
%type <const_simple_string>
|
||||||
field_length opt_field_length
|
field_length_str
|
||||||
opt_compression_method
|
opt_compression_method
|
||||||
|
|
||||||
%type <string>
|
%type <string>
|
||||||
@@ -1565,6 +1565,8 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
|
|||||||
%type <Lex_cast_type> cast_type cast_type_numeric cast_type_temporal
|
%type <Lex_cast_type> cast_type cast_type_numeric cast_type_temporal
|
||||||
|
|
||||||
%type <Lex_length_and_dec> precision opt_precision float_options
|
%type <Lex_length_and_dec> precision opt_precision float_options
|
||||||
|
field_length opt_field_length
|
||||||
|
field_scale opt_field_scale
|
||||||
|
|
||||||
%type <lex_user> user grant_user grant_role user_or_role current_role
|
%type <lex_user> user grant_user grant_role user_or_role current_role
|
||||||
admin_option_for_role user_maybe_role
|
admin_option_for_role user_maybe_role
|
||||||
@@ -5975,14 +5977,12 @@ field_type_numeric:
|
|||||||
| FLOAT_SYM float_options last_field_options
|
| FLOAT_SYM float_options last_field_options
|
||||||
{
|
{
|
||||||
$$.set(&type_handler_float, $2);
|
$$.set(&type_handler_float, $2);
|
||||||
if ($2.length() && !$2.dec())
|
if ($2.has_explicit_length() && !$2.has_explicit_dec())
|
||||||
{
|
{
|
||||||
int err;
|
if (unlikely($2.length() > PRECISION_FOR_DOUBLE))
|
||||||
ulonglong tmp_length= my_strtoll10($2.length(), NULL, &err);
|
|
||||||
if (unlikely(err || tmp_length > PRECISION_FOR_DOUBLE))
|
|
||||||
my_yyabort_error((ER_WRONG_FIELD_SPEC, MYF(0),
|
my_yyabort_error((ER_WRONG_FIELD_SPEC, MYF(0),
|
||||||
Lex->last_field->field_name.str));
|
Lex->last_field->field_name.str));
|
||||||
if (tmp_length > PRECISION_FOR_FLOAT)
|
if ($2.length() > PRECISION_FOR_FLOAT)
|
||||||
$$.set(&type_handler_double);
|
$$.set(&type_handler_double);
|
||||||
else
|
else
|
||||||
$$.set(&type_handler_float);
|
$$.set(&type_handler_float);
|
||||||
@@ -5994,17 +5994,17 @@ field_type_numeric:
|
|||||||
}
|
}
|
||||||
| BOOL_SYM
|
| BOOL_SYM
|
||||||
{
|
{
|
||||||
$$.set(&type_handler_stiny, "1");
|
$$.set_handler_length(&type_handler_stiny, 1);
|
||||||
}
|
}
|
||||||
| BOOLEAN_SYM
|
| BOOLEAN_SYM
|
||||||
{
|
{
|
||||||
$$.set(&type_handler_stiny, "1");
|
$$.set_handler_length(&type_handler_stiny, 1);
|
||||||
}
|
}
|
||||||
| DECIMAL_SYM float_options last_field_options
|
| DECIMAL_SYM float_options last_field_options
|
||||||
{ $$.set(&type_handler_newdecimal, $2);}
|
{ $$.set(&type_handler_newdecimal, $2);}
|
||||||
| NUMBER_ORACLE_SYM float_options last_field_options
|
| NUMBER_ORACLE_SYM float_options last_field_options
|
||||||
{
|
{
|
||||||
if ($2.length() != 0)
|
if ($2.has_explicit_length())
|
||||||
$$.set(&type_handler_newdecimal, $2);
|
$$.set(&type_handler_newdecimal, $2);
|
||||||
else
|
else
|
||||||
$$.set(&type_handler_double);
|
$$.set(&type_handler_double);
|
||||||
@@ -6066,14 +6066,12 @@ field_type_string:
|
|||||||
field_type_temporal:
|
field_type_temporal:
|
||||||
YEAR_SYM opt_field_length last_field_options
|
YEAR_SYM opt_field_length last_field_options
|
||||||
{
|
{
|
||||||
if ($2)
|
if ($2.has_explicit_length())
|
||||||
{
|
{
|
||||||
errno= 0;
|
if ($2.length() != 4)
|
||||||
ulong length= strtoul($2, NULL, 10);
|
|
||||||
if (errno == 0 && length <= MAX_FIELD_BLOBLENGTH && length != 4)
|
|
||||||
{
|
{
|
||||||
char buff[sizeof("YEAR()") + MY_INT64_NUM_DECIMAL_DIGITS + 1];
|
char buff[sizeof("YEAR()") + MY_INT64_NUM_DECIMAL_DIGITS + 1];
|
||||||
my_snprintf(buff, sizeof(buff), "YEAR(%lu)", length);
|
my_snprintf(buff, sizeof(buff), "YEAR(%u)", (uint) $2.length());
|
||||||
push_warning_printf(thd, Sql_condition::WARN_LEVEL_NOTE,
|
push_warning_printf(thd, Sql_condition::WARN_LEVEL_NOTE,
|
||||||
ER_WARN_DEPRECATED_SYNTAX,
|
ER_WARN_DEPRECATED_SYNTAX,
|
||||||
ER_THD(thd, ER_WARN_DEPRECATED_SYNTAX),
|
ER_THD(thd, ER_WARN_DEPRECATED_SYNTAX),
|
||||||
@@ -6220,9 +6218,9 @@ srid_option:
|
|||||||
;
|
;
|
||||||
|
|
||||||
float_options:
|
float_options:
|
||||||
/* empty */ { $$.set(0, 0); }
|
/* empty */ { $$.reset(); }
|
||||||
| field_length { $$.set($1, 0); }
|
| field_length
|
||||||
| precision { $$= $1; }
|
| precision
|
||||||
;
|
;
|
||||||
|
|
||||||
precision:
|
precision:
|
||||||
@@ -6242,20 +6240,33 @@ last_field_options:
|
|||||||
field_options { Lex->last_field->flags|= ($$= $1); }
|
field_options { Lex->last_field->flags|= ($$= $1); }
|
||||||
;
|
;
|
||||||
|
|
||||||
field_length:
|
field_length_str:
|
||||||
'(' LONG_NUM ')' { $$= $2.str; }
|
'(' LONG_NUM ')' { $$= $2.str; }
|
||||||
| '(' ULONGLONG_NUM ')' { $$= $2.str; }
|
| '(' ULONGLONG_NUM ')' { $$= $2.str; }
|
||||||
| '(' DECIMAL_NUM ')' { $$= $2.str; }
|
| '(' DECIMAL_NUM ')' { $$= $2.str; }
|
||||||
| '(' NUM ')' { $$= $2.str; }
|
| '(' NUM ')' { $$= $2.str; }
|
||||||
;
|
;
|
||||||
|
|
||||||
|
field_length: field_length_str { $$.set($1, NULL); }
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
field_scale: field_length_str { $$.set(NULL, $1); }
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
opt_field_length:
|
opt_field_length:
|
||||||
/* empty */ { $$= (char*) 0; /* use default length */ }
|
/* empty */ { $$.reset(); /* use default length */ }
|
||||||
| field_length { $$= $1; }
|
| field_length
|
||||||
|
;
|
||||||
|
|
||||||
|
opt_field_scale:
|
||||||
|
/* empty */ { $$.reset(); }
|
||||||
|
| field_scale
|
||||||
;
|
;
|
||||||
|
|
||||||
opt_precision:
|
opt_precision:
|
||||||
/* empty */ { $$.set(0, 0); }
|
/* empty */ { $$.reset(); }
|
||||||
| precision { $$= $1; }
|
| precision { $$= $1; }
|
||||||
;
|
;
|
||||||
|
|
||||||
@@ -9418,8 +9429,8 @@ numeric_dyncol_type:
|
|||||||
|
|
||||||
temporal_dyncol_type:
|
temporal_dyncol_type:
|
||||||
DATE_SYM { $$.set(DYN_COL_DATE); }
|
DATE_SYM { $$.set(DYN_COL_DATE); }
|
||||||
| TIME_SYM opt_field_length { $$.set(DYN_COL_TIME, 0, $2); }
|
| TIME_SYM opt_field_scale { $$.set(DYN_COL_TIME, $2); }
|
||||||
| DATETIME opt_field_length { $$.set(DYN_COL_DATETIME, 0, $2); }
|
| DATETIME opt_field_scale { $$.set(DYN_COL_DATETIME, $2); }
|
||||||
;
|
;
|
||||||
|
|
||||||
string_dyncol_type:
|
string_dyncol_type:
|
||||||
@@ -9448,12 +9459,12 @@ dyncall_create_element:
|
|||||||
$$->value= $3;
|
$$->value= $3;
|
||||||
$$->type= (DYNAMIC_COLUMN_TYPE)$4.dyncol_type();
|
$$->type= (DYNAMIC_COLUMN_TYPE)$4.dyncol_type();
|
||||||
$$->cs= lex->charset;
|
$$->cs= lex->charset;
|
||||||
if ($4.length())
|
if ($4.has_explicit_length())
|
||||||
$$->len= strtoul($4.length(), NULL, 10);
|
$$->len= $4.length();
|
||||||
else
|
else
|
||||||
$$->len= 0;
|
$$->len= 0;
|
||||||
if ($4.dec())
|
if ($4.has_explicit_dec())
|
||||||
$$->frac= strtoul($4.dec(), NULL, 10);
|
$$->frac= $4.dec();
|
||||||
else
|
else
|
||||||
$$->len= 0;
|
$$->len= 0;
|
||||||
}
|
}
|
||||||
@@ -10142,8 +10153,7 @@ function_call_nonkeyword:
|
|||||||
{
|
{
|
||||||
LEX *lex= Lex;
|
LEX *lex= Lex;
|
||||||
$$= create_func_dyncol_get(thd, $3, $5, $7.type_handler(),
|
$$= create_func_dyncol_get(thd, $3, $5, $7.type_handler(),
|
||||||
$7.length(), $7.dec(),
|
$7, lex->charset);
|
||||||
lex->charset);
|
|
||||||
if (unlikely($$ == NULL))
|
if (unlikely($$ == NULL))
|
||||||
MYSQL_YYABORT;
|
MYSQL_YYABORT;
|
||||||
}
|
}
|
||||||
@@ -11060,7 +11070,7 @@ cast_type:
|
|||||||
| NCHAR_SYM opt_field_length
|
| NCHAR_SYM opt_field_length
|
||||||
{
|
{
|
||||||
Lex->charset= national_charset_info;
|
Lex->charset= national_charset_info;
|
||||||
$$.set(&type_handler_long_blob, $2, 0);
|
$$.set(&type_handler_long_blob, $2);
|
||||||
}
|
}
|
||||||
| cast_type_numeric { $$= $1; Lex->charset= NULL; }
|
| cast_type_numeric { $$= $1; Lex->charset= NULL; }
|
||||||
| cast_type_temporal { $$= $1; Lex->charset= NULL; }
|
| cast_type_temporal { $$= $1; Lex->charset= NULL; }
|
||||||
@@ -11094,11 +11104,11 @@ cast_type_numeric:
|
|||||||
|
|
||||||
cast_type_temporal:
|
cast_type_temporal:
|
||||||
DATE_SYM { $$.set(&type_handler_newdate); }
|
DATE_SYM { $$.set(&type_handler_newdate); }
|
||||||
| TIME_SYM opt_field_length { $$.set(&type_handler_time2, 0, $2); }
|
| TIME_SYM opt_field_scale { $$.set(&type_handler_time2, $2); }
|
||||||
| DATETIME opt_field_length { $$.set(&type_handler_datetime2, 0, $2); }
|
| DATETIME opt_field_scale { $$.set(&type_handler_datetime2, $2); }
|
||||||
| INTERVAL_SYM DAY_SECOND_SYM field_length
|
| INTERVAL_SYM DAY_SECOND_SYM field_scale
|
||||||
{
|
{
|
||||||
$$.set(&type_handler_interval_DDhhmmssff, 0, $3);
|
$$.set(&type_handler_interval_DDhhmmssff, $3);
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
@@ -11282,7 +11292,7 @@ json_table_column_type:
|
|||||||
FOR_SYM ORDINALITY_SYM
|
FOR_SYM ORDINALITY_SYM
|
||||||
{
|
{
|
||||||
Lex_field_type_st type;
|
Lex_field_type_st type;
|
||||||
type.set_handler_length_flags(&type_handler_slong, 0, 0);
|
type.set(&type_handler_slong);
|
||||||
Lex->last_field->set_attributes(thd, type, Lex->charset,
|
Lex->last_field->set_attributes(thd, type, Lex->charset,
|
||||||
COLUMN_DEFINITION_TABLE_FIELD);
|
COLUMN_DEFINITION_TABLE_FIELD);
|
||||||
Lex->json_table->m_cur_json_table_column->
|
Lex->json_table->m_cur_json_table_column->
|
||||||
|
|||||||
@@ -602,16 +602,74 @@ public:
|
|||||||
struct Lex_length_and_dec_st
|
struct Lex_length_and_dec_st
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
const char *m_length;
|
uint32 m_length;
|
||||||
const char *m_dec;
|
uint8 m_dec;
|
||||||
|
bool m_has_explicit_length:1;
|
||||||
|
bool m_has_explicit_dec:1;
|
||||||
|
bool m_length_overflowed:1;
|
||||||
|
bool m_dec_overflowed:1;
|
||||||
public:
|
public:
|
||||||
void set(const char *length, const char *dec)
|
void reset()
|
||||||
|
{
|
||||||
|
m_length= 0;
|
||||||
|
m_dec= 0;
|
||||||
|
m_has_explicit_length= false;
|
||||||
|
m_has_explicit_dec= false;
|
||||||
|
m_length_overflowed= false;
|
||||||
|
m_dec_overflowed= false;
|
||||||
|
}
|
||||||
|
void set_length_only(uint32 length)
|
||||||
|
{
|
||||||
|
m_length= length;
|
||||||
|
m_dec= 0;
|
||||||
|
m_has_explicit_length= true;
|
||||||
|
m_has_explicit_dec= false;
|
||||||
|
m_length_overflowed= false;
|
||||||
|
m_dec_overflowed= false;
|
||||||
|
}
|
||||||
|
void set_dec_only(uint8 dec)
|
||||||
|
{
|
||||||
|
m_length= 0;
|
||||||
|
m_dec= dec;
|
||||||
|
m_has_explicit_length= false;
|
||||||
|
m_has_explicit_dec= true;
|
||||||
|
m_length_overflowed= false;
|
||||||
|
m_dec_overflowed= false;
|
||||||
|
}
|
||||||
|
void set_length_and_dec(uint32 length, uint8 dec)
|
||||||
{
|
{
|
||||||
m_length= length;
|
m_length= length;
|
||||||
m_dec= dec;
|
m_dec= dec;
|
||||||
|
m_has_explicit_length= true;
|
||||||
|
m_has_explicit_dec= true;
|
||||||
|
m_length_overflowed= false;
|
||||||
|
m_dec_overflowed= false;
|
||||||
|
}
|
||||||
|
void set(const char *length, const char *dec);
|
||||||
|
uint32 length() const
|
||||||
|
{
|
||||||
|
return m_length;
|
||||||
|
}
|
||||||
|
uint8 dec() const
|
||||||
|
{
|
||||||
|
return m_dec;
|
||||||
|
}
|
||||||
|
bool has_explicit_length() const
|
||||||
|
{
|
||||||
|
return m_has_explicit_length;
|
||||||
|
}
|
||||||
|
bool has_explicit_dec() const
|
||||||
|
{
|
||||||
|
return m_has_explicit_dec;
|
||||||
|
}
|
||||||
|
bool length_overflowed() const
|
||||||
|
{
|
||||||
|
return m_length_overflowed;
|
||||||
|
}
|
||||||
|
bool dec_overflowed() const
|
||||||
|
{
|
||||||
|
return m_dec_overflowed;
|
||||||
}
|
}
|
||||||
const char *length() const { return m_length; }
|
|
||||||
const char *dec() const { return m_dec; }
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -619,26 +677,24 @@ struct Lex_field_type_st: public Lex_length_and_dec_st
|
|||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
const Type_handler *m_handler;
|
const Type_handler *m_handler;
|
||||||
void set(const Type_handler *handler, const char *length, const char *dec)
|
|
||||||
{
|
|
||||||
m_handler= handler;
|
|
||||||
Lex_length_and_dec_st::set(length, dec);
|
|
||||||
}
|
|
||||||
public:
|
public:
|
||||||
void set(const Type_handler *handler, Lex_length_and_dec_st length_and_dec)
|
void set(const Type_handler *handler, Lex_length_and_dec_st length_and_dec)
|
||||||
{
|
{
|
||||||
m_handler= handler;
|
m_handler= handler;
|
||||||
Lex_length_and_dec_st::operator=(length_and_dec);
|
Lex_length_and_dec_st::operator=(length_and_dec);
|
||||||
}
|
}
|
||||||
void set_handler_length_flags(const Type_handler *handler, const char *length,
|
void set_handler_length_flags(const Type_handler *handler,
|
||||||
|
const Lex_length_and_dec_st &length,
|
||||||
uint32 flags);
|
uint32 flags);
|
||||||
void set(const Type_handler *handler, const char *length)
|
void set_handler_length(const Type_handler *handler, uint32 length)
|
||||||
{
|
{
|
||||||
set(handler, length, 0);
|
m_handler= handler;
|
||||||
|
Lex_length_and_dec_st::set_length_only(length);
|
||||||
}
|
}
|
||||||
void set(const Type_handler *handler)
|
void set(const Type_handler *handler)
|
||||||
{
|
{
|
||||||
set(handler, 0, 0);
|
m_handler= handler;
|
||||||
|
Lex_length_and_dec_st::reset();
|
||||||
}
|
}
|
||||||
void set_handler(const Type_handler *handler)
|
void set_handler(const Type_handler *handler)
|
||||||
{
|
{
|
||||||
@@ -653,23 +709,15 @@ struct Lex_dyncol_type_st: public Lex_length_and_dec_st
|
|||||||
private:
|
private:
|
||||||
int m_type; // enum_dynamic_column_type is not visible here, so use int
|
int m_type; // enum_dynamic_column_type is not visible here, so use int
|
||||||
public:
|
public:
|
||||||
void set(int type, const char *length, const char *dec)
|
|
||||||
{
|
|
||||||
m_type= type;
|
|
||||||
Lex_length_and_dec_st::set(length, dec);
|
|
||||||
}
|
|
||||||
void set(int type, Lex_length_and_dec_st length_and_dec)
|
void set(int type, Lex_length_and_dec_st length_and_dec)
|
||||||
{
|
{
|
||||||
m_type= type;
|
m_type= type;
|
||||||
Lex_length_and_dec_st::operator=(length_and_dec);
|
Lex_length_and_dec_st::operator=(length_and_dec);
|
||||||
}
|
}
|
||||||
void set(int type, const char *length)
|
|
||||||
{
|
|
||||||
set(type, length, 0);
|
|
||||||
}
|
|
||||||
void set(int type)
|
void set(int type)
|
||||||
{
|
{
|
||||||
set(type, 0, 0);
|
m_type= type;
|
||||||
|
Lex_length_and_dec_st::reset();
|
||||||
}
|
}
|
||||||
int dyncol_type() const { return m_type; }
|
int dyncol_type() const { return m_type; }
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1423,11 +1423,11 @@ d d0 d1_1 d10_2 d60_10 n n0_0 n1 n20_4 n65_4
|
|||||||
9999999999 9999999999 0.9 99999999.99 99999999999999999999999999999999999999999999999999.9999999999 9999999999 9999999999 9 9999999999999999.9999 9999999999999999999999999999999999999999999999999999999999999.9999
|
9999999999 9999999999 0.9 99999999.99 99999999999999999999999999999999999999999999999999.9999999999 9999999999 9999999999 9 9999999999999999.9999 9999999999999999999999999999999999999999999999999999999999999.9999
|
||||||
9999999999 9999999999 0.9 99999999.99 99999999999999999999999999999999999999999999999999.9999999999 9999999999 9999999999 9 9999999999999999.9999 9999999999999999999999999999999999999999999999999999999999999.9999
|
9999999999 9999999999 0.9 99999999.99 99999999999999999999999999999999999999999999999999.9999999999 9999999999 9999999999 9 9999999999999999.9999 9999999999999999999999999999999999999999999999999999999999999.9999
|
||||||
ALTER TABLE t1 ADD COLUMN n66 NUMERIC(66) NOT NULL;
|
ALTER TABLE t1 ADD COLUMN n66 NUMERIC(66) NOT NULL;
|
||||||
ERROR 42000: Too big precision 66 specified for 'n66'. Maximum is 65
|
ERROR 42000: Too big precision specified for 'n66'. Maximum is 65
|
||||||
ALTER TABLE t1 ADD COLUMN n66_6 DECIMAL(66,6) NOT NULL;
|
ALTER TABLE t1 ADD COLUMN n66_6 DECIMAL(66,6) NOT NULL;
|
||||||
ERROR 42000: Too big precision 66 specified for 'n66_6'. Maximum is 65
|
ERROR 42000: Too big precision specified for 'n66_6'. Maximum is 65
|
||||||
ALTER TABLE t1 ADD COLUMN n66_66 DECIMAL(66,66) NOT NULL;
|
ALTER TABLE t1 ADD COLUMN n66_66 DECIMAL(66,66) NOT NULL;
|
||||||
ERROR 42000: Too big scale 66 specified for 'n66_66'. Maximum is 38
|
ERROR 42000: Too big scale specified for 'n66_66'. Maximum is 38
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
DROP TABLE IF EXISTS t1;
|
DROP TABLE IF EXISTS t1;
|
||||||
#----------------------------------
|
#----------------------------------
|
||||||
@@ -1825,7 +1825,7 @@ r1_1 0.9
|
|||||||
r1_1 0.9
|
r1_1 0.9
|
||||||
ALTER TABLE t1 ADD COLUMN d0_0 DOUBLE(0,0) NOT NULL;
|
ALTER TABLE t1 ADD COLUMN d0_0 DOUBLE(0,0) NOT NULL;
|
||||||
ALTER TABLE t1 ADD COLUMN n66_6 DECIMAL(256,1) NOT NULL;
|
ALTER TABLE t1 ADD COLUMN n66_6 DECIMAL(256,1) NOT NULL;
|
||||||
ERROR 42000: Too big precision 256 specified for 'n66_6'. Maximum is 65
|
ERROR 42000: Too big precision specified for 'n66_6'. Maximum is 65
|
||||||
ALTER TABLE t1 ADD COLUMN n66_66 DECIMAL(40,35) NOT NULL;
|
ALTER TABLE t1 ADD COLUMN n66_66 DECIMAL(40,35) NOT NULL;
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
DROP TABLE IF EXISTS t1;
|
DROP TABLE IF EXISTS t1;
|
||||||
|
|||||||
@@ -1232,11 +1232,11 @@ d d0 d1_1 d10_2 d60_10 n n0_0 n1 n20_4 n65_4
|
|||||||
9999999999 9999999999 0.9 99999999.99 99999999999999999999999999999999999999999999999999.9999999999 9999999999 9999999999 9 9999999999999999.9999 9999999999999999999999999999999999999999999999999999999999999.9999
|
9999999999 9999999999 0.9 99999999.99 99999999999999999999999999999999999999999999999999.9999999999 9999999999 9999999999 9 9999999999999999.9999 9999999999999999999999999999999999999999999999999999999999999.9999
|
||||||
9999999999 9999999999 0.9 99999999.99 99999999999999999999999999999999999999999999999999.9999999999 9999999999 9999999999 9 9999999999999999.9999 9999999999999999999999999999999999999999999999999999999999999.9999
|
9999999999 9999999999 0.9 99999999.99 99999999999999999999999999999999999999999999999999.9999999999 9999999999 9999999999 9 9999999999999999.9999 9999999999999999999999999999999999999999999999999999999999999.9999
|
||||||
ALTER TABLE t1 ADD COLUMN n66 NUMERIC(66) NULL;
|
ALTER TABLE t1 ADD COLUMN n66 NUMERIC(66) NULL;
|
||||||
ERROR 42000: Too big precision 66 specified for 'n66'. Maximum is 65
|
ERROR 42000: Too big precision specified for 'n66'. Maximum is 65
|
||||||
ALTER TABLE t1 ADD COLUMN n66_6 DECIMAL(66,6) NULL;
|
ALTER TABLE t1 ADD COLUMN n66_6 DECIMAL(66,6) NULL;
|
||||||
ERROR 42000: Too big precision 66 specified for 'n66_6'. Maximum is 65
|
ERROR 42000: Too big precision specified for 'n66_6'. Maximum is 65
|
||||||
ALTER TABLE t1 ADD COLUMN n66_66 DECIMAL(66,66) NULL;
|
ALTER TABLE t1 ADD COLUMN n66_66 DECIMAL(66,66) NULL;
|
||||||
ERROR 42000: Too big scale 66 specified for 'n66_66'. Maximum is 38
|
ERROR 42000: Too big scale specified for 'n66_66'. Maximum is 38
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
DROP TABLE IF EXISTS t1;
|
DROP TABLE IF EXISTS t1;
|
||||||
CREATE TABLE t1 (
|
CREATE TABLE t1 (
|
||||||
@@ -1612,7 +1612,7 @@ r1_1 0.9
|
|||||||
r1_1 0.9
|
r1_1 0.9
|
||||||
ALTER TABLE t1 ADD COLUMN d0_0 DOUBLE(0,0) NULL;
|
ALTER TABLE t1 ADD COLUMN d0_0 DOUBLE(0,0) NULL;
|
||||||
ALTER TABLE t1 ADD COLUMN n66_6 DECIMAL(256,1) NULL;
|
ALTER TABLE t1 ADD COLUMN n66_6 DECIMAL(256,1) NULL;
|
||||||
ERROR 42000: Too big precision 256 specified for 'n66_6'. Maximum is 65
|
ERROR 42000: Too big precision specified for 'n66_6'. Maximum is 65
|
||||||
ALTER TABLE t1 ADD COLUMN n66_66 DECIMAL(40,35) NULL;
|
ALTER TABLE t1 ADD COLUMN n66_66 DECIMAL(40,35) NULL;
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
DROP TABLE IF EXISTS t1;
|
DROP TABLE IF EXISTS t1;
|
||||||
|
|||||||
@@ -148,11 +148,11 @@ d d0 d1_1 d10_2 d60_10 n n0_0 n1 n20_4 n65_4
|
|||||||
9999999999 9999999999 0.9 99999999.99 99999999999999999999999999999999999999999999999999.9999999999 9999999999 9999999999 9 9999999999999999.9999 9999999999999999999999999999999999999999999999999999999999999.9999
|
9999999999 9999999999 0.9 99999999.99 99999999999999999999999999999999999999999999999999.9999999999 9999999999 9999999999 9 9999999999999999.9999 9999999999999999999999999999999999999999999999999999999999999.9999
|
||||||
9999999999 9999999999 0.9 99999999.99 99999999999999999999999999999999999999999999999999.9999999999 9999999999 9999999999 9 9999999999999999.9999 9999999999999999999999999999999999999999999999999999999999999.9999
|
9999999999 9999999999 0.9 99999999.99 99999999999999999999999999999999999999999999999999.9999999999 9999999999 9999999999 9 9999999999999999.9999 9999999999999999999999999999999999999999999999999999999999999.9999
|
||||||
ALTER TABLE t1 ADD COLUMN n66 NUMERIC(66) UNSIGNED;
|
ALTER TABLE t1 ADD COLUMN n66 NUMERIC(66) UNSIGNED;
|
||||||
ERROR 42000: Too big precision 66 specified for 'n66'. Maximum is 65
|
ERROR 42000: Too big precision specified for 'n66'. Maximum is 65
|
||||||
ALTER TABLE t1 ADD COLUMN n66_6 DECIMAL(66,6) UNSIGNED;
|
ALTER TABLE t1 ADD COLUMN n66_6 DECIMAL(66,6) UNSIGNED;
|
||||||
ERROR 42000: Too big precision 66 specified for 'n66_6'. Maximum is 65
|
ERROR 42000: Too big precision specified for 'n66_6'. Maximum is 65
|
||||||
ALTER TABLE t1 ADD COLUMN n66_66 DECIMAL(66,66) UNSIGNED;
|
ALTER TABLE t1 ADD COLUMN n66_66 DECIMAL(66,66) UNSIGNED;
|
||||||
ERROR 42000: Too big scale 66 specified for 'n66_66'. Maximum is 38
|
ERROR 42000: Too big scale specified for 'n66_66'. Maximum is 38
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
CREATE TABLE t1 (
|
CREATE TABLE t1 (
|
||||||
a DECIMAL UNSIGNED,
|
a DECIMAL UNSIGNED,
|
||||||
@@ -499,7 +499,7 @@ r1_1 0.9
|
|||||||
r1_1 0.9
|
r1_1 0.9
|
||||||
ALTER TABLE t1 ADD COLUMN d0_0 DOUBLE(0,0) UNSIGNED;
|
ALTER TABLE t1 ADD COLUMN d0_0 DOUBLE(0,0) UNSIGNED;
|
||||||
ALTER TABLE t1 ADD COLUMN n66_6 DECIMAL(256,1) UNSIGNED;
|
ALTER TABLE t1 ADD COLUMN n66_6 DECIMAL(256,1) UNSIGNED;
|
||||||
ERROR 42000: Too big precision 256 specified for 'n66_6'. Maximum is 65
|
ERROR 42000: Too big precision specified for 'n66_6'. Maximum is 65
|
||||||
ALTER TABLE t1 ADD COLUMN n66_66 DECIMAL(40,35) UNSIGNED;
|
ALTER TABLE t1 ADD COLUMN n66_66 DECIMAL(40,35) UNSIGNED;
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
CREATE TABLE t1 (
|
CREATE TABLE t1 (
|
||||||
|
|||||||
@@ -123,9 +123,9 @@ d d0 d1_1 d10_2 d60_10 n n0_0 n1 n20_4 n65_4
|
|||||||
9999999999 9999999999 0.9 99999999.99 99999999999999999999999999999999999999999999999999.9999999999 9999999999 9999999999 9 9999999999999999.9999 9999999999999999999999999999999999999999999999999999999999999.9999
|
9999999999 9999999999 0.9 99999999.99 99999999999999999999999999999999999999999999999999.9999999999 9999999999 9999999999 9 9999999999999999.9999 9999999999999999999999999999999999999999999999999999999999999.9999
|
||||||
9999999999 9999999999 0.9 99999999.99 99999999999999999999999999999999999999999999999999.9999999999 9999999999 9999999999 9 9999999999999999.9999 9999999999999999999999999999999999999999999999999999999999999.9999
|
9999999999 9999999999 0.9 99999999.99 99999999999999999999999999999999999999999999999999.9999999999 9999999999 9999999999 9 9999999999999999.9999 9999999999999999999999999999999999999999999999999999999999999.9999
|
||||||
ALTER TABLE t1 ADD COLUMN n66 NUMERIC(66) ;
|
ALTER TABLE t1 ADD COLUMN n66 NUMERIC(66) ;
|
||||||
ERROR 42000: Too big precision 66 specified for 'n66'. Maximum is 65
|
ERROR 42000: Too big precision specified for 'n66'. Maximum is 65
|
||||||
ALTER TABLE t1 ADD COLUMN n66_6 DECIMAL(66,6) ;
|
ALTER TABLE t1 ADD COLUMN n66_6 DECIMAL(66,6) ;
|
||||||
ERROR 42000: Too big precision 66 specified for 'n66_6'. Maximum is 65
|
ERROR 42000: Too big precision specified for 'n66_6'. Maximum is 65
|
||||||
ALTER TABLE t1 ADD COLUMN n66_66 DECIMAL(66,66) ;
|
ALTER TABLE t1 ADD COLUMN n66_66 DECIMAL(66,66) ;
|
||||||
ERROR 42000: Too big scale 66 specified for 'n66_66'. Maximum is 38
|
ERROR 42000: Too big scale specified for 'n66_66'. Maximum is 38
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
|
|||||||
@@ -309,6 +309,6 @@ r1_1 0.9
|
|||||||
r1_1 0.9
|
r1_1 0.9
|
||||||
ALTER TABLE t1 ADD COLUMN d0_0 DOUBLE(0,0) ;
|
ALTER TABLE t1 ADD COLUMN d0_0 DOUBLE(0,0) ;
|
||||||
ALTER TABLE t1 ADD COLUMN n66_6 DECIMAL(256,1) ;
|
ALTER TABLE t1 ADD COLUMN n66_6 DECIMAL(256,1) ;
|
||||||
ERROR 42000: Too big precision 256 specified for 'n66_6'. Maximum is 65
|
ERROR 42000: Too big precision specified for 'n66_6'. Maximum is 65
|
||||||
ALTER TABLE t1 ADD COLUMN n66_66 DECIMAL(40,35) ;
|
ALTER TABLE t1 ADD COLUMN n66_66 DECIMAL(40,35) ;
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
|
|||||||
Reference in New Issue
Block a user