Bug #12344 | statements which work in comand line, don't work with 'source' comand in mysql | ||
---|---|---|---|
Submitted: | 3 Aug 2005 10:35 | Modified: | 29 Aug 2005 10:14 |
Reporter: | Gleb Paharenko | Email Updates: | |
Status: | Duplicate | Impact on me: | |
Category: | MySQL Server | Severity: | S3 (Non-critical) |
Version: | 5.0.10 | OS: | Linux (Linux) |
Assigned to: | CPU Architecture: | Any |
[3 Aug 2005 10:35]
Gleb Paharenko
[3 Aug 2005 10:46]
Valeriy Kravchuk
Please, post the exact definition of your sequences table. What version fo mysql (command line client) do you use? (mysql --version command prints it).
[3 Aug 2005 11:08]
Gleb Paharenko
mysql> show create table sequences\G; *************************** 1. row *************************** Table: sequences Create Table: CREATE TABLE `sequences` ( `name` char(20) NOT NULL, `val` int(10) unsigned default NULL, PRIMARY KEY (`name`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 1 row in set (0.00 sec) [gleb@blend mysql-debug-5.0.10-beta-linux-i686]$ ./bin/mysql --version ./bin/mysql Ver 14.12 Distrib 5.0.10-beta, for pc-linux-gnu (i686) using readline 5.0
[3 Aug 2005 12:15]
Valeriy Kravchuk
I understood the problem. It is not a bug, really. According to the documentation (http://dev.mysql.com/doc/mysql/en/batch-commands.html, http://dev.mysql.com/doc/mysql/en/mysql-commands.html) source command is used to execute SQL statements, and "delimiter" is NOT a SQL statement (it is mysql command), and so should not be included into the .sql file to be "sourced". Simply split your file into 2 (one for drop, and one for create) and execute SQL from each one of them using source command (but set the appropriate delimiter before each source command), or just use your unmodified pr.sql from the command line: $ bin/mysql -u root < pr.sql $ bin/mysql -u root -S /home/openxs/mysql5.sock Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 9 to server version: 5.0.11-beta Type 'help;' or '\h' for help. Type '\c' to clear the buffer. mysql> use test; Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -A Database changed mysql> show function status; +------+---------+----------+----------------+---------------------+------------ ---------+---------------+---------+ | Db | Name | Type | Definer | Modified | Created | Security_type | Comment | +------+---------+----------+----------------+---------------------+------------ ---------+---------------+---------+ | test | nextval | FUNCTION | root@localhost | 2005-08-03 15:07:49 | 2005-08-03 15:07:49 | DEFINER | | +------+---------+----------+----------------+---------------------+------------ ---------+---------------+---------+ 1 row in set (0.00 sec) This is how it works. I can only ask documentation team to add the appropriate explicit note.
[4 Aug 2005 14:18]
Gleb Paharenko
Thank you very much for good explanations. In my opinion some notes in the manual about that we can't use DELIMITER (and other 'mysql' commands) in SQL scripts for 'source' command will prevent users from reporting such silly bugs :)
[29 Aug 2005 10:14]
Sergei Golubchik
Please do not submit the same bug more than once. An existing bug report already describes this very problem. Even if you feel that your issue is somewhat different, the resolution is likely to be the same. Because of this, we hope you add your comments to the original bug instead. Thank you for your interest in MySQL. Additional info: see bug#11523