Skip to content

Commit 514931d

Browse files
author
Samar Pratap Singh
committed
Bug#30875669 CORE CLIENT CANNOT SEND QUERY WITH NUMBER SIGN OR DOUBLE
DASH IN HINT COMMENT Problem: Server do not allow using '#' and '-- ' inside hint comment if preserve comments is turned off. Fix: Allow using '#' and '-- ' inside hint comment irrespective of preserve comments status because that is what is documented. Change-Id: I976f98e2954d9bc7f007b4acd6627726416b72ba
1 parent 36c0111 commit 514931d

File tree

3 files changed

+17
-1
lines changed

3 files changed

+17
-1
lines changed

client/mysql.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2872,7 +2872,7 @@ static bool add_line(String &buffer, char *line, size_t line_length,
28722872
return true;
28732873
}
28742874
buffer.length(0);
2875-
} else if (!*ml_comment &&
2875+
} else if (!*ml_comment && ss_comment != SSC_HINT &&
28762876
(!*in_string &&
28772877
(inchar == '#' ||
28782878
(inchar == '-' && pos[1] == '-' &&

mysql-test/r/bug30875669.result

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Bug#30875669 CORE CLIENT CANNOT SEND QUERY WITH NUMBER SIGN OR DOUBLE DASH IN HINT COMMENT
2+
CREATE USER myuser;
3+
id select_type table partitions type possible_keys key key_len ref rows filtered Extra
4+
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used
5+
id select_type table partitions type possible_keys key key_len ref rows filtered Extra
6+
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL NULL No tables used
7+
DROP USER myuser;

mysql-test/t/bug30875669.test

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
--echo # Bug#30875669 CORE CLIENT CANNOT SEND QUERY WITH NUMBER SIGN OR DOUBLE DASH IN HINT COMMENT
2+
3+
CREATE USER myuser;
4+
5+
--exec $MYSQL --user=myuser --skip-comments -e "explain select /*+ QB_NAME(`select#1`) */ 1;"
6+
7+
--exec $MYSQL --user=myuser --skip-comments -e "explain select /*+ QB_NAME(`select-- `) */ 1;"
8+
9+
DROP USER myuser;

0 commit comments

Comments
 (0)