Bug #45103 source, \. give inconsistent results in mysql client
Submitted: 26 May 2009 18:52 Modified: 28 May 2009 22:11
Reporter: Peter Brawley (Basic Quality Contributor) Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Command-line Clients Severity:S3 (Non-critical)
Version:5.1.34, 6.0.11 OS:Windows (XPsp2,W2Ksp4)
Assigned to: CPU Architecture:Any
Tags: qc

[26 May 2009 18:52] Peter Brawley
Description:
According to the manual, the commands source filename and \. filename are equivalen, but given a file init.sql in c:\bin, the mysql client command ...

source c:/bin/init.sql;

finds and executes it, yet ...

\. c:/bin/init.sql;

fails with "Failed to open file c:\bat\init.sql;

How to repeat:
As above
[28 May 2009 18:19] MySQL Verification Team
Thank you for the bug report. I couldn't repeat this issue:

c:\dbs>5.1\bin\mysql -uroot --port=3510 test
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 5
Server version: 5.1.36-Win X64-log Source distribution

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> source c:/dbs/5.1/bin/init.sql
Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.14 sec)

mysql> \. c:/dbs/5.1/bin/init.sql
Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.12 sec)

mysql> exit
Bye

c:\dbs>mv c:\dbs\5.1\bin\init.sql c:\dbs

c:\dbs>5.1\bin\mysql -uroot --port=3510 test
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 6
Server version: 5.1.36-Win X64-log Source distribution

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> \. c:/dbs/init.sql
Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.14 sec)

mysql> source c:/dbs/init.sql
Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.15 sec)

mysql> exit
Bye

c:\dbs>type init.sql
drop table if exists t1;
create table t1 (id int);

c:\dbs>

c:\dbs>mkdir c:\bin

c:\dbs>mv c:\dbs\init.sql c:\bin

c:\dbs>5.1\bin\mysql -uroot --port=3510 test
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 7
Server version: 5.1.36-Win X64-log Source distribution

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> source c:/bin/init.sql
Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.14 sec)

mysql> \. c:/bin/init.sql
Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.15 sec)

mysql>
[28 May 2009 19:09] Peter Brawley
-- /bat/init.sql contains:
-- SET sql_quote_show_create=0;
-- SET GLOBAL log_bin_trust_function_creators=1;

localhost.(none)
\. /bat/init.sql;
ERROR: Failed to open file '\bat\init.sql;', error: 2
localhost.(none)>
source /bat/init.sql;
Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

-- replicated with 6.0.11 on WinXPsp2, with 5.1.34 on Win2Ksp4
[28 May 2009 20:01] MySQL Verification Team
Peter, remove the ; from the end of the second version ...
[28 May 2009 20:19] Peter Brawley
source accepts a terminating semicolon.

.\ does not.

Should be corrected, or the documentation should be corrected.
[28 May 2009 22:11] MySQL Verification Team
Thank you for the feedback.

c:\dbs>5.1\bin\mysql -uroot --port=3510 test
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 5.1.36-Win X64-log Source distribution

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> source c:/bin/init.sql;
Query OK, 0 rows affected (0.07 sec)

Query OK, 0 rows affected (0.10 sec)

mysql> \. c:/bin/init.sql;
ERROR:
Failed to open file 'c:\bin\init.sql;', error: 2
mysql>