MTR testcase creation fails for double letter tables

Bug #792138 reported by Roel Van de Paar on 2011-06-03
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Random Query Generator

Bug Description

MTR testcases are created automatically when using RQG w/ transformers. This fails when the table names have double (uppercase?) names. The table definitions and data inserts are simply missing.

For instance, in an MTR testcase which has this query:

( alias2.col_int )
 AS field1 , AS field2
FROM LL AS alias1 JOIN PP AS alias2 ON alias1.col_varchar_10_latin1_key = alias2.col_varchar_10_latin1_key
GROUP BY field2
ORDER BY field1 ;

It does not include the table, nor the data, for LL or PP.

I another example, it was using a one letter table name and dual letter table name ('MM'). The single letter table name defintion (and data) was included (and renamed to "t1"), but the MM table defintion was not.

So, it looks like whatever code is supposed to include table defintions and data, is missing to include table names/data for tables with a table name lenght of 2 (or possibly >=2).

Changed in randgen:
importance: Undecided → High
Philip Stoev (pstoev-askmonty) wrote :

This is due to the regexp on line 58 in lib/GenTest/Simplifier/ . It should be easy for bernt to extend it to cover double-letter tables. Note however that the regexp must make sure that the 2 letters are identical, otherwise it will match other keywords such as "ON"

Bernt M Johnsen (bernt-johnsen) wrote :

A better idea would be just to avoid reserved words as defined in The current solution has too many assumptions on table names and allows only a specific set of unquoted table names.

Roel Van de Paar (roel11) wrote :

Bernt: do you mean a regex which excludes reserved words?

Roel Van de Paar (roel11) wrote :

It would be easy to change the regex to list all combinations of AA-ZZ and AAA-ZZZ, but this would indeed not cover things like views (v<something>/view<something>) which I believe are not included in MTR testcases today either. As such, Bernt's idea may work better in the long run.

Bernt M Johnsen (bernt-johnsen) wrote :

Roel: I mean e.g. a table of all reserved words. But I need to understand the context better before deciding. Remember this is not parsing of SQL, just regexping of SQL.....

Roel Van de Paar (roel11) wrote :

I previously fixed up the regex to match [A-Z]|AA...ZZ|AAA...ZZZ but not things like AB or XYZ.

A more permanent fix would be good though. This may also need further work to include things like views (v_AA etc.)

Changed in randgen:
status: New → Triaged
status: Triaged → In Progress
status: In Progress → New
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers