cube-js/cube · error · UserError

Oracle can not work with table names that longer than 64 sym

Error message

Oracle can not work with table names that longer than 64 symbols. Consider using the 'sqlAlias' attribute in your cube and in your pre-aggregation definition for ${name}.

What it means

Oracle pre-aggregation table name length check. Oracle identifiers are limited to 128 bytes; when the generated pre-aggregation name exceeds that, OracleQuery throws a UserError advising 'sqlAlias'. (The message text still says 64 — a stale copy from the MySQL variant — but the enforced limit is 128.)

Source

Thrown at packages/cubejs-schema-compiler/src/adapter/OracleQuery.ts:299

    // length, so use the max standard VARCHAR2 size.
    templates.types.string = 'VARCHAR2(4000)';

    return templates;
  }

  public newFilter(filter) {
    return new OracleFilter(this, filter);
  }

  public unixTimestampSql() {
    // eslint-disable-next-line quotes
    return `((cast (systimestamp at time zone 'UTC' as date) - date '1970-01-01') * 86400)`;
  }

  public preAggregationTableName(cube, preAggregationName, skipSchema) {
    const name = super.preAggregationTableName(cube, preAggregationName, skipSchema);
    if (name.length > 128) {
      throw new UserError(`Oracle can not work with table names that longer than 64 symbols. Consider using the 'sqlAlias' attribute in your cube and in your pre-aggregation definition for ${name}.`);
    }
    return name;
  }
}

View on GitHub (pinned to 7d981676b3)

Solutions

  1. Add sqlAlias to the pre-aggregation definition to force a short table name.
  2. Shorten cube and preAggregationName values in the data model.
  3. Rename the source tables/cubes to compact names.
  4. Ignore the '64' wording in the message; the actual enforced limit here is 128 characters.

Example fix

// before
preAggregations: { main_by_organization_region_and_calendar_week: {...} }
// after
preAggregations: { main_by_organization_region_and_calendar_week: { sqlAlias: 'org_region_week', ... } }
Defensive patterns

Strategy: validation

Validate before calling

const expectedName = `${cubeName.toLowerCase()}_${preAggName.toLowerCase()}_main`;
if (expectedName.length > 128) {
  throw new Error(`Add sqlAlias: Oracle pre-agg table name would be ${expectedName.length} chars (max 128)`);
}

Try / catch

try { await compilerApi.preAggregationsSchema(); } catch (e) { if (/Oracle can not work with table names/.test(e.message)) {
  console.error(`Add sqlAlias to shorten: ${e.message}`); } throw e; }

Prevention

When it happens

Trigger: preAggregationTableName called with cube + preAggregationName + suffix whose combined length exceeds 128 characters on an Oracle datasource.

Common situations: Very long cube names from enterprise schemas; rollup-join generated names that concatenate multiple cube names; moving pre-aggregations from short-named dev cubes to production Oracle schemas.

Related errors


AI-assisted analysis of cube-js/cube@7d981676b3 (2026-09-02). Data as JSON: /api/errors/342a254a14c2f8e3. Report an issue: GitHub.