Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: ER_TOO_LONG_IDENT: Identifier name is too long: table name substituted twice #1564

Closed
benswinburne opened this issue Dec 10, 2020 · 6 comments
Labels
bug Something isn't working driver:mysql Issues relating to the MySQL/MariaDB driver

Comments

@benswinburne
Copy link

benswinburne commented Dec 10, 2020

Describe the bug

I am aware that this has been discussed and "fixed" with sqlAlias in the below listed issue and PR but I managed to go over the maximum a couple of times today.

By adding

Error: ER_TOO_LONG_IDENT: Identifier name 'dwell_dwell_averages20201201_lsh1ftzo_xmgdsxnu_1ft2cgq_lsh1ftzo_xmgdsxnu_1ft2cgq' is too long

"dwell_dwell_averages20201201_lsh1ftzo_xmgdsxnu_1ft2cgq_lsh1ftzo_xmgdsxnu_1ft2cgq".length // 80

By using sqlAlias on both the cube and the pre-aggregation I managed to get it to 64

"dw_d20201201_lsh1ftzo_xmgdsxnu_1ft2cgq_lsh1ftzo_xmgdsxnu_1ft2cgq".length // 64

But the name and alias is meaningless now really and 60 of the characters are useless. Is is possible that some sort of hash is used instead to still get a consistent name for the table but use fewer characters?

To Reproduce
Steps to reproduce the behavior:

  preAggregations: {
    averages: {
      type: `rollup`,
      indexes: {
        creativeId: {
          columns: [creativeId],
        },
      },
      measureReferences: [count, totalDwellTimeInSeconds],
      timeDimensionReference: dt,
      dimensionReferences: [creativeId],
      granularity: `day`,
      refreshKey: {
        every: `30 minutes`,
      },
      external: true,
      scheduledRefresh: true,

      // This increases the length of the table name considerably, and when
      // starting up it says Performing query: undefined so i can't help but
      // think that it is broken or misconfigured in some way.
      // partitionGranularity: `month`,
      // refreshRangeStart: {
      //   sql: `SELECT current_timestamp - interval '30' day`,
      // },
      // refreshRangeEnd: {
      //   sql: `SELECT current_timestamp`,
      // },
    },
  },

Expected behavior
A reasonable length table name such that it doesn't break the upper limits of MySQL/postgres so easily.

Version:

  "dependencies": {
    "@cubejs-backend/athena-driver": "^0.24.5",
    "@cubejs-backend/mysql-driver": "^0.24.4",
    "@cubejs-backend/server": "^0.24.4"
  },

Additional context
Add any other context about the problem here.

#1068
#86

@paveltiunov paveltiunov added the bug Something isn't working label Dec 10, 2020
@ovr
Copy link
Member

ovr commented Dec 10, 2020

Hello @benswinburne,

I understand your pain with limitations from MySQL/PostgreSQL.

Table name for pre-aggregations are done automatically and It contains:

`${table_name}_${content_version}_${versionEntry}_${last_updated_at}`

Where:

  • content_version/versionEntry - are strings that encoded by hash function
  • last_updated_at - is a timestamp that was encoded as Base32

It's not possible to use hash for ${content_version}_${versionEntry}_${last_updated_at} to shorten it because Cube.js parse table names while it is works with pre-aggregations.

At first look, I don't have any ideas about how to shorten table names for pre-aggregations.

@ovr ovr added question The issue is a question. Please use Stack Overflow for questions. and removed bug Something isn't working question The issue is a question. Please use Stack Overflow for questions. labels Dec 10, 2020
@benswinburne
Copy link
Author

benswinburne commented Dec 10, 2020 via email

@ovr ovr added the question The issue is a question. Please use Stack Overflow for questions. label Dec 10, 2020
@ovr
Copy link
Member

ovr commented Dec 10, 2020

Yes, It can be a solution to use "meta storage" and put information about pre-aggregation inside it and use table names without meta information, but for now there are no plans to work on it.

I think Cube Store will resolve this limitation and it will be default/recommended database for pre-aggregations.

@paveltiunov paveltiunov changed the title Error: ER_TOO_LONG_IDENT: Identifier name is too long Error: ER_TOO_LONG_IDENT: Identifier name is too long: table name substituted twice Jan 16, 2021
@paveltiunov paveltiunov added bug Something isn't working and removed question The issue is a question. Please use Stack Overflow for questions. labels Jan 16, 2021
@paveltiunov
Copy link
Member

@benswinburne @ovr This is a bug. The table name is substituted twice.

@blefevre
Copy link

I'm having the same issue, it only seems to occur when I have an index defined in my aggregation.

@hassankhan hassankhan added the driver:mysql Issues relating to the MySQL/MariaDB driver label Apr 26, 2021
@paveltiunov
Copy link
Member

paveltiunov commented Jul 29, 2021

Can be fixed by migration to the Cube Store.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working driver:mysql Issues relating to the MySQL/MariaDB driver
Projects
None yet
Development

No branches or pull requests

5 participants