diff options
author | Tor Didriksen <tor.didriksen@oracle.com> | 2010-10-19 08:45:18 +0200 |
---|---|---|
committer | Tor Didriksen <tor.didriksen@oracle.com> | 2010-10-19 08:45:18 +0200 |
commit | a6df37dbbf2ba51b6785576a946f664b0996c03c (patch) | |
tree | 9b834a63a661afb32974cc28c628064b12c0c732 | |
parent | b61b785285769b3a2d09bf0ab3d6363f099caa6d (diff) | |
download | mariadb-git-a6df37dbbf2ba51b6785576a946f664b0996c03c.tar.gz |
Bug #57203 Assertion `field_length <= 255' failed.
After the fix for
Bug #55077 Assertion failed: width > 0 && to != ((void *)0), file .\dtoa.c
we no longer try to allocate a string of length 'field_length'
so the asserts are relevant only for ZEROFILL columns.
mysql-test/r/select.result:
Add test case for Bug#57203
mysql-test/t/select.test:
Add test case for Bug#57203
sql/field.cc:
Rewrite the DBUG_ASSERTS on field_length.
-rw-r--r-- | mysql-test/r/select.result | 19 | ||||
-rw-r--r-- | mysql-test/t/select.test | 19 | ||||
-rw-r--r-- | sql/field.cc | 4 |
3 files changed, 40 insertions, 2 deletions
diff --git a/mysql-test/r/select.result b/mysql-test/r/select.result index 96979d257f1..a345a2ae6aa 100644 --- a/mysql-test/r/select.result +++ b/mysql-test/r/select.result @@ -4887,3 +4887,22 @@ col_int_key DROP VIEW view_t1; DROP TABLE t1; # End of test BUG#54515 +# +# Bug #57203 Assertion `field_length <= 255' failed. +# +SELECT coalesce((avg(distinct (geomfromtext("point(25379 -22010)"))))) +UNION ALL +SELECT coalesce((avg(distinct (geomfromtext("point(25379 -22010)"))))) +AS foo +; +coalesce((avg(distinct (geomfromtext("point(25379 -22010)"))))) +0.0000 +0.0000 +CREATE table t1(a text); +INSERT INTO t1 VALUES (''), (''); +SELECT avg(distinct(t1.a)) FROM t1, t1 t2 +GROUP BY t2.a ORDER BY t1.a; +avg(distinct(t1.a)) +0 +DROP TABLE t1; +# End of test BUG#57203 diff --git a/mysql-test/t/select.test b/mysql-test/t/select.test index 87f36c452f2..3ed7213e8d7 100644 --- a/mysql-test/t/select.test +++ b/mysql-test/t/select.test @@ -4147,3 +4147,22 @@ DROP VIEW view_t1; DROP TABLE t1; --echo # End of test BUG#54515 + +--echo # +--echo # Bug #57203 Assertion `field_length <= 255' failed. +--echo # + +SELECT coalesce((avg(distinct (geomfromtext("point(25379 -22010)"))))) +UNION ALL +SELECT coalesce((avg(distinct (geomfromtext("point(25379 -22010)"))))) +AS foo +; + +CREATE table t1(a text); +INSERT INTO t1 VALUES (''), (''); +SELECT avg(distinct(t1.a)) FROM t1, t1 t2 +GROUP BY t2.a ORDER BY t1.a; + +DROP TABLE t1; + +--echo # End of test BUG#57203 diff --git a/sql/field.cc b/sql/field.cc index be7441f6bfd..d746de385b6 100644 --- a/sql/field.cc +++ b/sql/field.cc @@ -4189,7 +4189,7 @@ String *Field_float::val_str(String *val_buffer, String *val_ptr __attribute__((unused))) { ASSERT_COLUMN_MARKED_FOR_READ; - DBUG_ASSERT(field_length <= MAX_FIELD_CHARLENGTH); + DBUG_ASSERT(!zerofill || field_length <= MAX_FIELD_CHARLENGTH); float nr; #ifdef WORDS_BIGENDIAN if (table->s->db_low_byte_first) @@ -4512,7 +4512,7 @@ String *Field_double::val_str(String *val_buffer, String *val_ptr __attribute__((unused))) { ASSERT_COLUMN_MARKED_FOR_READ; - DBUG_ASSERT(field_length <= MAX_FIELD_CHARLENGTH); + DBUG_ASSERT(!zerofill || field_length <= MAX_FIELD_CHARLENGTH); double nr; #ifdef WORDS_BIGENDIAN if (table->s->db_low_byte_first) |