Bug #40484 run view or SP in query but cant start
Submitted: 3 Nov 2008 23:05 Modified: 6 Nov 2008 23:38
Reporter: Thomas Lee Email Updates:
Status: Can't repeat Impact on me:
None 
Category:MySQL Query Browser Severity:S2 (Serious)
Version:1.2.14 OS:Windows (XP)
Assigned to: CPU Architecture:Any
Tags: SP not start, VIEW

[3 Nov 2008 23:05] Thomas Lee
Description:
create a test view log3 and a store procedure p1 to select that view.
try to run view or SP in query browser but always got "No database slect" 
message. Even select table scrap but still got same error.

CREATE VIEW `masterroll`.`log3` AS
  SELECT * FROM scrap;

DELIMITER $$
DROP PROCEDURE IF EXISTS `masterroll`.`p1` $$
CREATE PROCEDURE `masterroll`.`p1` ()
BEGIN
    select * from log3;
END $$
DELIMITER ;

SELECT * FROM masterroll.scrap s;   # ok,show result
select * from log3;
call p1();

How to repeat:
DL GUI tool from your site, follow above will shown.
[4 Nov 2008 12:52] Susanne Ebrecht
Many thanks for writing a bug report. Unfortunately, I can't repeat this.

Here is my test script:

DROP DATABASE IF EXISTS bug40484;
CREATE DATABASE bug40484;
USE bug40484;
CREATE TABLE t(id serial, i integer, t text, v varchar(100), n numeric(8,5)); INSERT INTO t(i, t, v, n) VALUES
(1, 'abc', 'def', PI()), 
(2, 'bcd', 'efg', sin(23)),
(3, 'cde','fgh', cos(23)),
(4, 'def','ghi', tan(23)),
(5,'fgh','hij', 22/7);
CREATE VIEW v_t AS SELECT * FROM t;
DELIMITER §
CREATE PROCEDURE p_t()
BEGIN
SELECT * FROM v_t;
END §
DELIMITER ;

Now start MySQL Query Browser with using default schema bug40484. You also can choose another default schema and then just switch schema by clicking on the right database/schema on the right side of the the schema/database you want to use.

After that I tried:
SELECT * FROM t;
SELECT * FROM v_t;
CALL p_t();

All three gave me the same right result.
[4 Nov 2008 18:00] Thomas Lee
I made the view from query browser. Point to table first,right click to create
view,then save as actually as .sql(may UTF-8 type or other) in some folder.
Go file/open that .sql file, will show in query screen, execute select * or call
command will get message "no database select" even I manual use table already.
[4 Nov 2008 23:31] Thomas Lee
Pls see attached file where I follow your example but got error.
[4 Nov 2008 23:45] Thomas Lee
Mysql view 1

Attachment: Docu1-a.doc (application/msword, text), 100.50 KiB.

[4 Nov 2008 23:45] Thomas Lee
Mysql view 2

Attachment: Docu1-b.doc (application/msword, text), 87.00 KiB.

[5 Nov 2008 0:07] Thomas Lee
From the attached file you can see I already created v_t view which select * from scrap table. Now I can see it in query browser. I click the scrap table so 
it is selected then I select * from v_t, still show me "no database select".

At attached file you can can see I cant create procedure.
How can I execute view directly at query browser not through SP?
[5 Nov 2008 17:54] Thomas Lee
I am using Query Browser 1.2.14 in Win XP(2002)
[5 Nov 2008 20:00] Thomas Lee
I suggest you create view from existing table in query browser. Will show you 
what I saw.
[6 Nov 2008 23:38] Thomas Lee
I went to query browser treat view as a table,double click, it showed in query tab then execute, it work. If I typed select * , need put db name.vw4 to make it
work.

But create store procedure p1 from query browser , make it select * from vw4,
execute in browser tab as call p1(); still got "no database selection" error.

If in mysql prompt,I use masterroll;
                     call p1();
  show me procedure masterroll.p1 does not exist,but actually store in p1.sql
  which I can re-open it.

''p1 store procedure
DELIMITER $$

DROP PROCEDURE IF EXISTS `masterroll`.`p1` $$
CREATE PROCEDURE `masterroll`.`p1` ()
BEGIN
  select * from vw4;
END $$

DELIMITER ;