Hi, Alexander,
a question about error codes:
On Mar 11, Alexander Barkov wrote:
commit 61b72ed3dde
Author: Alexander Barkov <bar@mariadb.com>
Date: Wed Feb 9 17:59:38 2022 +0400
diff --git a/mysql-test/main/type_blob.test b/mysql-test/main/type_blob.test
index c61ed124139..a5410244ed1 100644
--- a/mysql-test/main/type_blob.test
+++ b/mysql-test/main/type_blob.test
@@ -517,7 +517,7 @@ CREATE TABLE b15776 (a char(2147483648));
--error ER_TOO_BIG_FIELDLENGTH
CREATE TABLE b15776 (a char(4294967295));
# Even BLOB won't hold
---error ER_TOO_BIG_FIELDLENGTH
+--error ER_NOT_SUPPORTED_YET
Why did you change the error?
CREATE TABLE b15776 (a char(4294967296));
diff --git a/mysql-test/main/type_float.result b/mysql-test/main/type_float.result
index 5137a8229b6..9e216711ddd 100644
--- a/mysql-test/main/type_float.result
+++ b/mysql-test/main/type_float.result
@@ -1162,3 +1162,36 @@ fdec 123.456.789,12345678900000000000000000000000000000
#
# 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: This version of MariaDB doesn't yet support 'scale>255'
+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: This version of MariaDB doesn't yet support 'scale>255'
+CREATE TABLE t1 (a DOUBLE(2147483647,2147483647));
+ERROR 42000: This version of MariaDB doesn't yet support 'scale>255'
+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: This version of MariaDB doesn't yet support 'scale>255'
+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
This isn't technically a *syntax* error
Can you use a different error here?
+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
+#
diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy
index 5bb03544762..fdc54f7df27 100644
--- a/sql/sql_yacc.yy
+++ b/sql/sql_yacc.yy
@@ -5975,11 +5977,10 @@ field_type_numeric:
| FLOAT_SYM float_options last_field_options
{
$$.set(&type_handler_float, $2);
- if ($2.length() && !$2.dec())
+ if ($2.has_explicit_length() && !$2.has_explicit_dec())
{
- int err;
- ulonglong tmp_length= my_strtoll10($2.length(), NULL, &err);
- if (unlikely(err || tmp_length > PRECISION_FOR_DOUBLE))
+ ulonglong tmp_length= $2.length();
you don't really need tmp_length here anymore
+ if (unlikely(tmp_length > PRECISION_FOR_DOUBLE))
my_yyabort_error((ER_WRONG_FIELD_SPEC, MYF(0),
Lex->last_field->field_name.str));
if (tmp_length > PRECISION_FOR_FLOAT)
Regards,
Sergei
VP of MariaDB Server Engineering
and security@mariadb.org