-
Notifications
You must be signed in to change notification settings - Fork 976
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
proxysql 2.0.1 jdbc mariadb sql_mode rewrite results in invalid sql query #1886
Comments
@benconnito Please any update on this issue |
We seem to see this in 2.0.2 too 2019-03-19 14:24:59 MySQL_Session.cpp:3278:handler(): [WARNING] Error during query on (10,192.168.1.45,7033): 1064, You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'cat(@@sql_mode,',strict_trans_tables')' at line 1 |
To reproduce the problem, you can use this java tester: import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Properties;
import org.mariadb.jdbc.Driver;
public class ProxySQLTester {
public static void main(String[] args) throws Exception {
Driver driver = new Driver();
Properties props = new Properties();
ResultSet rs;
String variable_value;
Connection conn = null;
String JDBC_URL = "jdbc:mysql://address=(protocol=tcp)(host=192.168.1.100)(port=3306)";
props.put("useSSL", "false");
props.put("usePipelineAuth", "false");
props.put("user", "root");
props.put("password", "root");
System.out.println("\n------------ MariaDB Connector/J and ProxySQL Testing ------------\n");
System.out.println("Trying connection...");
try {
conn = driver.connect(JDBC_URL, props);
}
catch (SQLException e) {
System.out.println("Connection Failed!");
System.out.println("Error cause: "+e.getCause());
System.out.println("Error message: "+e.getMessage());
return;
}
System.out.println("Connection established...");
for(int i=1; i <= 50; i++) {
System.out.println("\nQuery "+i+": ");
// Read write query that can be performed ONLY on master server
System.out.println("Read Write query...");
try {
rs = conn.createStatement().executeQuery("select (select variable_value from information_schema.global_variables where variable_name=\'hostname\') || \' on port \' || (select variable_value from information_schema.global_variables where variable_name=\'port\') variable_value for update");
while (rs.next()) {
variable_value = rs.getString("variable_value");
System.out.println("variable_value : " + variable_value);
}
}
catch (SQLException e) {
System.out.println("Read/write query has failed...");
}
// Read Only statement (that can also be done on master server if all slaves are down)
System.out.println("Read Only query...");
try {
rs = conn.createStatement().executeQuery("select (select variable_value from information_schema.global_variables where variable_name=\'hostname\') || \' on port \' || (select variable_value from information_schema.global_variables where variable_name=\'port\') variable_value");
while (rs.next()) {
variable_value = rs.getString("variable_value");
System.out.println("variable_value : " + variable_value);
}
}
catch (SQLException e) {
System.out.println("Read only query has failed...");
}
Thread.sleep(1000);
}
conn.close();
}
} $ javac -cp ".:mariadb-java-client-2.4.1.jar" ProxySQLTester.java
$ java -cp ".:mariadb-java-client-2.4.1.jar" ProxySQLTester
------------ MariaDB Connector/J and ProxySQL Testing ------------
Trying connection...
Connection Failed!
Error cause: java.sql.SQLException: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'cat(@@sql_mode,',strict_trans_tables')' at line 1
Error message: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'cat(@@sql_mode,',strict_trans_tables')' at line 1 This has been tested with: ProxySQL 2.0.2 UPDATE: |
UPDATE 2: Setting |
hey @renecannao SHOW VARIABLES WHERE Variable_name in ('max_allowed_packet','system_time_zone','time_zone','auto_increment_increment'); Could you implement that answer in the ProxySQL Admin ? |
@woopstar : thank you for the reproducible test case. Unfortunately I haven't try it yet. |
hey @renecannao |
Fixed in 2.0.4 . |
Parse set autocommit if used with other variables #1886
We are using proxysql 2.0.8 and get the same error using Connector/J 2.4.3 |
when connecting to proxysql 2.0.1 via jdbc mariadb 2.3.0 connector i am getting
ubuntu 16.04
proxysql 2.0.1
previously in
2.0.0-rc2
the query would look likenow in
2.0.1
our server logsnote that
concat
is nowc1 cat
The text was updated successfully, but these errors were encountered: