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

AliasNamespace generates alias names longer than allowed by PostgreSQL #396

Open
spilth opened this issue Jan 9, 2020 · 1 comment
Open

AliasNamespace generates alias names longer than allowed by PostgreSQL #396

spilth opened this issue Jan 9, 2020 · 1 comment

Comments

@spilth
Copy link

@spilth spilth commented Jan 9, 2020

We're having an issue on our project where the SQL generated by Join Monster eventually results in alias table names that are too long for PostgreSQL, are truncated and end up colliding and causing errors.

We changed the alias name generation logic to the following and we're seeing aliasNumbers upwards of 600. We've yet to determine why so many aliases are being generated.

name = name.replace(/\s+/g, '').replace(/[^a-zA-Z0-9]/g, '_').slice(0, 10);

var aliasNumber = 0;
var aliasName = name;

while (this.usedTableAliases.has(aliasName)) {
  aliasNumber++;
  aliasName = name + "_jm" + aliasNumber;
}

console.log("ALIAS NUMBER: " + aliasNumber);
this.usedTableAliases.add(aliasName);

return aliasName;
@dennisc9

This comment has been minimized.

Copy link

@dennisc9 dennisc9 commented Jan 10, 2020

I'm having the same issue on my end!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.