Details
-
Bug
-
Status: Closed
-
Minor
-
Resolution: Duplicate
-
1.12.0, 1.12.1
-
None
-
None
Description
SQL Client fails when catalog name or database name are quoted and contains characters that must be escaped, for example pulsar-flink connector uses `tenant/namespace` as database name.
It was introduced with PR Flink 18621. The reason is that sql statements restored from parsed sql operation were not quote even if user actually used it. It can be easily fixed by escaping database name and catalog name before using it. Like these
// code java public class SqlUseCatalog extends SqlCall { @@ -63,6 +65,6 @@ public class SqlUseCatalog extends SqlCall { } public String catalogName() { - return catalogName.getSimple(); + return escapeIdentifier(catalogName.getSimple()); } } @@ -57,7 +59,9 @@ public class SqlUseDatabase extends SqlCall { } public String[] fullDatabaseName() { - return databaseName.names.toArray(new String[0]); + return databaseName.names.stream() + .map(EncodingUtils::escapeIdentifier) + .toArray(String[]::new); }
Attachments
Attachments
Issue Links
- is duplicated by
-
FLINK-20977 USE DATABASE & USE CATALOG fails with quoted identifiers containing characters to be escaped in Flink SQL client
- Closed