Skip to content
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

Quote table names in JDBC queries #19192

Closed
wants to merge 1 commit into from
Closed

Conversation

alexmojaki
Copy link

In MySQL table names sometimes need to be quoted. This should fix that, although I haven't tested (I really don't want to go through the build and everything).

Also, four quotes in a row is not readable.

In MySQL table names sometimes need to be quoted. This should fix that, although I haven't tested.

Also, four quotes in a row is not readable.
@gatorsmile
Copy link
Member

Without this PR change, can users add quotes in the JDBC option dbtable?

@@ -100,7 +100,7 @@ abstract class JdbcDialect extends Serializable {
* @return The SQL query to use for checking the table.
*/
def getTableExistsQuery(table: String): String = {
s"SELECT * FROM $table WHERE 1=0"
s"SELECT * FROM ${quoteIdentifier(table)} WHERE 1=0"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a behavior change. After we quote the names, the table names become case sensitive in most RDBMS. We need at least a JDBC option to control it.

@AmplabJenkins
Copy link

Can one of the admins verify this patch?

@alexmojaki alexmojaki closed this Jan 18, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants