Skip to content

Conversation

@arnaud-lacurie
Copy link
Collaborator

Updates Identifier.toString() to wrap components with double quotes, making error messages consistent with SQL identifier syntax and improving readability.

Identifier.toString() now wraps each component with double quotes, making error messages more consistent with SQL identifier syntax and improving readability.
@arnaud-lacurie arnaud-lacurie added the enhancement New feature or request label Nov 17, 2025
Comment on lines +64 to +67
.map(q -> "\"" + q + "\"")
.collect(Collectors.joining("."))
+ (qualifier.isEmpty() ? "" : ".")
+ "\"" + name + "\"";
Copy link
Collaborator

Choose a reason for hiding this comment

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

Using double quotes in error messages can lead to problems when integrating with logging frameworks. For example, if the user prints out the error message to a logging system with key-value pairs of quoted keys and values, then the internal quote within the message can end up confusing things. We could get around this by using single quotes (or backticks), though that is different from what the SQL query coming in will do

"CREATE INDEX mv1 AS SELECT X.col2, \"__ROW_VERSION\" FROM T1, (SELECT col2 FROM T1.A) X ORDER BY X.col2, \"__ROW_VERSION\" " +
"WITH OPTIONS(store_row_versions=true)";
shouldFailWith(stmt, ErrorCode.AMBIGUOUS_COLUMN, "Ambiguous reference '__ROW_VERSION'");
shouldFailWith(stmt, ErrorCode.AMBIGUOUS_COLUMN, "Ambiguous reference '\"__ROW_VERSION\"'");
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should we update "Ambiguous reference" to remove the single quotes like was done with "Attempting to query non existing column"?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants