[MDEV-3898] mysql client: lost delimiter Created: 2012-11-30 Updated: 2012-12-10 Resolved: 2012-12-10 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Trivial |
| Reporter: | Federico Razzoli | Assignee: | Elena Stepanova |
| Resolution: | Not a Bug | Votes: | 0 |
| Labels: | None | ||
| Environment: |
Only tested on Windows XP |
||
| Description |
|
mysql client: when the statement delimiter is in the same line of the new DELIMITER command, the delimiter is lost.
At this point... no delimiter seems to be recognized:
|
| Comments |
| Comment by Elena Stepanova [ 2012-11-30 ] | ||||||||||
|
Hi Federico, Apparently, there is a reason why MySQL client says in its help: "Note that all text commands must be first on line and end with ';'" This statement is not quite accurate, obviously it should be not ';' but a delimiter, and besides if the command is first on line, the delimiter is optional. The behavior you observe is more or less generic for MySQL client commands, it's just the specifics of delimiter that makes it so confusing. Please consider the following simpler example first: MariaDB [(none)]> select 1; help contents
---
--- -> ; MariaDB [(none)]> As you can see, the 'help' command, when it's not first on the line, is not executed until you enter the delimiter. Same thing would have happened with your example, if you had entered the old delimiter after the 'delimiter ;' command: MariaDB [(none)]> delimiter ||
MariaDB [(none)]> select 1;
-> || delimiter ;
---
---
--- -> || But instead of the old delimiter, you entered "select 1 ||". That's where the whole thing went pear-shaped. According to the documentation, a delimiter, when provided unquoted, should be read up to the first space or the end of line. But then again, it relates to the normal case, when the command is first in line, right? Here, instead, the end of line is ignored on whatever reason, and your delimiter is read further, till the first space. So, you end up with delimiter = ';select'. If you had tried to use it further, it would have worked: MariaDB [(none)]> delimiter ||
---
--- -> select 1 ||
---
--- And of course, after that you could have changed the delimiter in the usual way. While the situation you ended up in is confusing (since you don't know what your delimiter is), it's not nearly as hopeless as it seems. You could always end the vicious cycle using \c or \g command, it would have return you to the pristine prompt: MariaDB [(none)]> delimiter ||
---
--- -> select 1 || And here you could have changed the delimiter in the usual fashion. Hope it helps. |