Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Export SQL" generates invalid SQL if a view contains "order by desc" #17431

Closed
miklcct opened this issue Mar 8, 2022 · 3 comments
Closed

"Export SQL" generates invalid SQL if a view contains "order by desc" #17431

miklcct opened this issue Mar 8, 2022 · 3 comments
Assignees
Labels
Bug A problem or regression with an existing feature duplicate
Milestone

Comments

@miklcct
Copy link
Contributor

miklcct commented Mar 8, 2022

Describe the bug

"Export SQL" generates invalid SQL if a view contains order by desc.

To Reproduce

Steps to reproduce the behavior:

  1. Run the following DDL:
create table `table` (serial int auto_increment primary key);
create view `view` as select * from `table` order by serial desc;
  1. Export the database as SQL

Expected behaviour

It produces SQL which produces the exact structure above.

Actual behaviour

It produces invalid SQL:

CREATE ALGORITHM=UNDEFINED DEFINER=`michael`@`%` SQL SECURITY DEFINER VIEW `view`  AS SELECT `table`.`serial` AS `serial` FROM `table` ORDER BY `table`.`serial` AS `DESCdesc` ASC  ;

Server configuration

  • Operating system: Ubuntu 21.10
  • Web server: Apache/2.4.51
  • Database version: MariaDB 10.5.12-MariaDB-0+deb11u1 - Debian 11
  • PHP version: 8.1.3
  • phpMyAdmin version: 5.1.3

Client configuration

  • Browser: Firefox 97.0.2
  • Operating system: Ubuntu 21.10
@williamdes williamdes added Bug A problem or regression with an existing feature duplicate labels Mar 8, 2022
@williamdes williamdes self-assigned this Mar 8, 2022
@williamdes williamdes added the waiting on upstream Issues blocked by a third-party label Mar 8, 2022
@williamdes
Copy link
Member

Duplicate of #17321

@williamdes williamdes marked this as a duplicate of #17321 Mar 8, 2022
@williamdes
Copy link
Member

Hi @miklcct
Would you mind trying this fix on your local setup by changing the file in vendor/phpmyadmin/sql-parser: https://github.com/phpmyadmin/sql-parser/pull/371/files#diff-1fc95c4608ac9255e416f3fe0f3be8ea99d11f95351dbda8f00ba2b5419d16e0 ?

You can read more about this issue on #17321

@williamdes
Copy link
Member

The (phpMyAdmin 5.2+snapshot) also available as a non official docker image is updated with the fix 🚀

@williamdes williamdes removed the waiting on upstream Issues blocked by a third-party label Nov 20, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 21, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug A problem or regression with an existing feature duplicate
Projects
None yet
Development

No branches or pull requests

2 participants