myramnath / common-schema

Automatically exported from code.google.com/p/common-schema
0 stars 0 forks source link

_wrap_select_list_columns makes for incorrect query when alias with no "AS" is used #19

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
making this a new issue since this is not an aggregate problem.
Seems to me like a glitch on one character in doing the math:

makes a syntax error

-- --------------------------------

root@mysql-5.1.51> SET @query := 'SELECT db the_database FROM mysql.db';
Query OK, 0 rows affected (0.00 sec)

root@mysql-5.1.51> CALL _wrap_select_list_columns(@query, 3, @error); SELECT 
@query; 
Query OK, 0 rows affected (0.00 sec)

+----------------------------------------------------------------+
| @query                                                         |
+----------------------------------------------------------------+
| SELECT  db t AS col1, NULL as col2, NULL as col3 from mysql.db |
+----------------------------------------------------------------+

Original issue reported on code.google.com by shlomi.n...@gmail.com on 10 Nov 2011 at 6:38

GoogleCodeExporter commented 9 years ago
Fixed in revision 149

Previous + new tests pass on this fix.

Original comment by shlomi.n...@gmail.com on 10 Nov 2011 at 11:02