(Parser) support UNION #4962
(Parser) support UNION #4962
Comments
- labels: —> Parsing - Original author: garvinhicking |
|
Planned for GSoC 2015. See http://wiki.phpmyadmin.net/pma/GSoC_2015_Ideas_List#Parser.2Fanalyzer_rewrite.2Freplacement
|
|
|
Where exactly do we need this? I mean after correctly splitting the select statements, where do we use/show it?
|
Originally, this was for code highlighting. I just made a quick test and don't see a problem when browsing and sorting on a column coming from an UNION. I guess you could not find anything either?
|
Found a problem which looks like a parser problem. Using the attached file, try
|
This does not look like a parser problem. I've created a separate ticket at https://sourceforge.net/p/phpmyadmin/bugs/4807/
|
I accept your fix, but it could be a parser problem because the table name has not been determined.
|
Fixed in phpmyadmin/sql-parser@6e33561. It will be soon in the master branch too. Tested with select supplier.city, supplier.id from supplier union select customer.city, customer.id from customer |
Don't know if the same error is the culprit, but if I do a complex UNION query, phpmyadmin 4.5.4.1deb2ubuntu2 (latest stable of 16.04 LTS) insertes a "limit 0,100" right after the UNION keyword This original query: results in 86 rows if executed directly in Mysql or in php, but in phpmyadmin I first get this error: 2 errors were found during analysis. Unrecognized keyword. (near "REGEXP" at position 276) (select DivId, ClId, TfId, TfName, TfDefault, TfRegExp, TfClasses, DivViewOrder, ClViewOrder from Divisions inner join Classes on DivTournament=ClTournament and DivAthlete=ClAthlete inner join TargetFaces Tf on DivTournament=TfTournament and concat(trim(DivId),trim(ClId)) REGEXP TfRegExp WHERE DivTournament=654 AND DivAthlete='1' AND (ClDivisionsAllowed='' or find_in_set(DivId, ClDivisionsAllowed))) LIMIT 0, 100 UNION ( MySQL said: Documentation #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'UNION Please note theat PhpMyadmin added the "LIMIT 0,100" string BEFORE the Union clause. `SQL query: Documentation (select DivId, ClId, TfId, TfName, TfDefault, TfRegExp, TfClasses, DivViewOrder, ClViewOrder #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'UNION |
Might be same problem, there is also another bug this query exposes in our SQL parser: phpmyadmin/sql-parser#116 |
Support UNION statements in the parser and correctly
split table references and select expressions.
- Original URL: https://sourceforge.net/p/phpmyadmin/feature-requests/262/
- Original author: lem9
The text was updated successfully, but these errors were encountered: