Skip to content

Commit

Permalink
fix: force escape cubeAlias to work with restricted column names such…
Browse files Browse the repository at this point in the history
… as "case" (#128)

* force escape cubeAlias to work with restricted column names such as "case"

* Reverted the change and applied the Escape name
for Postgres query only

* Reverted to previous version and
removed the double escaping of cubeAlias
  • Loading branch information
dgkm authored and paveltiunov committed Jun 9, 2019
1 parent b649f13 commit b8a59da
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/cubejs-schema-compiler/adapter/BaseQuery.js
Expand Up @@ -586,7 +586,7 @@ class BaseQuery {
const columnsForSelect =
this.dimensionColumns(this.escapeColumnName('keys')).concat(selectedMeasures).filter(s => !!s).join(', ');
const keyInMeasureSelect = shouldBuildJoinForMeasureSelect ?
`${this.escapeColumnName(this.cubeAlias(keyCubeName))}.${primaryKeyDimension.aliasName()}` :
`${this.cubeAlias(keyCubeName)}.${primaryKeyDimension.aliasName()}` :
this.dimensionSql(primaryKeyDimension);
const subQueryJoins =
shouldBuildJoinForMeasureSelect ? '' : measureSubQueryDimensions.map(d => this.subQueryJoin(d)).join("\n");
Expand Down Expand Up @@ -983,7 +983,7 @@ class BaseQuery {

cubeAlias(cubeName) {
const prefix = this.safeEvaluateSymbolContext().cubeAliasPrefix || this.cubeAliasPrefix;
return this.aliasName(`${prefix ? prefix + '__' : ''}${cubeName}`);
return this.escapeColumnName(this.aliasName(`${prefix ? prefix + '__' : ''}${cubeName}`));
}

collectCubeNamesFor(fn) {
Expand Down

0 comments on commit b8a59da

Please sign in to comment.