diff --git a/lib/MySQL_Protocol.cpp b/lib/MySQL_Protocol.cpp index 849d09624..a93df5905 100644 --- a/lib/MySQL_Protocol.cpp +++ b/lib/MySQL_Protocol.cpp @@ -2314,7 +2314,7 @@ bool MySQL_Protocol::generate_COM_QUERY_from_COM_FIELD_LIST(PtrSize_t *pkt) { (*myds)->com_field_wild=strdup(wild); } - char *qt = (char *)"SELECT * FROM %s WHERE 1=0"; + char *qt = (char *)"SELECT * FROM `%s` WHERE 1=0"; q = (char *)malloc(strlen(qt)+strlen(tablename)); sprintf(q,qt,tablename); l_free(pkt->size, pkt->ptr); diff --git a/lib/MySQL_Session.cpp b/lib/MySQL_Session.cpp index 6a26cb970..70701d9af 100644 --- a/lib/MySQL_Session.cpp +++ b/lib/MySQL_Session.cpp @@ -4894,7 +4894,7 @@ bool MySQL_Session::handler___status_WAITING_CLIENT_DATA___STATE_SLEEP___MYSQL_C proxy_debug(PROXY_DEBUG_MYSQL_QUERY_PROCESSOR, 5, "Parsing SET command = %s\n", nqn.c_str()); } #endif - if (index(dig,';')) { + if (index(dig,';') && (index(dig,';') != dig + strlen(dig)-1)) { string nqn = string((char *)CurrentQuery.QueryPointer,CurrentQuery.QueryLength); proxy_warning("Unable to parse multi-statements command with SET statement: setting lock hostgroup . Command: %s\n", nqn.c_str()); *lock_hostgroup = true; @@ -5766,11 +5766,13 @@ void MySQL_Session::handler___client_DSS_QUERY_SENT___server_DSS_NOT_INITIALIZED if (session_fast_forward == false) { if (qpo->min_gtid) { gtid_uuid = qpo->min_gtid; + with_gtid = true; } else if (qpo->gtid_from_hostgroup >= 0) { _gtid_from_backend = find_backend(qpo->gtid_from_hostgroup); if (_gtid_from_backend) { if (_gtid_from_backend->gtid_uuid[0]) { gtid_uuid = _gtid_from_backend->gtid_uuid; + with_gtid = true; } } } diff --git a/lib/mysql_connection.cpp b/lib/mysql_connection.cpp index e8ed452f0..fd0e956c7 100644 --- a/lib/mysql_connection.cpp +++ b/lib/mysql_connection.cpp @@ -80,7 +80,10 @@ void Variable::fill_client_internal_session(json &j, int idx) { } else if (idx == SQL_CHARACTER_SET_CONNECTION) { const MARIADB_CHARSET_INFO *ci = NULL; - ci = proxysql_find_charset_nr(atoi(value)); + if (!value) + ci = proxysql_find_charset_collate(mysql_tracked_variables[idx].default_value); + else + ci = proxysql_find_charset_nr(atoi(value)); j["conn"][mysql_tracked_variables[idx].internal_variable_name] = (ci && ci->csname)?ci->csname:""; } else if (idx == SQL_COLLATION_CONNECTION) { const MARIADB_CHARSET_INFO *ci = NULL;