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

Exporting a view structure based on another view with a sub-query throws no database selected error #13788

Closed
zubairsuri opened this issue Oct 30, 2017 · 6 comments
Assignees
Labels
Bug A problem or regression with an existing feature has-pr An issue that has a pull request pending that may fix this issue. The pull request may be incomplete
Milestone

Comments

@zubairsuri
Copy link

Steps to reproduce

create table t1(id integer);

create view v1 as 
  select t1.id
  from   t1 join (select 1 as id) t2
              on t1.id = t2.id;

create view v2 as select * from v1;
  1. Try to export structure of view v2.

Expected behaviour

It should export the structure of view v2.

Actual behaviour

-- Structure for view `v2`
--
-- Error reading structure for table ds2.v2: #1046 - No database selected
COMMIT;

Server configuration

Operating system:
Linux 3.10.0-693.2.2.el7.x86_64 #1 SMP Tue Sep 12 22:26:13 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
Web server:
Apache/2.4.6
Database:
mysql Ver 14.14 Distrib 5.7.19, for Linux (x86_64) using EditLine wrapper
PHP version:
PHP 5.6.31 (cli) (built: Jul 7 2017 08:13:42)
phpMyAdmin version:
4.7.4

Client configuration

Browser:
Chrome 61.0.3163.100 (Official Build) (64-bit)
Operating system:
Windows 7

@nijel nijel added the Bug A problem or regression with an existing feature label Nov 1, 2017
@AdamJachocki
Copy link

Same problem here. Please fix it, because it's really annoying. I am working on 3 different machines. And use GIT and I have to export database manualy every time I change it.

@martinsiemens
Copy link

Same problem here. Pls. fix!!!!

@williamdes
Copy link
Member

@martinsiemens @AdamJachocki I am working on this issue today :)

Notes

Query does not work on MariaDB 10.1.26 but works on MariaDB 10.2.16

@williamdes williamdes self-assigned this Dec 20, 2018
@williamdes
Copy link
Member

williamdes commented Dec 20, 2018

Adding a

USE `dbnamehere`;

before

SHOW CREATE TABLE `mydatabase`.`v2`
-- SHOW CREATE VIEW `mydatabase`.`v2` also works

solves the issue (libraries/classes/Plugins/Export/ExportSql.phpL1486)

@williamdes williamdes added the has-pr An issue that has a pull request pending that may fix this issue. The pull request may be incomplete label Dec 20, 2018
williamdes added a commit to williamdes/phpmyadmintest that referenced this issue Dec 20, 2018
Signed-off-by: William Desportes <williamdes@wdes.fr>
@williamdes williamdes added this to the 4.8.4.1 milestone Dec 20, 2018
@ibennetch
Copy link
Member

@williamdes I think it's better to not add a milestone until the pull request is merged.

williamdes added a commit to williamdes/phpmyadmintest that referenced this issue Dec 21, 2018
Signed-off-by: William Desportes <williamdes@wdes.fr>
@williamdes
Copy link
Member

@ibennetch Okay :)

@williamdes williamdes modified the milestones: 4.8.4.1, 4.8.5 Dec 21, 2018
williamdes added a commit that referenced this issue Dec 21, 2018
Fix #13788 - Exporting a view structure, no database selected error

Signed-off-by: William Desportes <williamdes@wdes.fr>
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 22, 2020
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 has-pr An issue that has a pull request pending that may fix this issue. The pull request may be incomplete
Projects
None yet
Development

No branches or pull requests

6 participants