You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What version of JDBC driver are you using?
latest from git
What operating system and processor architecture are you using?
Fedora 40, amd64
What version of Java are you using?
OpenJDK 64-Bit Server VM (Red_Hat-21.0.4.0.7-2) (build 21.0.4+7, mixed mode, sharing)
What did you do?
Propertiesproperties = newProperties();
properties.put("db", "DEV");
properties.put("schema", "\\\\_ESCAPED\\\\_UNDERSCORE");
properties.put("CLIENT_METADATA_REQUEST_USE_CONNECTION_CTX", "TRUE");
...
connection.getMetaData().getSchemas(); // Returns a line for the precise schemaconnection.getMetaData().getTables(null, null, null, null); // Query fails
Snowflake Query Monitor reveals the following queries being executed:
show /* JDBC:DatabaseMetaData.getSchemas() */ schemas like'ESCAPED\\_UNDERSCORE'in database "DEV";
show /* JDBC:DatabaseMetaData.getTables() */ objects in schema "DEV"."ESCAPED\_UNDERSCORE";
What did you expect to see?
The first SQL statement is expected and correct. Two backslashes are required for the sequence to be interpreted as an escaping of the underscore character.
The second SQL statement is unexpected. Now that that metadata call results not in a LIKE operation but in a statement expecting a valid schema name, both backslash characters should have been 'unescaped'.
The problem can be traced back to SnowflakeDatabaseMetaData::unescapeChars(...).
The function is only removing one of the two backslahes.
Fix
I had success with switching the order of statements as follows:
What version of JDBC driver are you using?
latest from git
What operating system and processor architecture are you using?
Fedora 40, amd64
What version of Java are you using?
OpenJDK 64-Bit Server VM (Red_Hat-21.0.4.0.7-2) (build 21.0.4+7, mixed mode, sharing)
What did you do?
Snowflake Query Monitor reveals the following queries being executed:
What did you expect to see?
The first SQL statement is expected and correct. Two backslashes are required for the sequence to be interpreted as an escaping of the underscore character.
The second SQL statement is unexpected. Now that that metadata call results not in a
LIKE
operation but in a statement expecting a valid schema name, both backslash characters should have been 'unescaped'.The problem can be traced back to
SnowflakeDatabaseMetaData::unescapeChars(...)
.The function is only removing one of the two backslahes.
Fix
I had success with switching the order of statements as follows:
However, I might be missing other edge cases now.
The text was updated successfully, but these errors were encountered: