cube-js/cube · error · Error

Oracle can not work with table names longer than 128 symbols

Error message

Oracle can not work with table names longer than 128 symbols. Consider using the 'sqlAlias' attribute in your cube definition for ${quotedTableName}.

What it means

Oracle restricts most identifiers to 128 bytes. OracleDriver.createTable validates the quoted table name length before delegating, and throws with guidance to use the cube's `sqlAlias` attribute when the generated rollup table name is too long.

Source

Thrown at packages/cubejs-oracle-driver/driver/OracleDriver.js:187

   * @protected
   */
  async withConnection(fn) {
    const connection = await this.pool.acquire();

    try {
      return await fn(connection);
    } finally {
      await this.pool.release(connection);
    }
  }

  async testConnection() {
    await this.query('SELECT 1 FROM DUAL', {});
  }

  async createTable(quotedTableName, columns) {
    if (quotedTableName.length > 128) {
      throw new Error('Oracle can not work with table names longer than 128 symbols. ' +
        `Consider using the 'sqlAlias' attribute in your cube definition for ${quotedTableName}.`);
    }

    return super.createTable(quotedTableName, columns);
  }

  static normalizeParams(query, values) {
    if (!values || values.length === 0) {
      return { sql: query, binds: {} };
    }

    const binds = {};
    const valueToName = new Map();
    let idx = 0;
    let nextName = 0;

    // `:"?"` must be matched as a whole before a lone `?`, so it appears first
    // in the alternation; since it starts with `:`, its inner `?` is consumed

View on GitHub (pinned to 7d981676b3)

Solutions

  1. Add `sqlAlias: 'short_name'` to the cube definition to control the generated table name.
  2. Shorten the cube or pre-aggregation name in the data model.
  3. Shorten the target schema or prefix used for rollup tables.

Example fix

// before
cube('EnterpriseFinancialReportingConsolidatedQuarterlyActualsCube', { /* ... */ });
// after
cube('EnterpriseFinancialReportingConsolidatedQuarterlyActualsCube', {
  sqlAlias: 'fin_qtr',
  /* ... */
});
Defensive patterns

Strategy: validation

Validate before calling

if (quotedTableName.length > 128) {
  throw new Error(`Table name exceeds Oracle's 128-char limit: ${quotedTableName}. Add sqlAlias to the cube.`);
}

Try / catch

try {
  await driver.createTable(name, columns);
} catch (e) {
  if (e.message.includes('longer than 128')) {
    console.error('Add sqlAlias to the cube definition');
  }
  throw e;
}

Prevention

When it happens

Trigger: Uploading a pre-aggregation table through `createTable` where the generated quoted table name exceeds 128 characters.

Common situations: Very long cube or pre-aggregation names, multi-tenant prefixes, or long schema-qualified names pushing the identifier over Oracle's limit.

Related errors


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