Skip to content

Commit 7947087

Browse files
mcheshkovKSDaemon
authored andcommitted
fix(ksql-driver): Escape quotes in column names
1 parent 0e2171a commit 7947087

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

packages/cubejs-ksql-driver/src/KsqlQuery.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,9 @@ export class KsqlQuery extends BaseQuery {
5252
}
5353

5454
public escapeColumnName(name: string) {
55-
return `\`${name}\``;
55+
// https://docs.confluent.io/platform/current/ksqldb/reference/sql/lexical-structure.html#ksqldb-lexical-structure-identifiers
56+
// https://github.com/confluentinc/ksql/blob/84afdf1c2504844a15e02643f796288b8b069073/ksqldb-parser/src/main/antlr4/io/confluent/ksql/parser/SqlBase.g4#L378
57+
return `\`${name.replaceAll('`', '``')}\``;
5658
}
5759

5860
public castToString(sql: string) {

0 commit comments

Comments
 (0)