Lars-Erik,
patch looks ok. Please rework some minor test case issues explained
inline.
Extra: please test what happens with sql_mode=ANSI_QUOTES and something
like
[12:42] root@test>create table """t1""" (a int) engine myisam;
Query OK, 0 rows affected (0.01 sec)
[12:42] root@test>show tables;
+----------------+
| Tables_in_test |
+----------------+
| "t1" |
+----------------+
1 row in set (0.00 sec)
[12:42] root@test>drop table """t1""";
Query OK, 0 rows affected (0.00 sec)
On Mi, 2008-11-05 at 10:29 +0000, Lars-Erik.Bjork@stripped wrote:
> #At file:///home/lb200670/devel/mysql/nanna21/
>
> 2901 lars-erik.bjork@stripped 2008-11-05
> This is a commit for bug#40158
> (Falcon assertion in StorageInterface::encodeRecord() line 2635 on CREATE
> TABLE)
>
> The nature of this bug is explained earlier.
>
> This patch adds a bool argument to StorageTableShare::cleanupFieldName
> telling if the function should double the number of quotes or not. So
> far, StorageInterface::mapFields, is the only place this method is
> called, passing 'false'. All other places it is called passing
> 'true'. This will ensure that the parser still gets the expected
> number of quotes and we are able to look up the fields correctly.
>
> I have also added a regression test for this bug, creating - and
> inserting into - a table with a field name containing quotes.
> added:
> mysql-test/suite/falcon/r/falcon_bug_40158.result
> mysql-test/suite/falcon/t/falcon_bug_40158.test
> modified:
> storage/falcon/StorageTableShare.cpp
> storage/falcon/StorageTableShare.h
> storage/falcon/ha_falcon.cpp
>
> === added file 'mysql-test/suite/falcon/r/falcon_bug_40158.result'
> --- a/mysql-test/suite/falcon/r/falcon_bug_40158.result 1970-01-01 00:00:00 +0000
> +++ b/mysql-test/suite/falcon/r/falcon_bug_40158.result 2008-11-05 10:29:40 +0000
> @@ -0,0 +1,9 @@
> +*** Bug #40158 ***
> +SET @@storage_engine = 'Falcon';
> +DROP TABLE IF EXISTS t1;
> +CREATE TABLE t1 (`"strangename"` int) engine=falcon;
> +INSERT INTO t1 VALUES (1);
> +SELECT * FROM t1;
> +"strangename"
> +1
> +DROP TABLE t1;
>
> === added file 'mysql-test/suite/falcon/t/falcon_bug_40158.test'
> --- a/mysql-test/suite/falcon/t/falcon_bug_40158.test 1970-01-01 00:00:00 +0000
> +++ b/mysql-test/suite/falcon/t/falcon_bug_40158.test 2008-11-05 10:29:40 +0000
> @@ -0,0 +1,34 @@
> +--source include/have_falcon.inc
> +
> +#
> +# Bug #40158: Falcon assertion in StorageInterface::encodeRecord() line 2635 on
> CREATE TABLE
> +#
> +--echo *** Bug #40158 ***
> +
> +# ----------------------------------------------------- #
> +# --- Initialisation --- #
> +# ----------------------------------------------------- #
> +let $engine = 'Falcon';
> +eval SET @@storage_engine = $engine;
> +
> +--disable_warnings
> +DROP TABLE IF EXISTS t1;
> +--enable_warnings
> +
> +# ----------------------------------------------------- #
> +# --- Test --- #
> +# ----------------------------------------------------- #
> +
> +CREATE TABLE t1 (`"strangename"` int) engine=falcon;
You don't need the engine=falcon part here.
> +INSERT INTO t1 VALUES (1);
> +
> +# ----------------------------------------------------- #
> +# --- Check --- #
> +# ----------------------------------------------------- #
> +
> +SELECT * FROM t1;
As final check we usually do a SELECT count(*) FROM t1;
> +
> +# ----------------------------------------------------- #
> +# --- Final cleanup --- #
> +# ----------------------------------------------------- #
> +DROP TABLE t1;
[cut]
Best regards,
Hakan
--
Hakan Küçükyılmaz, Senior Software Engineer DBTG/MySQL +49 160
98953296
Sun Microsystems GmbH Sonnenallee 1, DE-85551 Kirchheim-Heimstetten
Geschaeftsfuehrer: Thomas Schroeder, Wolfang Engels, Dr. Roland Boemer
Vorsitz d. Aufs.rat.: Martin Haering HRB MUC 161028 49.011, 8.376