Hello Marc,
Please could you please assign bug https://sourceforge.net/p/phpmyadmin/bugs/4154/ to me. I have possible solution for this as follows:
In file sql.lib.php and in function PMA_handleSortOrder it is appending order by clause. I can do one of the following:
1. change PMA_SQP_analyze function: just like it sets query flags for select, join etc we can have a flag set for union also. Then we can bypass the function call PMA_handleSortOrder if its set. Problem with me regarding this is I am unable to find PMA_SQP_analyze or PMA_SQP_parse functions. could please tell me where they are?
2. In the function PMA_handleSortOrder just parse the query string and see if it contains union in it. This seems to be a redundant idea to me.
What are your view on this?
Thanks,
Lakshit Arora


On Sat, Dec 7, 2013 at 6:39 PM, Marc Delisle <marc@infomarc.info> wrote:
Le 2013-12-07 07:49, Lakshit Arora a écrit :
> Hello all, I am trying to fix the bug
> https://sourceforge.net/p/phpmyadmin/bugs/4154/ . I have few
> observations regarding this: if you do
>
> SELECT * FROM `sortunion1` UNION SELECT * FROM `sortunion2`
>
> what I think is that when you are trying to query the above one it
> transforms it into query as follows
>
>
> |SELECT * FROM `sortunion1` UNION SELECT * FROM `sortunion2`  ORDER
> BY `sortunion2`.`id` DESC LIMIT 0, 25|
>
> but instead if it transforms the same query as
>
> |SELECT * FROM `sortunion1` UNION (SELECT * FROM `sortunion2`  ORDER
> BY `sortunion2`.`id` DESC ) LIMIT 0, 25|
>
> Then there won't be any issue.
>
> Please tell me whether my understanding is correct or not. If
> yes,then I would like to take up the bug, else please suggest if
> there is any mistake in my approach.

Hi Lakshit,
a better solution is to avoid adding the ORDER BY clause, since the user
did not ask for it.

--
Marc Delisle
http://infomarc.info | http://phpmyadmin.net

------------------------------------------------------------------------------
Sponsored by Intel(R) XDK
Develop, test and display web and hybrid apps with a single code base.
Download it for free now!
http://pubads.g.doubleclick.net/gampad/clk?id=111408631&iu=/4140/ostg.clktrk
_______________________________________________
Phpmyadmin-devel mailing list
Phpmyadmin-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/phpmyadmin-devel