← Back to team overview

randgen team mailing list archive

[Bug 791783] Re: MTR testcase creation fails for MIN()/MAX() functions

 

I find pretty-printing useful for two reasons:

1) Easier to read and understand the actual query (no need to have a
100" monitor to see the entire query). However, the current pretty
printing is far from perfect in that regard, so I often tend to prettify
the SQL more or less manually when I need to (for myself or for
developers), anyway.

2) Further automatic simplification of MTR test cases. The RQG test
simplifier works on a line-by-line basis, right? So if the query is
split into multiple lines, it can more easily simplify the actual query.
This seems especially useful when the initial automatic simplification
fails for some reason, where you still may get a test case with the
original query pretty-printed, which you can massage slightly and then
initiate further simplification using simplify-mysqltest.pl.

Will removing the pretty-print regexp lead to a reduced ability to
automatically simplify queries in Transformer / ResultsetComparator
context?

If not, I guess removing it is fine. Otherwise, the regexp should take
care so that function calls are not split (no whitespace between
function name and opening parenthesis).

-- 
You received this bug notification because you are a member of Random
Query Generator Team, which is subscribed to Random Query Generator.
https://bugs.launchpad.net/bugs/791783

Title:
  MTR testcase creation fails for MIN()/MAX() functions

Status in SQL Generator for testing SQL servers (MySQL, JavaDB, PostgreSQL):
  New

Bug description:
  MTR testcases containing the following code (using standard optimizer
  grammars) are created:

  SELECT
  (
  SELECT MIN
  ( SUBQUERY1_t1.col_int_key )
  FROM t3 AS SUBQUERY1_t1 STRAIGHT_JOIN
  ( t2 AS SUBQUERY1_t2 JOIN t1 AS SUBQUERY1_t3 ON SUBQUERY1_t3.col_int_key = SUBQUERY1_t2.pk )
  ON SUBQUERY1_t3.col_varchar_key = SUBQUERY1_t2.col_varchar_key
  WHERE SUBQUERY1_t2.col_varchar_key <> table1.col_varchar_nokey )
  FROM t1 AS table1
  RIGHT JOIN
  (
  SELECT *
  FROM t3 )
  AS table2 JOIN t1 AS table3 ON table3.col_varchar_key = table2.col_varchar_key ON table3.col_varchar_nokey = table2.col_varchar_key 

  This fails with:

  1630: FUNCTION test.MIN does not exist. Check the 'Function Name
  Parsing and Resolution' section in the Reference Manual

  Changing this:

  SELECT MIN
  ( SUBQUERY1_t1.col_int_key )

  to:

  SELECT MIN(SUBQUERY1_t1.col_int_key)

  Resolves the issue.


References